mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge branch 'develop' of github.com:vector-im/riot-web into develop
This commit is contained in:
commit
5f4d011606
@ -79,6 +79,7 @@ import Platform from './platform';
|
|||||||
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
||||||
import SettingsStore, {SettingLevel} from "matrix-react-sdk/lib/settings/SettingsStore";
|
import SettingsStore, {SettingLevel} from "matrix-react-sdk/lib/settings/SettingsStore";
|
||||||
import Tinter from 'matrix-react-sdk/lib/Tinter';
|
import Tinter from 'matrix-react-sdk/lib/Tinter';
|
||||||
|
import SdkConfig from "matrix-react-sdk/lib/SdkConfig";
|
||||||
|
|
||||||
var lastLocationHashSet = null;
|
var lastLocationHashSet = null;
|
||||||
|
|
||||||
@ -245,8 +246,30 @@ async function loadApp() {
|
|||||||
// set the platform for react sdk (our Platform object automatically picks the right one)
|
// set the platform for react sdk (our Platform object automatically picks the right one)
|
||||||
PlatformPeg.set(new Platform());
|
PlatformPeg.set(new Platform());
|
||||||
|
|
||||||
|
// Load the config file. First try to load up a domain-specific config of the
|
||||||
|
// form "config.$domain.json" and if that fails, fall back to config.json.
|
||||||
|
let configJson;
|
||||||
|
let configError;
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
configJson = await getConfig(`config.${document.domain}.json`);
|
||||||
|
// 404s succeed with an empty json config, so check that there are keys
|
||||||
|
if (Object.keys(configJson).length === 0) {
|
||||||
|
throw new Error(); // throw to enter the catch
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
configJson = await getConfig("config.json");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
configError = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX: We call this twice, once here and once in MatrixChat as a prop. We call it here to ensure
|
||||||
|
// granular settings are loaded correctly and to avoid duplicating the override logic for the theme.
|
||||||
|
SdkConfig.put(configJson);
|
||||||
|
|
||||||
// don't try to redirect to the native apps if we're
|
// don't try to redirect to the native apps if we're
|
||||||
// verifying a 3pid
|
// verifying a 3pid (but after we've loaded the config)
|
||||||
const preventRedirect = Boolean(fragparts.params.client_secret);
|
const preventRedirect = Boolean(fragparts.params.client_secret);
|
||||||
|
|
||||||
if (!preventRedirect) {
|
if (!preventRedirect) {
|
||||||
@ -278,28 +301,10 @@ async function loadApp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the config file. First try to load up a domain-specific config of the
|
|
||||||
// form "config.$domain.json" and if that fails, fall back to config.json.
|
|
||||||
let configJson;
|
|
||||||
let configError;
|
|
||||||
try {
|
|
||||||
try {
|
|
||||||
configJson = await getConfig(`config.${document.domain}.json`);
|
|
||||||
// 404s succeed with an empty json config, so check that there are keys
|
|
||||||
if (Object.keys(configJson).length === 0) {
|
|
||||||
throw new Error(); // throw to enter the catch
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
configJson = await getConfig("config.json");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
configError = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// as quickly as we possibly can, set a default theme...
|
// as quickly as we possibly can, set a default theme...
|
||||||
const styleElements = Object.create(null);
|
const styleElements = Object.create(null);
|
||||||
let a;
|
let a;
|
||||||
const theme = SettingsStore.getValueAt(SettingLevel.DEFAULT, "theme");
|
const theme = SettingsStore.getValue("theme");
|
||||||
for (let i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
|
for (let i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
|
||||||
const href = a.getAttribute("href");
|
const href = a.getAttribute("href");
|
||||||
if (!href) continue;
|
if (!href) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user