mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-05 20:02:47 +01:00
Update service worker cache version
This commit is contained in:
+5
-4
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user