issue with notch
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user