From 21d82018cf84ab0fdd10613d254b9562aea8eea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0spik?= Date: Thu, 7 May 2026 02:35:20 +0300 Subject: [PATCH] feat: add legal links to root payload (#733) Signed-off-by: ispik --- crates/core/config/Revolt.toml | 6 ++++++ crates/core/config/src/lib.rs | 11 +++++++++++ crates/delta/src/routes/root.rs | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/crates/core/config/Revolt.toml b/crates/core/config/Revolt.toml index aee3a841..2440bb31 100644 --- a/crates/core/config/Revolt.toml +++ b/crates/core/config/Revolt.toml @@ -317,6 +317,12 @@ emojis = 500_000 # default: 5 process_message_delay_limit = 5 +[features.legal_links] +# URLs for legal documents +terms_of_service = "" +privacy_policy = "" +guidelines = "" + [sentry] # Configuration for Sentry error reporting api = "" diff --git a/crates/core/config/src/lib.rs b/crates/core/config/src/lib.rs index b0cfa455..3dc2771a 100644 --- a/crates/core/config/src/lib.rs +++ b/crates/core/config/src/lib.rs @@ -382,6 +382,16 @@ pub struct FeaturesLimitsCollection { pub roles: HashMap, } +#[derive(Deserialize, Debug, Clone)] +pub struct LegalLinks { + /// Terms of Service URL + pub terms_of_service: String, + /// Privacy Policy URL + pub privacy_policy: String, + /// Guidelines URL + pub guidelines: String, +} + #[derive(Deserialize, Debug, Clone)] pub struct FeaturesAdvanced { #[serde(default)] @@ -399,6 +409,7 @@ impl Default for FeaturesAdvanced { #[derive(Deserialize, Debug, Clone)] pub struct Features { pub limits: FeaturesLimitsCollection, + pub legal_links: LegalLinks, pub webhooks_enabled: bool, pub mass_mentions_send_notifications: bool, pub mass_mentions_enabled: bool, diff --git a/crates/delta/src/routes/root.rs b/crates/delta/src/routes/root.rs index 14ead75c..c0fb4fae 100644 --- a/crates/delta/src/routes/root.rs +++ b/crates/delta/src/routes/root.rs @@ -57,6 +57,8 @@ pub struct RevoltFeatures { pub livekit: VoiceFeature, /// Limits pub limits: LimitsConfig, + /// Legal links + pub legal_links: LegalLinks, } /// # Limits For Users @@ -70,6 +72,17 @@ pub struct LimitsConfig { pub default: UserLimits, } +/// # Legal links +#[derive(Serialize, JsonSchema, Debug)] +pub struct LegalLinks { + /// Terms of Service URL + pub terms_of_service: String, + /// Privacy Policy URL + pub privacy_policy: String, + /// Guidelines URL + pub guidelines: String, +} + /// # Global limits #[derive(Serialize, JsonSchema, Debug)] pub struct GlobalLimits { @@ -238,6 +251,11 @@ pub async fn root() -> Result> { new_user: UserLimits::from_feature_limits(config.features.limits.new_user), default: UserLimits::from_feature_limits(config.features.limits.default), }, + legal_links: LegalLinks { + terms_of_service: config.features.legal_links.terms_of_service, + privacy_policy: config.features.legal_links.privacy_policy, + guidelines: config.features.legal_links.guidelines, + }, }, ws: config.hosts.events, app: config.hosts.app,