diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-08-01 22:52:36 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-08-01 22:52:36 +0300 |
| commit | 37a54996a38432bc3f78a7cdf4e91d1001233383 (patch) | |
| tree | 9798fcada74ed0878bce580f49e57d6ae2f4895f /src | |
| parent | cad0e7518a64e60fe1c2e376e7d4e38f0d6cd89a (diff) | |
| download | the-epube-37a54996a38432bc3f78a7cdf4e91d1001233383.tar.gz the-epube-37a54996a38432bc3f78a7cdf4e91d1001233383.tar.xz | |
rely on event.request.mode instead of hardcoding specific page urls when substituting offline fallbacks
Diffstat (limited to 'src')
| -rw-r--r-- | src/worker.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/worker.ts b/src/worker.ts index 0a9f1ec..1082379 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -124,7 +124,9 @@ sw.addEventListener('fetch', (event) => { return; } // index & read UI: online first; if offline, map index pages to offline.html & map all read.html?* to offline read.html - if (url.pathname == "/" || url.pathname.match("index.html|offline.html|read.html")) { + // note that instead of hardcoding specific URLs, we handle all user-initiated explicit page navigation requests, + // everything else falls back to the next block with cache-first-online-fallback logic + if (event.request.mode === 'navigate') { (event as any).respondWith((async () => { try { const networkResp = await fetchWithTimeout((event as any).request); |
