mas_config/sections/branding.rs
1// Copyright 2026 Element Creations Ltd.
2// Copyright 2024, 2025 New Vector Ltd.
3// Copyright 2023, 2024 The Matrix.org Foundation C.I.C.
4//
5// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
6// Please see LICENSE files in the repository root for full details.
7
8use schemars::JsonSchema;
9use serde::{Deserialize, Serialize};
10use url::Url;
11
12use crate::ConfigurationSection;
13
14/// Configuration section for tweaking the branding of the service
15#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, Default)]
16pub struct BrandingConfig {
17 /// A human-readable name. Defaults to the server's address.
18 #[serde(skip_serializing_if = "Option::is_none")]
19 pub service_name: Option<String>,
20
21 /// Link to a privacy policy, displayed in the footer of web pages and
22 /// emails. It is also advertised to clients through the `op_policy_uri`
23 /// OIDC provider metadata.
24 #[serde(skip_serializing_if = "Option::is_none")]
25 pub policy_uri: Option<Url>,
26
27 /// Link to a terms of service document, displayed in the footer of web
28 /// pages and emails. It is also advertised to clients through the
29 /// `op_tos_uri` OIDC provider metadata.
30 #[serde(skip_serializing_if = "Option::is_none")]
31 pub tos_uri: Option<Url>,
32
33 /// Legal imprint, displayed in the footer in the footer of web pages and
34 /// emails.
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub imprint: Option<String>,
37}
38
39impl BrandingConfig {
40 /// Returns true if the configuration is the default one
41 pub(crate) fn is_default(&self) -> bool {
42 self.service_name.is_none()
43 && self.policy_uri.is_none()
44 && self.tos_uri.is_none()
45 && self.imprint.is_none()
46 }
47}
48
49impl ConfigurationSection for BrandingConfig {
50 const PATH: Option<&'static str> = Some("branding");
51}