Skip to content

Commit

Permalink
Add debugging for service worker version check
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Jul 16, 2024
1 parent a10d2b1 commit 764654f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/serviceworker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 764654f

Please sign in to comment.