Skip to content

Commit

Permalink
remove root bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
maxence-charriere committed Oct 2, 2024
1 parent dfe1f2b commit 2b4f798
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
13 changes: 1 addition & 12 deletions pkg/app/gen/app-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,9 @@ self.addEventListener("fetch", (event) => {
});

async function fetchWithCache(request) {
const url = new URL(request.url);
if (url.pathname === "/") {
try {
return await fetch(request);
} catch (error) {
console.error("network failed, trying to serve from cache:", error);
const cachedResponse = await caches.match(request);
return cachedResponse || new Response("Offline");
}
}

const cachedResponse = await caches.match(request);
if (cachedResponse) {
return cachedResponse;
return cachedResponse;
}
return await fetch(request);
}
Expand Down
Loading

0 comments on commit 2b4f798

Please sign in to comment.