make it work again

This commit is contained in:
David Baker 2019-08-13 12:59:34 +01:00
parent e5f913bc11
commit 02504b9959
2 changed files with 9 additions and 9 deletions

View file

@ -58,11 +58,11 @@ function unabbreviateUrl(u) {
/** /**
* Check an IS URL is valid, including liveness check * Check an IS URL is valid, including liveness check
* *
* @param {string} isUrl The url to check * @param {string} u The url to check
* @returns {string} null if url passes all checks, otherwise i18ned error string * @returns {string} null if url passes all checks, otherwise i18ned error string
*/ */
async function checkIdentityServerUrl(url) { async function checkIdentityServerUrl(u) {
const parsedUrl = url.parse(isUrl); const parsedUrl = url.parse(u);
if (parsedUrl.protocol !== 'https:') return _t("Identity Server URL must be HTTPS"); if (parsedUrl.protocol !== 'https:') return _t("Identity Server URL must be HTTPS");
@ -73,7 +73,7 @@ async function checkIdentityServerUrl(url) {
// also XXX: we don't really know whether to hit /v1 or /v2 for this: we // also XXX: we don't really know whether to hit /v1 or /v2 for this: we
// probably want a /versions endpoint like the C/S API. // probably want a /versions endpoint like the C/S API.
// https://github.com/matrix-org/matrix-doc/issues/1665 // https://github.com/matrix-org/matrix-doc/issues/1665
{ method: "GET", url: isUrl + '/_matrix/identity/api/v1' }, { method: "GET", url: u + '/_matrix/identity/api/v1' },
(err, response, body) => { (err, response, body) => {
if (err) { if (err) {
resolve(_t("Could not connect to Identity Server")); resolve(_t("Could not connect to Identity Server"));
@ -133,7 +133,7 @@ export default class SetIdServer extends React.Component {
const fullUrl = unabbreviateUrl(this.state.idServer); const fullUrl = unabbreviateUrl(this.state.idServer);
const errStr = await checkIsUrl(fullUrl); const errStr = await checkIdentityServerUrl(fullUrl);
let newFormValue = this.state.idServer; let newFormValue = this.state.idServer;
if (!errStr) { if (!errStr) {

View file

@ -540,13 +540,13 @@
"Display Name": "Display Name", "Display Name": "Display Name",
"Save": "Save", "Save": "Save",
"Identity Server URL must be HTTPS": "Identity Server URL must be HTTPS", "Identity Server URL must be HTTPS": "Identity Server URL must be HTTPS",
"Could not connect to ID Server": "Could not connect to ID Server", "Could not connect to Identity Server": "Could not connect to Identity Server",
"Not a valid ID Server (status code %(code)s)": "Not a valid ID Server (status code %(code)s)", "Not a valid Identity Server (status code %(code)s)": "Not a valid Identity Server (status code %(code)s)",
"Checking Server": "Checking Server", "Checking server": "Checking server",
"Identity Server (%(server)s)": "Identity Server (%(server)s)", "Identity Server (%(server)s)": "Identity Server (%(server)s)",
"You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.": "You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.", "You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.": "You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.",
"Identity Server": "Identity Server", "Identity Server": "Identity Server",
"You are not currently using an Identity Server. To discover and be discoverable by existing contacts you know, add one below": "You are not currently using an Identity Server. To discover and be discoverable by existing contacts you know, add one below", "You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.": "You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.",
"Change": "Change", "Change": "Change",
"Flair": "Flair", "Flair": "Flair",
"Failed to change password. Is your password correct?": "Failed to change password. Is your password correct?", "Failed to change password. Is your password correct?": "Failed to change password. Is your password correct?",