From 99f6ed0cd73f59be6abd10a4b64983860990df77 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 20 Jul 2021 23:14:30 +0200 Subject: [PATCH] up2k-cli: avoid loading sha.js multiple times --- copyparty/web/up2k.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 767b72a5..84bda25c 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -496,8 +496,9 @@ function up2k_init(subtle) { shame = 'your browser is impressively ancient'; // upload ui hidden by default, clicking the header shows it + var got_deps = false; function init_deps() { - if (!subtle && !window.asmCrypto) { + if (!got_deps && !subtle && !window.asmCrypto) { var fn = 'sha512.' + sha_js + '.js'; showmodal('

loading ' + fn + '

since ' + shame + '

thanks chrome

'); import_js('/.cpr/deps/' + fn, unmodal); @@ -508,6 +509,7 @@ function up2k_init(subtle) { ebi('u2foot').innerHTML = 'seems like ' + shame + ' so do that if you want more performance (expecting 20' : '8a5">(but dont worry too much, expect 100') + ' MiB/s)'; } + got_deps = true; } // show uploader if the user only has write-access