rename pow section in settings to captcha and add options to configure

suggested difficulty factors for use in CAPTCHA configurations
estimates

The current CAPTCHA configuration panel requires the user to provide
difficulty factor <--> visitor threshold mapping, which can be tedious
if the user isn't familiar with those parameters. Also, it could lead to
ineffective limiting from mCaptcha's side, should it be configured
improperly.

So an estimate computed from well known statistics like peak, avg and
broke-my-site traffic could go a long way.
This commit is contained in:
realaravinth
2021-12-03 14:21:18 +05:30
parent 032f6040b8
commit 42544ec421
3 changed files with 19 additions and 4 deletions

View File

@@ -36,6 +36,15 @@ pub struct Server {
pub struct Captcha {
pub salt: String,
pub gc: u64,
pub default_difficulty_strategy: DefaultDifficultyStrategy,
}
#[derive(Debug, Clone, Deserialize)]
pub struct DefaultDifficultyStrategy {
pub avg_traffic_difficulty: u32,
pub broke_my_site_traffic_difficulty: u32,
pub peak_sustainable_traffic_difficulty: u32,
pub duration: u32,
}
#[derive(Debug, Clone, Deserialize)]
@@ -102,7 +111,7 @@ pub struct Settings {
pub database: Database,
pub redis: Option<Redis>,
pub server: Server,
pub pow: Captcha,
pub captcha: Captcha,
pub source_code: String,
pub smtp: Option<Smtp>,
pub allow_registration: bool,