diff --git a/src/client/api.ts b/src/client/api.ts index 5612007..5cd1963 100644 --- a/src/client/api.ts +++ b/src/client/api.ts @@ -47,8 +47,15 @@ async function expectOk(res: Response, fallback: string): Promise { /** * Fetches the client-side app configuration from the worker. * GET /api/config + * + * If the worker injected the config via a `; + const html = await response.text(); + const injected = html.replace("", `${configScript}`); + return new Response(injected, { + status: response.status, + statusText: response.statusText, + headers: response.headers + }); +} + function discoveryRoute(request: Request, url: URL): Response | null { if (request.method !== "GET" && request.method !== "HEAD") { return null;