Fix well-known lookup for sliding sync labs check (#12519)

* Fix well-known lookup for sliding sync labs check

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2024-05-14 12:40:10 +00:00
committed by GitHub
parent d0b30d1631
commit f0281886d7
2 changed files with 30 additions and 8 deletions
+3 -3
View File
@@ -359,10 +359,10 @@ export class SlidingSyncManager {
let proxyUrl: string | undefined;
try {
const clientWellKnown = await AutoDiscovery.findClientConfig(client.baseUrl);
const clientWellKnown = await AutoDiscovery.findClientConfig(client.getDomain()!);
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
} catch (e) {
// client.baseUrl is invalid, `AutoDiscovery.findClientConfig` has thrown
// client.getDomain() is invalid, `AutoDiscovery.findClientConfig` has thrown
}
if (proxyUrl != undefined) {
@@ -401,7 +401,7 @@ export class SlidingSyncManager {
const proxyUrl = await this.getProxyFromWellKnown(client);
if (proxyUrl != undefined) {
const response = await fetch(proxyUrl + "/client/server.json", {
const response = await fetch(new URL("/client/server.json", proxyUrl), {
method: Method.Get,
signal: timeoutSignal(10 * 1000), // 10s
});