2022-03-18 19:12:36 +03:00
|
|
|
/*
|
2024-09-09 16:57:16 +03:00
|
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
Copyright 2019-2022 The Matrix.org Foundation C.I.C.
|
2022-03-18 19:12:36 +03:00
|
|
|
Copyright 2016 OpenMarket Ltd
|
|
|
|
|
2024-09-09 16:57:16 +03:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
|
|
Please see LICENSE files in the repository root for full details.
|
2022-03-18 19:12:36 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { IClientWellKnown } from "matrix-js-sdk/src/matrix";
|
|
|
|
|
2022-07-14 16:03:34 +03:00
|
|
|
import { ValidatedServerConfig } from "./utils/ValidatedServerConfig";
|
2022-03-18 19:12:36 +03:00
|
|
|
|
|
|
|
// Convention decision: All config options are lower_snake_case
|
|
|
|
// We use an isolated file for the interface so we can mess around with the eslint options.
|
|
|
|
|
|
|
|
/* eslint-disable camelcase */
|
|
|
|
/* eslint @typescript-eslint/naming-convention: ["error", { "selector": "property", "format": ["snake_case"] } ] */
|
|
|
|
|
|
|
|
// see element-web config.md for non-developer docs
|
|
|
|
export interface IConfigOptions {
|
|
|
|
// dev note: while true that this is arbitrary JSON, it's valuable to enforce that all
|
|
|
|
// config options are documented for "find all usages" sort of searching.
|
|
|
|
// [key: string]: any;
|
|
|
|
|
|
|
|
// Properties of this interface are roughly grouped by their subject matter, such as
|
|
|
|
// "instance customisation", "login stuff", "branding", etc. Use blank lines to denote
|
|
|
|
// a logical separation of properties, but keep similar ones near each other.
|
|
|
|
|
|
|
|
// Exactly one of the following must be supplied
|
|
|
|
default_server_config?: IClientWellKnown; // copy/paste of client well-known
|
|
|
|
default_server_name?: string; // domain to do well-known lookup on
|
|
|
|
default_hs_url?: string; // http url
|
|
|
|
|
|
|
|
default_is_url?: string; // used in combination with default_hs_url, but for the identity server
|
|
|
|
|
|
|
|
// This is intended to be overridden by app startup and not specified by the user
|
|
|
|
// This is also why it's allowed to have an interface that isn't snake_case
|
|
|
|
validated_server_config?: ValidatedServerConfig;
|
|
|
|
|
|
|
|
fallback_hs_url?: string;
|
|
|
|
|
|
|
|
disable_custom_urls?: boolean;
|
|
|
|
disable_guests?: boolean;
|
|
|
|
disable_login_language_selector?: boolean;
|
|
|
|
disable_3pid_login?: boolean;
|
|
|
|
|
|
|
|
brand: string;
|
|
|
|
branding?: {
|
|
|
|
welcome_background_url?: string | string[]; // chosen at random if array
|
|
|
|
auth_header_logo_url?: string;
|
|
|
|
auth_footer_links?: { text: string; url: string }[];
|
|
|
|
};
|
|
|
|
|
2024-09-11 23:55:00 +03:00
|
|
|
force_verification?: boolean; // if true, users must verify new logins
|
|
|
|
|
2022-03-18 19:12:36 +03:00
|
|
|
map_style_url?: string; // for location-shared maps
|
|
|
|
|
|
|
|
embedded_pages?: {
|
|
|
|
welcome_url?: string;
|
|
|
|
home_url?: string;
|
|
|
|
login_for_welcome?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
permalink_prefix?: string;
|
|
|
|
|
|
|
|
update_base_url?: string;
|
2023-10-13 12:43:39 +03:00
|
|
|
desktop_builds: {
|
2022-03-18 19:12:36 +03:00
|
|
|
available: boolean;
|
|
|
|
logo: string; // url
|
|
|
|
url: string; // download url
|
2024-07-30 16:16:21 +03:00
|
|
|
url_macos?: string;
|
|
|
|
url_win64?: string;
|
|
|
|
url_win32?: string;
|
|
|
|
url_linux?: string;
|
2022-03-18 19:12:36 +03:00
|
|
|
};
|
2023-10-13 12:43:39 +03:00
|
|
|
mobile_builds: {
|
|
|
|
ios: string | null; // download url
|
|
|
|
android: string | null; // download url
|
|
|
|
fdroid: string | null; // download url
|
2022-03-18 19:12:36 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
mobile_guide_toast?: boolean;
|
|
|
|
|
|
|
|
default_theme?: "light" | "dark" | string; // custom themes are strings
|
|
|
|
default_country_code?: string; // ISO 3166 alpha2 country code
|
|
|
|
default_federate?: boolean;
|
|
|
|
default_device_display_name?: string; // for device naming on login+registration
|
|
|
|
|
|
|
|
setting_defaults?: Record<string, any>; // <SettingName, Value>
|
|
|
|
|
|
|
|
integrations_ui_url?: string;
|
|
|
|
integrations_rest_url?: string;
|
|
|
|
integrations_widgets_urls?: string[];
|
2024-08-27 12:59:54 +03:00
|
|
|
default_widget_container_height?: number; // height in pixels
|
2022-03-18 19:12:36 +03:00
|
|
|
|
2023-10-13 16:24:00 +03:00
|
|
|
show_labs_settings: boolean;
|
2022-03-18 19:12:36 +03:00
|
|
|
features?: Record<string, boolean>; // <FeatureName, EnabledBool>
|
|
|
|
|
|
|
|
bug_report_endpoint_url?: string; // omission disables bug reporting
|
2023-01-16 18:00:03 +03:00
|
|
|
uisi_autorageshake_app?: string; // defaults to "element-auto-uisi"
|
2022-03-18 19:12:36 +03:00
|
|
|
sentry?: {
|
|
|
|
dsn: string;
|
|
|
|
environment?: string; // "production", etc
|
|
|
|
};
|
|
|
|
|
|
|
|
widget_build_url?: string; // url called to replace jitsi/call widget creation
|
2023-06-06 17:07:51 +03:00
|
|
|
widget_build_url_ignore_dm?: boolean;
|
2022-03-18 19:12:36 +03:00
|
|
|
audio_stream_url?: string;
|
|
|
|
jitsi?: {
|
|
|
|
preferred_domain: string;
|
|
|
|
};
|
|
|
|
jitsi_widget?: {
|
|
|
|
skip_built_in_welcome_screen?: boolean;
|
|
|
|
};
|
|
|
|
voip?: {
|
|
|
|
obey_asserted_identity?: boolean; // MSC3086
|
|
|
|
};
|
2022-09-16 18:12:27 +03:00
|
|
|
element_call: {
|
2022-10-07 22:55:48 +03:00
|
|
|
url?: string;
|
2024-03-07 18:38:53 +03:00
|
|
|
guest_spa_url?: string;
|
2022-10-07 22:55:48 +03:00
|
|
|
use_exclusively?: boolean;
|
2022-10-07 23:16:35 +03:00
|
|
|
participant_limit?: number;
|
2022-10-07 22:55:48 +03:00
|
|
|
brand?: string;
|
2022-09-16 18:12:27 +03:00
|
|
|
};
|
2022-03-18 19:12:36 +03:00
|
|
|
|
|
|
|
logout_redirect_url?: string;
|
|
|
|
|
|
|
|
// sso_immediate_redirect is deprecated in favour of sso_redirect_options.immediate
|
|
|
|
sso_immediate_redirect?: boolean;
|
|
|
|
sso_redirect_options?: ISsoRedirectOptions;
|
|
|
|
|
|
|
|
custom_translations_url?: string;
|
|
|
|
|
|
|
|
report_event?: {
|
|
|
|
admin_message_md: string; // message for how to contact the server owner when reporting an event
|
|
|
|
};
|
|
|
|
|
|
|
|
room_directory?: {
|
|
|
|
servers: string[];
|
|
|
|
};
|
|
|
|
|
|
|
|
posthog?: {
|
|
|
|
project_api_key: string;
|
|
|
|
api_host: string; // hostname
|
|
|
|
};
|
|
|
|
analytics_owner?: string; // defaults to `brand`
|
2022-06-14 19:51:51 +03:00
|
|
|
privacy_policy_url?: string; // location for cookie policy
|
2022-03-18 19:12:36 +03:00
|
|
|
|
|
|
|
enable_presence_by_hs_url?: Record<string, boolean>; // <HomeserverName, Enabled>
|
|
|
|
|
|
|
|
terms_and_conditions_links?: { url: string; text: string }[];
|
2023-06-14 10:45:19 +03:00
|
|
|
help_url: string;
|
|
|
|
help_encryption_url: string;
|
2022-03-18 19:12:36 +03:00
|
|
|
|
|
|
|
latex_maths_delims?: {
|
|
|
|
inline?: {
|
|
|
|
left?: string;
|
|
|
|
right?: string;
|
2023-02-13 14:39:16 +03:00
|
|
|
pattern?: {
|
|
|
|
tex?: string;
|
|
|
|
latex?: string;
|
|
|
|
};
|
2022-03-18 19:12:36 +03:00
|
|
|
};
|
|
|
|
display?: {
|
|
|
|
left?: string;
|
|
|
|
right?: string;
|
2023-02-13 14:39:16 +03:00
|
|
|
pattern?: {
|
|
|
|
tex?: string;
|
|
|
|
latex?: string;
|
|
|
|
};
|
2022-03-18 19:12:36 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sync_timeline_limit?: number;
|
|
|
|
dangerously_allow_unsafe_and_insecure_passwords?: boolean; // developer option
|
2022-10-12 01:31:28 +03:00
|
|
|
|
|
|
|
voice_broadcast?: {
|
|
|
|
// length per voice chunk in seconds
|
|
|
|
chunk_length?: number;
|
2022-11-10 13:53:49 +03:00
|
|
|
// max voice broadcast length in seconds
|
|
|
|
max_length?: number;
|
2022-10-12 01:31:28 +03:00
|
|
|
};
|
2022-11-09 13:50:01 +03:00
|
|
|
|
|
|
|
user_notice?: {
|
|
|
|
title: string;
|
|
|
|
description: string;
|
|
|
|
show_once?: boolean;
|
|
|
|
};
|
2023-04-26 12:36:00 +03:00
|
|
|
|
|
|
|
feedback: {
|
|
|
|
existing_issues_url: string;
|
|
|
|
new_issue_url: string;
|
|
|
|
};
|
2023-06-22 13:15:44 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration for OIDC issuers where a static client_id has been issued for the app.
|
|
|
|
* Otherwise dynamic client registration is attempted.
|
|
|
|
* The issuer URL must have a trailing `/`.
|
|
|
|
* OPTIONAL
|
|
|
|
*/
|
2024-05-14 12:38:33 +03:00
|
|
|
oidc_static_clients?: {
|
|
|
|
[issuer: string]: { client_id: string };
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration for OIDC dynamic registration where a static OIDC client is not configured.
|
|
|
|
*/
|
|
|
|
oidc_metadata?: {
|
|
|
|
client_uri?: string;
|
|
|
|
logo_uri?: string;
|
|
|
|
tos_uri?: string;
|
|
|
|
policy_uri?: string;
|
|
|
|
contacts?: string[];
|
|
|
|
};
|
2022-03-18 19:12:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ISsoRedirectOptions {
|
|
|
|
immediate?: boolean;
|
|
|
|
on_welcome_page?: boolean;
|
2024-06-14 13:19:02 +03:00
|
|
|
on_login_page?: boolean;
|
2022-03-18 19:12:36 +03:00
|
|
|
}
|