forked from jmug/stoatchat
Merge branch 'master' into webhooks
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
use authifier::config::{ResolveIp, Shield};
|
||||
|
||||
use super::variables::delta::{
|
||||
APP_URL, HCAPTCHA_KEY, INVITE_ONLY, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD, SMTP_USERNAME,
|
||||
USE_EMAIL, USE_HCAPTCHA,
|
||||
APP_URL, AUTHIFIER_SHIELD_KEY, HCAPTCHA_KEY, INVITE_ONLY, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD,
|
||||
SMTP_USERNAME, USE_EMAIL, USE_HCAPTCHA,
|
||||
};
|
||||
|
||||
use crate::rauth::config::{
|
||||
use crate::authifier::config::{
|
||||
Captcha, Config, EmailVerificationConfig, SMTPSettings, Template, Templates,
|
||||
};
|
||||
|
||||
@@ -59,5 +61,19 @@ pub fn config() -> Config {
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(api_key) = &*AUTHIFIER_SHIELD_KEY {
|
||||
config.shield = Shield::Enabled {
|
||||
api_key: api_key.to_string(),
|
||||
strict: false,
|
||||
};
|
||||
}
|
||||
|
||||
if std::env::var("TRUST_CLOUDFLARE")
|
||||
.map(|x| x == "1")
|
||||
.unwrap_or_default()
|
||||
{
|
||||
config.resolve_ip = ResolveIp::Cloudflare;
|
||||
}
|
||||
|
||||
config
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
pub mod authifier;
|
||||
pub mod log;
|
||||
pub mod manipulation;
|
||||
pub mod pfp;
|
||||
pub mod rauth;
|
||||
pub mod r#ref;
|
||||
pub mod regex;
|
||||
pub mod result;
|
||||
|
||||
@@ -64,6 +64,9 @@ pub enum Error {
|
||||
IsBot,
|
||||
BotIsPrivate,
|
||||
|
||||
// ? User safety related errors
|
||||
CannotReportYourself,
|
||||
|
||||
// ? Permission errors
|
||||
MissingPermission {
|
||||
permission: Permission,
|
||||
@@ -166,6 +169,8 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
Error::IsBot => Status::BadRequest,
|
||||
Error::BotIsPrivate => Status::Forbidden,
|
||||
|
||||
Error::CannotReportYourself => Status::BadRequest,
|
||||
|
||||
Error::MissingPermission { .. } => Status::Forbidden,
|
||||
Error::MissingUserPermission { .. } => Status::Forbidden,
|
||||
Error::NotElevated => Status::Forbidden,
|
||||
|
||||
@@ -30,6 +30,8 @@ lazy_static! {
|
||||
env::var("REVOLT_VAPID_PRIVATE_KEY").expect("Missing REVOLT_VAPID_PRIVATE_KEY environment variable.");
|
||||
pub static ref VAPID_PUBLIC_KEY: String =
|
||||
env::var("REVOLT_VAPID_PUBLIC_KEY").expect("Missing REVOLT_VAPID_PUBLIC_KEY environment variable.");
|
||||
pub static ref AUTHIFIER_SHIELD_KEY: Option<String> =
|
||||
env::var("REVOLT_AUTHIFIER_SHIELD_KEY").ok();
|
||||
|
||||
// Application Flags
|
||||
pub static ref INVITE_ONLY: bool = env::var("REVOLT_INVITE_ONLY").map_or(false, |v| v == "1");
|
||||
|
||||
Reference in New Issue
Block a user