Do not fail on server liveliness checks during startup
Also warn about deprecated config option usage. See https://github.com/vector-im/riot-web/issues/9828
This commit is contained in:
parent
428960aff2
commit
42be1d633c
2 changed files with 19 additions and 6 deletions
|
@ -465,6 +465,11 @@ async function verifyServerConfig() {
|
|||
// context of email validation. Because we don't respect them otherwise, we do not need
|
||||
// to parse or consider them here.
|
||||
|
||||
// Note: Although we throw all 3 possible configuration options through a .well-known-style
|
||||
// verification, we do not care if the servers are online at this point. We do moderately
|
||||
// care if they are syntactically correct though, so we shove them through the .well-known
|
||||
// validators for that purpose.
|
||||
|
||||
const config = SdkConfig.get();
|
||||
let wkConfig = config['default_server_config']; // overwritten later under some conditions
|
||||
const serverName = config['default_server_name'];
|
||||
|
@ -486,6 +491,10 @@ async function verifyServerConfig() {
|
|||
|
||||
if (hsUrl) {
|
||||
console.log("Config uses a default_hs_url - constructing a default_server_config using this information");
|
||||
console.warn(
|
||||
"DEPRECATED CONFIG OPTION: In the future, default_hs_url will not be accepted. Please use " +
|
||||
"default_server_config instead.",
|
||||
);
|
||||
|
||||
wkConfig = {
|
||||
"m.homeserver": {
|
||||
|
@ -507,10 +516,14 @@ async function verifyServerConfig() {
|
|||
|
||||
if (serverName) {
|
||||
console.log("Config uses a default_server_name - doing .well-known lookup");
|
||||
console.warn(
|
||||
"DEPRECATED CONFIG OPTION: In the future, default_server_name will not be accepted. Please " +
|
||||
"use default_server_config instead.",
|
||||
);
|
||||
discoveryResult = await AutoDiscovery.findClientConfig(serverName);
|
||||
}
|
||||
|
||||
validatedConfig = AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult);
|
||||
validatedConfig = AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult, true);
|
||||
} catch (e) {
|
||||
const {hsUrl, isUrl, userId} = Lifecycle.getLocalStorageSessionVars();
|
||||
if (hsUrl && userId) {
|
||||
|
@ -518,7 +531,7 @@ async function verifyServerConfig() {
|
|||
console.warn("A session was found - suppressing config error and using the session's homeserver");
|
||||
|
||||
console.log("Using pre-existing hsUrl and isUrl: ", {hsUrl, isUrl});
|
||||
validatedConfig = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(hsUrl, isUrl);
|
||||
validatedConfig = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(hsUrl, isUrl, true);
|
||||
} else {
|
||||
// the user is not logged in, so scream
|
||||
throw e;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue