From e6ba065bc2f6b7f4d09dd20f810ab9ca4670c57d Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 6 Apr 2024 00:27:06 +0000 Subject: [PATCH] improve cachebusters --- copyparty/web/browser.js | 4 ++-- copyparty/web/up2k.js | 4 ++-- copyparty/web/util.js | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index b42bf2e5..72a3e9bc 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -4238,7 +4238,7 @@ var showfile = (function () { qsr('#prism_css'); var el = mknod('link', 'prism_css'); el.rel = 'stylesheet'; - el.href = SR + '/.cpr/deps/prism' + (light ? '' : 'd') + '.css'; + el.href = SR + '/.cpr/deps/prism' + (light ? '' : 'd') + '.css?_=' + TS; document.head.appendChild(el); }; @@ -4861,7 +4861,7 @@ var thegrid = (function () { } ihref = SR + '/.cpr/ico/' + ext; } - ihref = addq(ihref, 'cache=i&_=' + ACB); + ihref = addq(ihref, 'cache=i&_=' + ACB + TS); if (CHROME) ihref += "&raster"; diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 47eb7238..41a682df 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -780,7 +780,7 @@ function up2k_init(subtle) { setTimeout(function () { if (WebAssembly && !hws.length) - fetch(SR + '/.cpr/w.hash.js' + CB); + fetch(SR + '/.cpr/w.hash.js?_=' + TS); }, 1000); function showmodal(msg) { @@ -1349,7 +1349,7 @@ function up2k_init(subtle) { if (WebAssembly && !hws.length) { for (var a = 0; a < Math.min(navigator.hardwareConcurrency || 4, 16); a++) - hws.push(new Worker(SR + '/.cpr/w.hash.js' + CB)); + hws.push(new Worker(SR + '/.cpr/w.hash.js?_=' + TS)); console.log(hws.length + " hashers"); } diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 5f15fec0..4c837877 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -16,7 +16,6 @@ var wah = '', NOAC = 'autocorrect="off" autocapitalize="off"', L, tt, treectl, thegrid, up2k, asmCrypto, hashwasm, vbar, marked, T0 = Date.now(), - CB = '?_=' + Math.floor(T0 / 1000).toString(36), R = SR.slice(1), RS = R ? "/" + R : "", HALFMAX = 8192 * 8192 * 8192 * 8192, @@ -52,8 +51,6 @@ catch (ex) { } try { - CB = '?' + document.currentScript.src.split('?').pop(); - if (navigator.userAgentData.mobile) MOBILE = true;