From bebc49595d9d3dc70f649ddcb0fc99bfccbda764 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 29 Jun 2019 20:19:32 +0000 Subject: [PATCH] firefox-android-nightly is also busted --- README.md | 5 ++++- copyparty/web/up2k.js | 19 ++++++++++++------- copyparty/web/upload.css | 3 +++ scripts/deps-docker/Dockerfile | 3 +-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bc55b17b..d537feba 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,14 @@ in the `scripts` folder: * upload to pypi with `make-pypi-release.(sh|bat)` -# immediate todo +# todo roughly sorted by priority * look into android thumbnail cache file format * support pillow-simd +* cache sha512 chunks on client +* symlink existing files on upload + * enforce chunksize and sha512('\n'.join(chunks)) * figure out the deal with pixel3a not being connectable as hotspot * pixel3a having unpredictable 3sec latency in general :|||| diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 6178c79f..d4a2700d 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -64,8 +64,8 @@ function o(id) { crypto.subtle.digest( 'SHA-512', new Uint8Array(1) ).then( - function(x) {up2k_init(true)}, - function(x) {up2k_init(false)} + function (x) { up2k_init(true) }, + function (x) { up2k_init(false) } ); } catch (ex) { @@ -75,6 +75,8 @@ function o(id) { function up2k_init(have_crypto) { + //have_crypto = false; + // show modal message function showmodal(msg) { o('u2notbtn').innerHTML = msg; @@ -234,12 +236,14 @@ function up2k_init(have_crypto) { fobj = fobj.getAsFile(); } try { - fobj.size; + if (fobj.size < 1) + throw 1; } catch (ex) { return alert( - 'Due to a browser bug, Firefox-Android can only do one file at a time:\n' + - 'https://bugzilla.mozilla.org/show_bug.cgi?id=1456557'); + 'Due to a browser bug, Firefox-Android can only select one file at a time. ' + + 'This works in "Firefox Preview" (new Firefox, currently in beta).\n\n' + + 'Google firefox bug 1456557 for more info'); } var entry = { "n": parseInt(st.files.length.toString()), @@ -425,7 +429,7 @@ function up2k_init(have_crypto) { }; var hash_done = function (hashbuf) { - t.hash.push(buf2b64(hashbuf).substr(0, 44)); + t.hash.push(buf2b64(hashbuf).substr(0, 43)); prog(t.n, nchunk, col_hashed); if (++nchunk < nchunks) { @@ -456,7 +460,8 @@ function up2k_init(have_crypto) { // TODO remove var ts = new Date().getTime(); - alert((ts - t.t0) + '\n' + t.hash.join('\n')); + var spd = (t.size / ((ts - t.t0) / 1000.)) / (1024 * 1024.); + alert('{0} ms, {1} MB/s\n'.format(ts - t.t0, spd.toFixed(3)) + t.hash.join('\n')); var xhr = new XMLHttpRequest(); xhr.onload = function (ev) { diff --git a/copyparty/web/upload.css b/copyparty/web/upload.css index d64491e2..bfd56b1c 100644 --- a/copyparty/web/upload.css +++ b/copyparty/web/upload.css @@ -66,6 +66,9 @@ background: #333; padding-top: 1em; } +#u2notbtn * { + line-height: 1.3em; +} #u2tab { margin: 3em auto; width: calc(100% - 2em); diff --git a/scripts/deps-docker/Dockerfile b/scripts/deps-docker/Dockerfile index a2ae3def..ea7c7c56 100644 --- a/scripts/deps-docker/Dockerfile +++ b/scripts/deps-docker/Dockerfile @@ -17,8 +17,7 @@ RUN apk add make g++ git bash npm patch wget tar pigz gzip unzip \ RUN cd asmcrypto.js-$ver_asmcrypto \ && echo "export { Sha512 } from './hash/sha512/sha512';" > src/entry-export_all.ts \ && node -r esm build.js \ - && mv asmcrypto.all.es5.js /z/dist/sha512.js \ - && mv dist_es5/hash/sha512/sha512.asm.js /z/dist/ + && mv asmcrypto.all.es5.js /z/dist/sha512.js # build ogvjs RUN cd ogvjs-$ver_ogvjs \