feat: UserState

This commit is contained in:
2024-04-22 14:38:14 +01:00
parent 5a7657a95d
commit 80a4b5d8e6
103 changed files with 4179 additions and 1165 deletions

View File

@ -1,10 +1,6 @@
/// <reference lib="webworker" />
import { CacheableResponsePlugin } from "workbox-cacheable-response";
declare const self: ServiceWorkerGlobalScope & {
__WB_MANIFEST: (string | PrecacheEntry)[];
};
import { encodeTLVEntries, NostrLink, NostrPrefix, TLVEntryType, tryParseNostrLink } from "@snort/system";
import { clientsClaim } from "workbox-core";
import { ExpirationPlugin } from "workbox-expiration";
@ -15,12 +11,16 @@ import { CacheFirst, StaleWhileRevalidate } from "workbox-strategies";
import { defaultAvatar, hexToBech32 } from "@/Utils";
import { formatShort } from "@/Utils/Number";
declare const self: ServiceWorkerGlobalScope & {
__WB_MANIFEST: (string | PrecacheEntry)[];
};
precacheAndRoute(self.__WB_MANIFEST);
clientsClaim();
// cache everything in current domain /assets because precache doesn't seem to include everything
registerRoute(
({ url }) => url.origin === location.origin && url.pathname.startsWith("/assets"),
({ url }) => url.origin === window.location.origin && url.pathname.startsWith("/assets"),
new StaleWhileRevalidate({
cacheName: "assets-cache",
plugins: [