From 764654fffbd8b5875c1622a5c2e22e351deeebe8 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 16 Jul 2024 13:50:44 -0600 Subject: [PATCH 1/2] Add debugging for service worker version check --- src/serviceworker/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/serviceworker/index.ts b/src/serviceworker/index.ts index f11ff8019c..790855e182 100644 --- a/src/serviceworker/index.ts +++ b/src/serviceworker/index.ts @@ -102,11 +102,13 @@ async function tryUpdateServerSupportMap(clientApiUrl: string, accessToken?: str const config = fetchConfigForToken(accessToken); const versions = await (await fetch(`${clientApiUrl}/_matrix/client/versions`, config)).json(); + console.log(`[ServiceWorker] /versions response for '${clientApiUrl}': ${JSON.stringify(versions)}`); serverSupportMap[clientApiUrl] = { supportsAuthedMedia: Boolean(versions?.versions?.includes("v1.11")), cacheExpiryTimeMs: new Date().getTime() + 2 * 60 * 60 * 1000, // 2 hours from now }; + console.log(`[ServiceWorker] serverSupportMap update for '${clientApiUrl}': ${JSON.stringify(serverSupportMap[clientApiUrl])}`); } // Ideally we'd use the `Client` interface for `client`, but since it's not available (see 'fetch' listener), we use From 5eebd54baf16139bb50bb72b41713ec130bf1eda Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 16 Jul 2024 13:54:02 -0600 Subject: [PATCH 2/2] Appease the linter --- src/serviceworker/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/serviceworker/index.ts b/src/serviceworker/index.ts index 790855e182..736b536613 100644 --- a/src/serviceworker/index.ts +++ b/src/serviceworker/index.ts @@ -108,7 +108,9 @@ async function tryUpdateServerSupportMap(clientApiUrl: string, accessToken?: str supportsAuthedMedia: Boolean(versions?.versions?.includes("v1.11")), cacheExpiryTimeMs: new Date().getTime() + 2 * 60 * 60 * 1000, // 2 hours from now }; - console.log(`[ServiceWorker] serverSupportMap update for '${clientApiUrl}': ${JSON.stringify(serverSupportMap[clientApiUrl])}`); + console.log( + `[ServiceWorker] serverSupportMap update for '${clientApiUrl}': ${JSON.stringify(serverSupportMap[clientApiUrl])}`, + ); } // Ideally we'd use the `Client` interface for `client`, but since it's not available (see 'fetch' listener), we use