>:(
This commit is contained in:
parent
6c779d54f2
commit
4bde55ad64
1 changed files with 2 additions and 3 deletions
|
@ -1,18 +1,17 @@
|
|||
// Cannot use Set-Cookie header for security reasons, use IndexedDB instead
|
||||
|
||||
self.addEventListener("fetch", event =>{
|
||||
|
||||
const url = new URL(event.request.url);
|
||||
if(url.pathname.endsWith(".css")) return;
|
||||
//TODO: make an endpoint to set the localStorage up then set the form to go to there and have it HTTP 302 or 307 with handle_html for html responses and handle_redirect for the other case
|
||||
event.respondWith((async ()=>{
|
||||
const resp = await fetch(event.request);
|
||||
const resp2 = resp.clone();
|
||||
const resp3 = resp2.clone();
|
||||
const body = await resp2.text();
|
||||
const url = new URL(event.request.url);
|
||||
if(url.pathname.endsWith("light-dark-toggle")){
|
||||
return await handle_redirect(event.request);
|
||||
}
|
||||
else if(url.hostname !== "pagwin.xyz") return;
|
||||
else {
|
||||
return await handle_html(event.request, resp3, body);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue