|
|
|
@ -100,6 +100,12 @@ pub struct Config { |
|
|
|
pub global: ConfigFragment<Nothing>, |
|
|
|
pub global: ConfigFragment<Nothing>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for Config { |
|
|
|
|
|
|
|
fn default() -> Self { |
|
|
|
|
|
|
|
Self::get_preset(ConfigPreset::default()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Deserialize)] |
|
|
|
#[derive(Debug, Clone, Deserialize)] |
|
|
|
pub struct ConfigFragment<T> |
|
|
|
pub struct ConfigFragment<T> |
|
|
|
where |
|
|
|
where |
|
|
|
@ -451,6 +457,36 @@ macro_rules! default_restriction_map { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl ClientMediaConfig { |
|
|
|
|
|
|
|
fn todo() -> Self { |
|
|
|
|
|
|
|
Self { |
|
|
|
|
|
|
|
download: MediaLimitation::new( |
|
|
|
|
|
|
|
MediaTimeframe::PerHour(ByteSize::mb(200)), |
|
|
|
|
|
|
|
ByteSize::mb(500), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
upload: MediaLimitation::new( |
|
|
|
|
|
|
|
MediaTimeframe::PerHour(ByteSize::mb(20)), |
|
|
|
|
|
|
|
ByteSize::mb(100), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
fetch: MediaLimitation::new( |
|
|
|
|
|
|
|
MediaTimeframe::PerHour(ByteSize::mb(200)), |
|
|
|
|
|
|
|
ByteSize::mb(500), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl FederationMediaConfig { |
|
|
|
|
|
|
|
fn todo() -> Self { |
|
|
|
|
|
|
|
Self { |
|
|
|
|
|
|
|
download: MediaLimitation::new( |
|
|
|
|
|
|
|
MediaTimeframe::PerHour(ByteSize::mb(200)), |
|
|
|
|
|
|
|
ByteSize::mb(500), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Config { |
|
|
|
impl Config { |
|
|
|
fn apply_overrides(self, shadow: ShadowConfig) -> Self { |
|
|
|
fn apply_overrides(self, shadow: ShadowConfig) -> Self { |
|
|
|
let ShadowConfig { |
|
|
|
let ShadowConfig { |
|
|
|
@ -490,11 +526,7 @@ impl Config { |
|
|
|
// Login, PerHour, 10, 10;
|
|
|
|
// Login, PerHour, 10, 10;
|
|
|
|
// RegistrationTokenValidity, PerDay, 10, 20
|
|
|
|
// RegistrationTokenValidity, PerDay, 10, 20
|
|
|
|
), |
|
|
|
), |
|
|
|
media: ClientMediaConfig { |
|
|
|
media: ClientMediaConfig::todo(), |
|
|
|
download: todo!(), |
|
|
|
|
|
|
|
upload: todo!(), |
|
|
|
|
|
|
|
fetch: todo!(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
additional_fields: AuthenticationFailures::new( |
|
|
|
additional_fields: AuthenticationFailures::new( |
|
|
|
Timeframe::PerDay(nz(10)), |
|
|
|
Timeframe::PerDay(nz(10)), |
|
|
|
nz(40), |
|
|
|
nz(40), |
|
|
|
@ -507,7 +539,7 @@ impl Config { |
|
|
|
Knock, PerDay, 10, 20; |
|
|
|
Knock, PerDay, 10, 20; |
|
|
|
Invite, PerDay, 10, 20 |
|
|
|
Invite, PerDay, 10, 20 |
|
|
|
), |
|
|
|
), |
|
|
|
media: todo!(), |
|
|
|
media: FederationMediaConfig::todo(), |
|
|
|
additional_fields: Nothing, |
|
|
|
additional_fields: Nothing, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -519,7 +551,7 @@ impl Config { |
|
|
|
Login, PerHour, 10, 10; |
|
|
|
Login, PerHour, 10, 10; |
|
|
|
RegistrationTokenValidity, PerDay, 10, 20 |
|
|
|
RegistrationTokenValidity, PerDay, 10, 20 |
|
|
|
), |
|
|
|
), |
|
|
|
media: todo!(), |
|
|
|
media: ClientMediaConfig::todo(), |
|
|
|
additional_fields: Nothing, |
|
|
|
additional_fields: Nothing, |
|
|
|
}, |
|
|
|
}, |
|
|
|
federation: ConfigFragmentFragment { |
|
|
|
federation: ConfigFragmentFragment { |
|
|
|
@ -529,7 +561,7 @@ impl Config { |
|
|
|
// Knock, PerDay, 10, 20;
|
|
|
|
// Knock, PerDay, 10, 20;
|
|
|
|
// Invite, PerDay, 10, 20
|
|
|
|
// Invite, PerDay, 10, 20
|
|
|
|
), |
|
|
|
), |
|
|
|
media: todo!(), |
|
|
|
media: FederationMediaConfig::todo(), |
|
|
|
additional_fields: Nothing, |
|
|
|
additional_fields: Nothing, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|