|
|
@ -15,8 +15,8 @@ export const isValidBaseUrl = baseUrl => /^(http|https):\/\/[a-zA-Z0-9\-.]+(:\d{
|
|
|
|
export const getWellKnownUrl = async domain => {
|
|
|
|
export const getWellKnownUrl = async domain => {
|
|
|
|
const wellKnownUrl = `https://${domain}/.well-known/matrix/client`;
|
|
|
|
const wellKnownUrl = `https://${domain}/.well-known/matrix/client`;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const json = await fetchUtils.fetchJson(wellKnownUrl, { method: "GET" });
|
|
|
|
const response = await fetchUtils.fetchJson(wellKnownUrl, { method: "GET" });
|
|
|
|
return json["m.homeserver"].base_url;
|
|
|
|
return response.json["m.homeserver"].base_url;
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
// if there is no .well-known entry, return the domain itself
|
|
|
|
// if there is no .well-known entry, return the domain itself
|
|
|
|
return `https://${domain}`;
|
|
|
|
return `https://${domain}`;
|
|
|
|