diff --git a/src/client/element.ts b/src/client/element.ts index 536b904..50d1e35 100644 --- a/src/client/element.ts +++ b/src/client/element.ts @@ -151,7 +151,6 @@ for (const target of [Node.prototype, document]) { }, }); } - } catch (e) { } + } catch (e) {} } } - diff --git a/src/client/storage.ts b/src/client/storage.ts index 9b49dbc..09d62cc 100644 --- a/src/client/storage.ts +++ b/src/client/storage.ts @@ -8,7 +8,7 @@ const store = new IDBMapSync(locationProxy.host, { await store.sync(); -const localStorageProxy = new Proxy(window.localStorage, { +const localStorageProxy = new Proxy(window.localStorage, { get(target, prop) { switch (prop) { case "getItem": @@ -68,17 +68,17 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, { case "getItem": return (key: string) => { return target.getItem(locationProxy.host + "@" + key); - } + }; case "setItem": return (key: string, value: string) => { target.setItem(locationProxy.host + "@" + key, value); - } + }; case "removeItem": return (key: string) => { target.removeItem(locationProxy.host + "@" + key); - } + }; case "clear": return () => { @@ -87,14 +87,16 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, { target.removeItem(key); } } - } + }; case "key": return (index: number) => { - const keys = Object.keys(target).filter((key) => key.startsWith(locationProxy.host)); + const keys = Object.keys(target).filter((key) => + key.startsWith(locationProxy.host) + ); return target.getItem(keys[index]); - } + }; case "length": return target.length; @@ -109,8 +111,11 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, { }, defineProperty(target, property, attributes) { - target.setItem(locationProxy.host + "@" + (property as string), attributes.value); - + target.setItem( + locationProxy.host + "@" + (property as string), + attributes.value + ); + return true; }, }); @@ -119,4 +124,4 @@ delete window.localStorage; delete window.sessionStorage; window.localStorage = localStorageProxy; -window.sessionStorage = sessionStorageProxy; \ No newline at end of file +window.sessionStorage = sessionStorageProxy; diff --git a/static/ui.js b/static/ui.js index 445e47b..a4e84ce 100644 --- a/static/ui.js +++ b/static/ui.js @@ -28,7 +28,11 @@ const col = css` const store = $store( { url: "https://google.com", - wispurl: (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/", + wispurl: + (location.protocol === "https:" ? "wss" : "ws") + + "://" + + location.host + + "/wisp/", bareurl: (location.protocol === "https:" ? "https" : "http") + "://" +