From e1d654472edbee6f6b12436a6f762b325b59848e Mon Sep 17 00:00:00 2001 From: velzie Date: Sat, 12 Oct 2024 15:03:37 -0400 Subject: [PATCH] nuke getlocalstorage thing --- src/worker/index.ts | 47 --------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/src/worker/index.ts b/src/worker/index.ts index 3ec0e0a..b60476b 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -55,53 +55,6 @@ export class ScramjetServiceWorker extends EventTarget { } } - async getLocalStorage(): Promise> { - let clients = await self.clients.matchAll(); - clients = clients.filter( - (client) => - client.type === "window" && - !new URL(client.url).pathname.startsWith(this.config.prefix) - ); - - if (clients.length === 0) throw new Error("No clients found"); - - const token = this.synctoken++; - for (const client of clients) { - client.postMessage({ - scramjet$type: "getLocalStorage", - scramjet$token: token, - }); - } - - return new Promise((resolve) => { - this.syncPool[token] = resolve; - }); - } - - async setLocalStorage(data: Record): Promise { - let clients = await self.clients.matchAll(); - clients = clients.filter( - (client) => - client.type === "window" && - !new URL(client.url).pathname.startsWith(this.config.prefix) - ); - - if (clients.length === 0) throw new Error("No clients found"); - - const token = this.synctoken++; - for (const client of clients) { - client.postMessage({ - scramjet$type: "setLocalStorage", - scramjet$token: token, - data, - }); - } - - return new Promise((resolve) => { - this.syncPool[token] = resolve; - }); - } - route({ request }: FetchEvent) { if (request.url.startsWith(location.origin + this.config.prefix)) return true;