2019-02-07 16:25:09 +00:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2019-2024 New Vector Ltd.
|
2019-02-07 16:25:09 +00:00
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2019-02-07 16:25:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
2020-09-17 11:55:10 +01:00
|
|
|
import classNames from "classnames";
|
2025-02-04 13:41:34 +00:00
|
|
|
import { EmptyObject } from "matrix-js-sdk/src/matrix";
|
2020-09-17 11:55:10 +01:00
|
|
|
|
2019-02-07 16:25:09 +00:00
|
|
|
import SdkConfig from "../../../SdkConfig";
|
2019-12-12 19:31:52 -07:00
|
|
|
import AuthPage from "./AuthPage";
|
2020-09-17 11:55:10 +01:00
|
|
|
import SettingsStore from "../../../settings/SettingsStore";
|
2021-06-29 13:11:58 +01:00
|
|
|
import { UIFeature } from "../../../settings/UIFeature";
|
2021-07-20 12:22:32 +02:00
|
|
|
import LanguageSelector from "./LanguageSelector";
|
2022-03-02 16:33:40 -07:00
|
|
|
import EmbeddedPage from "../../structures/EmbeddedPage";
|
2022-03-24 23:56:09 -06:00
|
|
|
import { MATRIX_LOGO_HTML } from "../../structures/static-page-vars";
|
2020-03-27 14:05:14 +00:00
|
|
|
|
2025-02-04 13:41:34 +00:00
|
|
|
export default class Welcome extends React.PureComponent<EmptyObject> {
|
2021-07-15 15:45:36 +02:00
|
|
|
public render(): React.ReactNode {
|
2022-03-18 10:12:36 -06:00
|
|
|
const pagesConfig = SdkConfig.getObject("embedded_pages");
|
2023-03-07 10:45:55 +00:00
|
|
|
let pageUrl: string | undefined;
|
2019-02-08 13:53:17 +00:00
|
|
|
if (pagesConfig) {
|
2022-03-18 10:12:36 -06:00
|
|
|
pageUrl = pagesConfig.get("welcome_url");
|
2019-02-08 13:53:17 +00:00
|
|
|
}
|
2023-05-12 09:45:04 +01:00
|
|
|
|
|
|
|
|
const replaceMap: Record<string, string> = {
|
|
|
|
|
"$riot:ssoUrl": "#/start_sso",
|
|
|
|
|
"$riot:casUrl": "#/start_cas",
|
|
|
|
|
"$matrixLogo": MATRIX_LOGO_HTML,
|
|
|
|
|
"[matrix]": MATRIX_LOGO_HTML,
|
|
|
|
|
};
|
|
|
|
|
|
2019-02-08 13:53:17 +00:00
|
|
|
if (!pageUrl) {
|
2023-05-12 09:45:04 +01:00
|
|
|
// Fall back to default and replace $logoUrl in welcome.html
|
|
|
|
|
const brandingConfig = SdkConfig.getObject("branding");
|
|
|
|
|
const logoUrl = brandingConfig?.get("auth_header_logo_url") ?? "themes/element/img/logos/element-logo.svg";
|
|
|
|
|
replaceMap["$logoUrl"] = logoUrl;
|
2019-02-08 13:53:17 +00:00
|
|
|
pageUrl = "welcome.html";
|
|
|
|
|
}
|
2019-02-07 17:16:02 +00:00
|
|
|
|
2019-02-07 16:25:09 +00:00
|
|
|
return (
|
|
|
|
|
<AuthPage>
|
2020-09-17 11:55:10 +01:00
|
|
|
<div
|
|
|
|
|
className={classNames("mx_Welcome", {
|
|
|
|
|
mx_WelcomePage_registrationDisabled: !SettingsStore.getValue(UIFeature.Registration),
|
|
|
|
|
})}
|
2024-10-03 09:55:06 +01:00
|
|
|
data-testid="mx_welcome_screen"
|
2020-09-17 11:55:10 +01:00
|
|
|
>
|
2023-05-12 09:45:04 +01:00
|
|
|
<EmbeddedPage className="mx_WelcomePage" url={pageUrl} replaceMap={replaceMap} />
|
2019-02-08 11:39:30 +00:00
|
|
|
<LanguageSelector />
|
|
|
|
|
</div>
|
2019-02-07 16:25:09 +00:00
|
|
|
</AuthPage>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|