Update service worker cache version

This commit is contained in:
alam00000
2026-10-19 01:07:55 +05:30
parent 0584def180
commit 4c314b8a13
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -5,7 +5,7 @@
* Version: 1.1.0
*/
const CACHE_VERSION = 'bentopdf-v11';
const CACHE_VERSION = 'bentopdf-v12';
const CACHE_NAME = `${CACHE_VERSION}-static`;
const trustedCdnOrigins = new Set(['https://cdn.jsdelivr.net']);
@@ -208,9 +208,10 @@ async function findCachedFile(fileName, requestUrl) {
const requests = await cache.keys();
for (const req of requests) {
const reqUrl = new URL(req.url);
const trustedOrigin =
reqUrl.origin === location.origin || trustedCdnOrigins.has(reqUrl.origin);
if (trustedOrigin && reqUrl.pathname.split('/').pop() === fileName) {
if (
reqUrl.origin === location.origin &&
reqUrl.pathname.split('/').pop() === fileName
) {
const response = await cache.match(req);
if (response) {
const clone = response.clone();
+1 -1
View File
@@ -196,7 +196,7 @@ const engineReady = new Promise((resolve) => {
}
: () => {};
trace('wired');
const demo = params.get('demo');
const demo = import.meta.env?.DEV ? params.get('demo') : null;
if (demo) {
try {
trace('fetching ' + demo);