|
| 1 | +/* |
| 2 | +Copyright 2016 OpenMarket Ltd |
| 3 | +Copyright 2019 - 2022 The Matrix.org Foundation C.I.C. |
| 4 | +
|
| 5 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +you may not use this file except in compliance with the License. |
| 7 | +You may obtain a copy of the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | +Unless required by applicable law or agreed to in writing, software |
| 12 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +See the License for the specific language governing permissions and |
| 15 | +limitations under the License. |
| 16 | +*/ |
| 17 | + |
| 18 | +import { IClientWellKnown } from "matrix-js-sdk/src/matrix"; |
| 19 | + |
| 20 | +import { ValidatedServerConfig } from "./utils/AutoDiscoveryUtils"; |
| 21 | + |
| 22 | +// Convention decision: All config options are lower_snake_case |
| 23 | +// We use an isolated file for the interface so we can mess around with the eslint options. |
| 24 | + |
| 25 | +/* eslint-disable camelcase */ |
| 26 | +/* eslint @typescript-eslint/naming-convention: ["error", { "selector": "property", "format": ["snake_case"] } ] */ |
| 27 | + |
| 28 | +// see element-web config.md for non-developer docs |
| 29 | +export interface IConfigOptions { |
| 30 | + // dev note: while true that this is arbitrary JSON, it's valuable to enforce that all |
| 31 | + // config options are documented for "find all usages" sort of searching. |
| 32 | + // [key: string]: any; |
| 33 | + |
| 34 | + // Properties of this interface are roughly grouped by their subject matter, such as |
| 35 | + // "instance customisation", "login stuff", "branding", etc. Use blank lines to denote |
| 36 | + // a logical separation of properties, but keep similar ones near each other. |
| 37 | + |
| 38 | + // Exactly one of the following must be supplied |
| 39 | + default_server_config?: IClientWellKnown; // copy/paste of client well-known |
| 40 | + default_server_name?: string; // domain to do well-known lookup on |
| 41 | + default_hs_url?: string; // http url |
| 42 | + |
| 43 | + default_is_url?: string; // used in combination with default_hs_url, but for the identity server |
| 44 | + |
| 45 | + // This is intended to be overridden by app startup and not specified by the user |
| 46 | + // This is also why it's allowed to have an interface that isn't snake_case |
| 47 | + validated_server_config?: ValidatedServerConfig; |
| 48 | + |
| 49 | + fallback_hs_url?: string; |
| 50 | + |
| 51 | + disable_custom_urls?: boolean; |
| 52 | + disable_guests?: boolean; |
| 53 | + disable_login_language_selector?: boolean; |
| 54 | + disable_3pid_login?: boolean; |
| 55 | + |
| 56 | + brand: string; |
| 57 | + branding?: { |
| 58 | + welcome_background_url?: string | string[]; // chosen at random if array |
| 59 | + auth_header_logo_url?: string; |
| 60 | + auth_footer_links?: {text: string, url: string}[]; |
| 61 | + }; |
| 62 | + |
| 63 | + map_style_url?: string; // for location-shared maps |
| 64 | + |
| 65 | + embedded_pages?: { |
| 66 | + welcome_url?: string; |
| 67 | + home_url?: string; |
| 68 | + login_for_welcome?: boolean; |
| 69 | + }; |
| 70 | + |
| 71 | + permalink_prefix?: string; |
| 72 | + |
| 73 | + update_base_url?: string; |
| 74 | + desktop_builds?: { |
| 75 | + available: boolean; |
| 76 | + logo: string; // url |
| 77 | + url: string; // download url |
| 78 | + }; |
| 79 | + mobile_builds?: { |
| 80 | + ios?: string; // download url |
| 81 | + android?: string; // download url |
| 82 | + fdroid?: string; // download url |
| 83 | + }; |
| 84 | + |
| 85 | + mobile_guide_toast?: boolean; |
| 86 | + |
| 87 | + default_theme?: "light" | "dark" | string; // custom themes are strings |
| 88 | + default_country_code?: string; // ISO 3166 alpha2 country code |
| 89 | + default_federate?: boolean; |
| 90 | + default_device_display_name?: string; // for device naming on login+registration |
| 91 | + |
| 92 | + setting_defaults?: Record<string, any>; // <SettingName, Value> |
| 93 | + |
| 94 | + integrations_ui_url?: string; |
| 95 | + integrations_rest_url?: string; |
| 96 | + integrations_widgets_urls?: string[]; |
| 97 | + |
| 98 | + show_labs_settings?: boolean; |
| 99 | + features?: Record<string, boolean>; // <FeatureName, EnabledBool> |
| 100 | + |
| 101 | + bug_report_endpoint_url?: string; // omission disables bug reporting |
| 102 | + uisi_autorageshake_app?: string; |
| 103 | + sentry?: { |
| 104 | + dsn: string; |
| 105 | + environment?: string; // "production", etc |
| 106 | + }; |
| 107 | + |
| 108 | + widget_build_url?: string; // url called to replace jitsi/call widget creation |
| 109 | + audio_stream_url?: string; |
| 110 | + jitsi?: { |
| 111 | + preferred_domain: string; |
| 112 | + }; |
| 113 | + jitsi_widget?: { |
| 114 | + skip_built_in_welcome_screen?: boolean; |
| 115 | + }; |
| 116 | + voip?: { |
| 117 | + obey_asserted_identity?: boolean; // MSC3086 |
| 118 | + }; |
| 119 | + |
| 120 | + logout_redirect_url?: string; |
| 121 | + |
| 122 | + // sso_immediate_redirect is deprecated in favour of sso_redirect_options.immediate |
| 123 | + sso_immediate_redirect?: boolean; |
| 124 | + sso_redirect_options?: ISsoRedirectOptions; |
| 125 | + |
| 126 | + custom_translations_url?: string; |
| 127 | + |
| 128 | + report_event?: { |
| 129 | + admin_message_md: string; // message for how to contact the server owner when reporting an event |
| 130 | + }; |
| 131 | + |
| 132 | + welcome_user_id?: string; |
| 133 | + |
| 134 | + room_directory?: { |
| 135 | + servers: string[]; |
| 136 | + }; |
| 137 | + |
| 138 | + // piwik (matomo) is deprecated in favour of posthog |
| 139 | + piwik?: false | { |
| 140 | + url: string; // piwik instance |
| 141 | + site_id: string; |
| 142 | + policy_url: string; // cookie policy |
| 143 | + whitelisted_hs_urls: string[]; |
| 144 | + }; |
| 145 | + posthog?: { |
| 146 | + project_api_key: string; |
| 147 | + api_host: string; // hostname |
| 148 | + }; |
| 149 | + analytics_owner?: string; // defaults to `brand` |
| 150 | + |
| 151 | + // Server hosting upsell options |
| 152 | + hosting_signup_link?: string; // slightly different from `host_signup` |
| 153 | + host_signup?: { |
| 154 | + brand?: string; // acts as the enabled flag too (truthy == show) |
| 155 | + |
| 156 | + // Required-ness denotes when `brand` is truthy |
| 157 | + cookie_policy_url: string; |
| 158 | + privacy_policy_url: string; |
| 159 | + terms_of_service_url: string; |
| 160 | + url: string; |
| 161 | + domains?: string[]; |
| 162 | + }; |
| 163 | + |
| 164 | + enable_presence_by_hs_url?: Record<string, boolean>; // <HomeserverName, Enabled> |
| 165 | + |
| 166 | + terms_and_conditions_links?: { url: string, text: string }[]; |
| 167 | + |
| 168 | + latex_maths_delims?: { |
| 169 | + inline?: { |
| 170 | + left?: string; |
| 171 | + right?: string; |
| 172 | + }; |
| 173 | + display?: { |
| 174 | + left?: string; |
| 175 | + right?: string; |
| 176 | + }; |
| 177 | + }; |
| 178 | + |
| 179 | + sync_timeline_limit?: number; |
| 180 | + dangerously_allow_unsafe_and_insecure_passwords?: boolean; // developer option |
| 181 | +} |
| 182 | + |
| 183 | +export interface ISsoRedirectOptions { |
| 184 | + immediate?: boolean; |
| 185 | + on_welcome_page?: boolean; |
| 186 | +} |
0 commit comments