From 4c314b8a13cfb05b56c9b0a816fe619dad9b38fc Mon Sep 17 00:00:00 2001 From: alam00000 Date: Mon, 19 Oct 2026 01:07:55 +0530 Subject: [PATCH] Update service worker cache version --- public/sw.js | 9 +++++---- src/js/editcore/app.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/public/sw.js b/public/sw.js index 6de13a8d..a9b0e92e 100644 --- a/public/sw.js +++ b/public/sw.js @@ -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(); diff --git a/src/js/editcore/app.js b/src/js/editcore/app.js index e1d32d2c..a15f59a8 100644 --- a/src/js/editcore/app.js +++ b/src/js/editcore/app.js @@ -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);