issue with notch
Some checks failed
ci / site (push) Has been cancelled
publish-image / publish (push) Has been cancelled

This commit is contained in:
2026-02-10 20:57:28 -05:00
parent f50a828535
commit 26a8c97841
12 changed files with 756 additions and 6 deletions

View File

@@ -4,14 +4,26 @@
- Images: cache-first with bounded eviction
*/
// Bump this value on deploy to invalidate caches.
const CACHE_VERSION = "v4";
const cacheVersionFromUrl = (() => {
try {
const v = new URL(self.location.href).searchParams.get("v");
if (!v) return null;
if (!/^[a-zA-Z0-9._-]{1,64}$/.test(v)) return null;
return v;
} catch {
return null;
}
})();
const CACHE_VERSION = cacheVersionFromUrl ? `v-${cacheVersionFromUrl}` : "v4";
const CACHE_SHELL = `shell-${CACHE_VERSION}`;
const CACHE_PAGES = `pages-${CACHE_VERSION}`;
const CACHE_MEDIA = `media-${CACHE_VERSION}`;
const SHELL_ASSETS = ["/", "/styles/global.css", "/favicon.png", "/robots.txt"];
const assetSuffix = cacheVersionFromUrl ? `?v=${encodeURIComponent(cacheVersionFromUrl)}` : "";
const SHELL_ASSETS = ["/", `/styles/global.css${assetSuffix}`, "/favicon.png", "/robots.txt"];
// Cache.addAll() throws if there are any duplicate requests.
const SHELL_ASSETS_UNIQUE = Array.from(new Set(SHELL_ASSETS));