Merge branch 'develop' of github.com:vector-im/element-web into develop

This commit is contained in:
RiotRobot 2021-04-12 15:32:40 +01:00
commit 643897a204
3 changed files with 28 additions and 4 deletions

View File

@ -22,6 +22,9 @@ For a good example, see https://develop.element.io/config.json.
`default_hs_url` is specified. When multiple sources are specified, it is unclear `default_hs_url` is specified. When multiple sources are specified, it is unclear
which should take priority and therefore the application cannot continue. which should take priority and therefore the application cannot continue.
* As of Element 1.4.0, identity servers are optional. See [Identity servers](#identity-servers) below. * As of Element 1.4.0, identity servers are optional. See [Identity servers](#identity-servers) below.
1. `sso_immediate_redirect`: When `true`, Element will assume the default server supports SSO
and attempt to send the user there to continue (if they aren't already logged in). Default
`false`. Note that this disables all usage of the welcome page.
1. `features`: Lookup of optional features that may be force-enabled (`true`) or force-disabled (`false`). 1. `features`: Lookup of optional features that may be force-enabled (`true`) or force-disabled (`false`).
When features are not listed here, their defaults will be used, and users can turn them on/off if `showLabsSettings` When features are not listed here, their defaults will be used, and users can turn them on/off if `showLabsSettings`
allows them to. The available optional experimental features vary from release to release and are allows them to. The available optional experimental features vary from release to release and are

View File

@ -1,8 +1,8 @@
{ {
"default_server_name": "matrix.org", "default_server_name": "matrix.org",
"brand": "Element", "brand": "Element",
"integrations_ui_url": "https://scalar-staging.vector.im/", "integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar-staging.vector.im/api", "integrations_rest_url": "https://scalar.vector.im/api",
"integrations_widgets_urls": [ "integrations_widgets_urls": [
"https://scalar.vector.im/_matrix/integrations/v1", "https://scalar.vector.im/_matrix/integrations/v1",
"https://scalar.vector.im/api", "https://scalar.vector.im/api",

View File

@ -35,6 +35,7 @@ import SdkConfig from "matrix-react-sdk/src/SdkConfig";
import {parseQs, parseQsFromFragment} from './url_utils'; import {parseQs, parseQsFromFragment} from './url_utils';
import VectorBasePlatform from "./platform/VectorBasePlatform"; import VectorBasePlatform from "./platform/VectorBasePlatform";
import {createClient} from "matrix-js-sdk/src/matrix";
let lastLocationHashSet: string = null; let lastLocationHashSet: string = null;
@ -153,6 +154,26 @@ export async function loadApp(fragParams: {}) {
// Don't bother loading the app until the config is verified // Don't bother loading the app until the config is verified
const config = await verifyServerConfig(); const config = await verifyServerConfig();
// Before we continue, let's see if we're supposed to do an SSO redirect
const [userId] = await Lifecycle.getStoredSessionOwner();
const hasPossibleToken = !!userId;
const isReturningFromSso = !!params.loginToken;
const autoRedirect = config['sso_immediate_redirect'] === true;
if (!hasPossibleToken && !isReturningFromSso && autoRedirect) {
console.log("Bypassing app load to redirect to SSO");
const tempCli = createClient({
baseUrl: config['validated_server_config'].hsUrl,
idBaseUrl: config['validated_server_config'].isUrl,
});
PlatformPeg.get().startSingleSignOn(tempCli, "sso", `/${getScreenFromLocation(window.location).screen}`);
// We return here because startSingleSignOn() will asynchronously redirect us. We don't
// care to wait for it, and don't want to show any UI while we wait (not even half a welcome
// page). As such, just don't even bother loading the MatrixChat component.
return;
}
const MatrixChat = sdk.getComponent('structures.MatrixChat'); const MatrixChat = sdk.getComponent('structures.MatrixChat');
return <MatrixChat return <MatrixChat
onNewScreen={onNewScreen} onNewScreen={onNewScreen}