Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import React, { ReactNode } from "react";
|
||||
import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { _t, _td, newTranslatableError } from "../languageHandler";
|
||||
import { makeType } from "./TypeUtils";
|
||||
import SdkConfig from '../SdkConfig';
|
||||
import { ValidatedServerConfig } from './ValidatedServerConfig';
|
||||
import SdkConfig from "../SdkConfig";
|
||||
import { ValidatedServerConfig } from "./ValidatedServerConfig";
|
||||
|
||||
const LIVELINESS_DISCOVERY_ERRORS: string[] = [
|
||||
AutoDiscovery.ERROR_INVALID_HOMESERVER,
|
||||
|
@ -44,7 +44,9 @@ export default class AutoDiscoveryUtils {
|
|||
*/
|
||||
static isLivelinessError(error: string | Error): boolean {
|
||||
if (!error) return false;
|
||||
return !!LIVELINESS_DISCOVERY_ERRORS.find(e => typeof error === "string" ? e === error : e === error.message);
|
||||
return !!LIVELINESS_DISCOVERY_ERRORS.find((e) =>
|
||||
typeof error === "string" ? e === error : e === error.message,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,11 +77,15 @@ export default class AutoDiscoveryUtils {
|
|||
},
|
||||
{
|
||||
a: (sub) => {
|
||||
return <a
|
||||
href="https://github.com/vector-im/element-web/blob/master/docs/config.md"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>{ sub }</a>;
|
||||
return (
|
||||
<a
|
||||
href="https://github.com/vector-im/element-web/blob/master/docs/config.md"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
{sub}
|
||||
</a>
|
||||
);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
@ -96,20 +102,20 @@ export default class AutoDiscoveryUtils {
|
|||
if (pageName === "register") {
|
||||
body = _t(
|
||||
"You can register, but some features will be unavailable until the identity server is " +
|
||||
"back online. If you keep seeing this warning, check your configuration or contact a server " +
|
||||
"admin.",
|
||||
"back online. If you keep seeing this warning, check your configuration or contact a server " +
|
||||
"admin.",
|
||||
);
|
||||
} else if (pageName === "reset_password") {
|
||||
body = _t(
|
||||
"You can reset your password, but some features will be unavailable until the identity " +
|
||||
"server is back online. If you keep seeing this warning, check your configuration or contact " +
|
||||
"a server admin.",
|
||||
"server is back online. If you keep seeing this warning, check your configuration or contact " +
|
||||
"a server admin.",
|
||||
);
|
||||
} else {
|
||||
body = _t(
|
||||
"You can log in, but some features will be unavailable until the identity server is " +
|
||||
"back online. If you keep seeing this warning, check your configuration or contact a server " +
|
||||
"admin.",
|
||||
"back online. If you keep seeing this warning, check your configuration or contact a server " +
|
||||
"admin.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -119,8 +125,8 @@ export default class AutoDiscoveryUtils {
|
|||
serverErrorIsFatal: isFatalError,
|
||||
serverDeadError: (
|
||||
<div>
|
||||
<strong>{ title }</strong>
|
||||
<div>{ body }</div>
|
||||
<strong>{title}</strong>
|
||||
<div>{body}</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
@ -150,7 +156,7 @@ export default class AutoDiscoveryUtils {
|
|||
};
|
||||
|
||||
if (identityUrl) {
|
||||
wellknownConfig['m.identity_server'] = {
|
||||
wellknownConfig["m.identity_server"] = {
|
||||
base_url: identityUrl,
|
||||
};
|
||||
}
|
||||
|
@ -183,7 +189,11 @@ export default class AutoDiscoveryUtils {
|
|||
* @returns {Promise<ValidatedServerConfig>} Resolves to the validated configuration.
|
||||
*/
|
||||
static buildValidatedConfigFromDiscovery(
|
||||
serverName: string, discoveryResult, syntaxOnly=false, isSynthetic=false): ValidatedServerConfig {
|
||||
serverName: string,
|
||||
discoveryResult,
|
||||
syntaxOnly = false,
|
||||
isSynthetic = false,
|
||||
): ValidatedServerConfig {
|
||||
if (!discoveryResult || !discoveryResult["m.homeserver"]) {
|
||||
// This shouldn't happen without major misconfiguration, so we'll log a bit of information
|
||||
// in the log so we can find this bit of codee but otherwise tell teh user "it broke".
|
||||
|
@ -191,8 +201,8 @@ export default class AutoDiscoveryUtils {
|
|||
throw newTranslatableError(_td("Unexpected error resolving homeserver configuration"));
|
||||
}
|
||||
|
||||
const hsResult = discoveryResult['m.homeserver'];
|
||||
const isResult = discoveryResult['m.identity_server'];
|
||||
const hsResult = discoveryResult["m.homeserver"];
|
||||
const isResult = discoveryResult["m.identity_server"];
|
||||
|
||||
const defaultConfig = SdkConfig.get("validated_server_config");
|
||||
|
||||
|
@ -203,7 +213,7 @@ export default class AutoDiscoveryUtils {
|
|||
// lack of identity server provided by the discovery method), we intentionally do not
|
||||
// validate it. This has already been validated and this helps some off-the-grid usage
|
||||
// of Element.
|
||||
let preferredIdentityUrl = defaultConfig && defaultConfig['isUrl'];
|
||||
let preferredIdentityUrl = defaultConfig && defaultConfig["isUrl"];
|
||||
if (isResult && isResult.state === AutoDiscovery.SUCCESS) {
|
||||
preferredIdentityUrl = isResult["base_url"];
|
||||
} else if (isResult && isResult.state !== AutoDiscovery.PROMPT) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue