From 2978f4a8d6aea0d65ad1d9a7e2751d08aa037355 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sat, 8 Feb 2025 11:30:51 +0100 Subject: [PATCH] Service worker tweaks in federated URL handling --- web/service_worker.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/web/service_worker.ts b/web/service_worker.ts index 39012e9f..c5c6ec34 100644 --- a/web/service_worker.ts +++ b/web/service_worker.ts @@ -104,7 +104,8 @@ self.addEventListener("fetch", (event: any) => { if ( pathname === "/.auth" || pathname === "/.logout" || - pathname === "/index.json" + pathname === "/index.json" || + pathname.startsWith("!") ) { return fetch(request); } else if (looksLikePathWithExtension(pathname)) { @@ -144,19 +145,8 @@ async function handleLocalFileRequest( }, ); } else if (path.startsWith("!")) { - // Federated URL handling - let url = path.slice(1); - if (url.startsWith("localhost")) { - url = `http://${url}`; - } else { - url = `https://${url}`; - } - console.info("Proxying federated URL", path, "to", url); - return fetch(url, { - method: request.method, - headers: request.headers, - body: request.body, - }); + console.log("Passing on federated URL", path); + return fetch(request); } else { console.error( "Did not find file in locally synced space",