diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index e385c037..52c02c7b 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -408,7 +408,7 @@ class HttpCli(object): self.out_headers.update(NO_CACHE) return - n = "604800" if cache == "i" else cache or "69" + n = "604869" if cache == "i" else cache or "69" self.out_headers["Cache-Control"] = "max-age=" + n def k304(self) -> bool: @@ -1714,7 +1714,7 @@ class HttpCli(object): # send reply if is_compressed: - self.out_headers["Cache-Control"] = "max-age=573" + self.out_headers["Cache-Control"] = "max-age=604869" else: self.permit_caching() diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index a9b619af..1887490d 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -719,12 +719,10 @@ function up2k_init(subtle) { "gotallfiles": [gotallfiles] // hooks }; - if (window.WebAssembly) { - for (var a = 0; a < Math.min(navigator.hardwareConcurrency || 4, 16); a++) - hws.push(new Worker('/.cpr/w.hash.js')); - - console.log(hws.length + " hashers ready"); - } + setTimeout(function () { + if (window.WebAssembly && !hws.length) + fetch('/.cpr/w.hash.js' + CB); + }, 1000); function showmodal(msg) { ebi('u2notbtn').innerHTML = msg; @@ -1188,6 +1186,13 @@ function up2k_init(subtle) { var evpath = get_evpath(), draw_each = good_files.length < 50; + if (window.WebAssembly && !hws.length) { + for (var a = 0; a < Math.min(navigator.hardwareConcurrency || 4, 16); a++) + hws.push(new Worker('/.cpr/w.hash.js' + CB)); + + console.log(hws.length + " hashers"); + } + if (!uc.az) good_files.sort(function (a, b) { a = a[0].size; diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 32242446..31401c1c 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -7,6 +7,7 @@ if (!window['console']) var wah = '', + CB = '?_=' + Date.now(), HALFMAX = 8192 * 8192 * 8192 * 8192, HTTPS = (window.location + '').indexOf('https:') === 0, TOUCH = 'ontouchstart' in window, @@ -15,8 +16,9 @@ var wah = '', IPHONE = TOUCH && /iPhone|iPad|iPod/i.test(navigator.userAgent), WINDOWS = navigator.platform ? navigator.platform == 'Win32' : /Windows/.test(navigator.userAgent); - try { + CB = '?' + document.currentScript.src.split('?').pop(); + if (navigator.userAgentData.mobile) MOBILE = true;