mirror of
https://github.com/vector-im/element-web.git
synced 2024-09-09 22:55:12 +00:00
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
|
@ -113,10 +113,10 @@ For a good example, see https://riot.im/develop/config.json.
|
|||
Riot to use. The object is the same as returned by [https://<server_name>/.well-known/matrix/client](https://matrix.org/docs/spec/client_server/latest.html#get-well-known-matrix-client),
|
||||
with added support for a `server_name` under the `m.homeserver` section to display
|
||||
a custom homeserver name. Alternatively, the config can contain a `default_server_name`
|
||||
instead which is where Riot will go to get that same object - see the `.well-known`
|
||||
link above for more information. Note that the `default_server_name` is used to get
|
||||
a complete server configuration whereas the `server_name` in the `default_server_config`
|
||||
is for display purposes only.
|
||||
instead which is where Riot will go to get that same object, although this option is
|
||||
deprecated - see the `.well-known` link above for more information on using this option.
|
||||
Note that the `default_server_name` is used to get a complete server configuration
|
||||
whereas the `server_name` in the `default_server_config` is for display purposes only.
|
||||
* *Note*: The URLs can also be individually specified as `default_hs_url` and
|
||||
`default_is_url`, however these are deprecated. They are maintained for backwards
|
||||
compatibility with older configurations. `default_is_url` is respected only
|
||||
|
|
|
@ -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…
Reference in a new issue