Allow well-known to fail, it is optional after all
This commit is contained in:
parent
2acec4f124
commit
5c2f2b0684
1 changed files with 11 additions and 7 deletions
|
@ -24,13 +24,17 @@ export async function resolveServer(request, baseURL) {
|
||||||
baseURL = `https://${baseURL}`;
|
baseURL = `https://${baseURL}`;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const {status, body} = await request(`${baseURL}/.well-known/matrix/client`, {method: "GET"}).response();
|
try {
|
||||||
if (status === 200) {
|
const {status, body} = await request(`${baseURL}/.well-known/matrix/client`, {method: "GET"}).response();
|
||||||
const proposedBaseURL = body?.['m.homeserver']?.base_url;
|
if (status === 200) {
|
||||||
if (typeof proposedBaseURL === "string") {
|
const proposedBaseURL = body?.['m.homeserver']?.base_url;
|
||||||
baseURL = noTrailingSlash(proposedBaseURL);
|
if (typeof proposedBaseURL === "string") {
|
||||||
}
|
baseURL = noTrailingSlash(proposedBaseURL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Failed to fetch ${baseURL}/.well-known/matrix/client", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const {status} = await request(`${baseURL}/_matrix/client/versions`, {method: "GET"}).response();
|
const {status} = await request(`${baseURL}/_matrix/client/versions`, {method: "GET"}).response();
|
||||||
|
|
Loading…
Reference in a new issue