construct serverd based on event url and client url

This commit is contained in:
Simon Knott 2024-11-11 15:22:01 +01:00
parent fd3ab5bfd4
commit 0b4256ea4a
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -93,6 +93,14 @@ async function doFetch(event: FetchEvent): Promise<Response> {
return new Response(null, { status: 200 }); return new Response(null, { status: 200 });
} }
let traceViewerServerBaseUrl = self.registration.scope;
if (client?.url) {
const clientUrl = new URL(client.url);
if (clientUrl.searchParams.has('server'))
traceViewerServerBaseUrl = clientUrl.searchParams.get('server')!;
}
const traceViewerServer = new TraceViewerServerBackend(traceViewerServerBaseUrl);
const traceUrl = url.searchParams.get('trace'); const traceUrl = url.searchParams.get('trace');
if (relativePath === '/contexts') { if (relativePath === '/contexts') {