From d7d625be2a7fb1d2cf079b1a674dc98a19c88668 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 7 Jul 2021 10:45:47 +0200 Subject: [PATCH] v0.11.33 --- copyparty/__version__.py | 4 ++-- copyparty/web/up2k.js | 35 ++++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/copyparty/__version__.py b/copyparty/__version__.py index 12d13910..0a67e8b7 100644 --- a/copyparty/__version__.py +++ b/copyparty/__version__.py @@ -1,8 +1,8 @@ # coding: utf-8 -VERSION = (0, 11, 32) +VERSION = (0, 11, 33) CODENAME = "the grid" -BUILD_DT = (2021, 7, 6) +BUILD_DT = (2021, 7, 7) S_VERSION = ".".join(map(str, VERSION)) S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 84432899..22b17645 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -413,6 +413,10 @@ function U2pvis(act, btns) { } } } + + if (this.head < 0) + this.head = 0; + if (card == "bz") { for (var a = this.head - 1; a >= this.head - this.wsz && a >= 0; a--) { html.unshift(this.genrow(a, true).replace(/>/, ">a ")); @@ -864,20 +868,27 @@ function up2k_init(subtle) { if (!st.todo.handshake.length) return true; - var cd = st.todo.handshake[0].cooldown; + var t = st.todo.handshake[0], + cd = t.cooldown; + if (cd && cd - Date.now() > 0) return false; // keepalive or verify - if (st.todo.handshake[0].keepalive || - st.todo.handshake[0].t_uploaded) + if (t.keepalive || + t.t_uploaded) return true; if (parallel_uploads < st.busy.handshake.length) return false; - if ((multitask ? parallel_uploads : 0) < + if (st.busy.handshake.length) + for (var n = t.n - 1; n >= t.n - parallel_uploads && n >= 0; n--) + if (st.files[n].t_uploading) + return false; + + if ((multitask ? 1 : 0) < st.todo.upload.length + st.busy.upload.length) return false; @@ -1629,15 +1640,20 @@ function up2k_init(subtle) { } function draw_turbo() { - var msg = '

WARNING: turbo enabled,  client may not detect and resume incomplete uploads; see turbo-button tooltip

', - html = ebi('u2foot').innerHTML; + var msgu = '

WARNING: turbo enabled,  client may not detect and resume incomplete uploads; see turbo-button tooltip

', + msgs = '

WARNING: turbo enabled,  search may give false-positives; see turbo-button tooltip

', + msg = fsearch ? msgs : msgu, + omsg = fsearch ? msgu : msgs, + html = ebi('u2foot').innerHTML, + ohtml = html; if (turbo && html.indexOf(msg) === -1) - html += msg; + html = html.replace(omsg, '') + msg; else if (!turbo) - html = html.replace(msg, ''); + html = html.replace(msgu, '').replace(msgs, ''); - ebi('u2foot').innerHTML = html; + if (html !== ohtml) + ebi('u2foot').innerHTML = html; } draw_turbo(); @@ -1678,6 +1694,7 @@ function up2k_init(subtle) { } catch (ex) { } + draw_turbo(); onresize(); }