From ca392ed20ca2b2d1fbce419fbadfe510ce2305a4 Mon Sep 17 00:00:00 2001 From: naskya Date: Sun, 23 Jun 2024 17:08:45 +0900 Subject: [PATCH] WIP --- src/config/server.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/config/server.rs b/src/config/server.rs index 7846183..d543702 100644 --- a/src/config/server.rs +++ b/src/config/server.rs @@ -27,6 +27,8 @@ pub struct Config { pub id: Option, #[validate(nested)] pub file: Option, + #[validate(nested)] + pub security: Option, } #[derive(Deserialize, Serialize, Validate, Debug)] @@ -129,3 +131,29 @@ pub struct File { pub proxy_remote_file: Option, pub cache_remote_file: Option, } + +#[derive(Deserialize, Serialize, Validate, Debug)] +pub struct Security { + pub require_authorized_fetch: Option, + pub private_mode: Option, + #[validate(nested)] + pub captcha: Option, + pub enable_strict_email_check: Option, + pub log_ip_address: Option, +} + +#[derive(Deserialize, Serialize, Validate, Debug)] +pub struct CaptchaConfig { + pub enabled: bool, + pub kind: Captcha, + pub site_key: String, + pub secret_key: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub enum Captcha { + #[serde(rename = "hCaptcha")] + HCaptcha, + #[serde(rename = "reCAPTCHA")] + ReCaptcha, +}