From f9c159a0515b137518912a815b2faa4fa315f992 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 28 Apr 2022 21:57:37 +0200 Subject: [PATCH] add option to force up2k turbo + hide warning --- copyparty/__main__.py | 1 + copyparty/httpcli.py | 1 + copyparty/web/browser.html | 1 + copyparty/web/up2k.js | 11 +++++++---- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 61765f49..c147affd 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -430,6 +430,7 @@ def run_argparse(argv, formatter): ap2.add_argument("--never-symlink", action="store_true", help="do not fallback to symlinks when a hardlink cannot be made") ap2.add_argument("--no-dedup", action="store_true", help="disable symlink/hardlink creation; copy file contents instead") ap2.add_argument("--reg-cap", metavar="N", type=int, default=9000, help="max number of uploads to keep in memory when running without -e2d") + ap2.add_argument("--turbo", metavar="LVL", type=int, default=0, help="configure turbo-mode in up2k client; 0 = off and warn if enabled, 1 = off, 2 = on, 3 = on and disable datecheck") ap2 = ap.add_argument_group('network options') ap2.add_argument("-i", metavar="IP", type=u, default="0.0.0.0", help="ip to bind (comma-sep.)") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 6a4600c4..683a5820 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -2448,6 +2448,7 @@ class HttpCli(object): j2a["logues"] = logues j2a["taglist"] = taglist j2a["txt_ext"] = self.args.textfiles.replace(",", " ") + j2a["turbolvl"] = self.args.turbo if "mth" in vn.flags: j2a["def_hcols"] = vn.flags["mth"].split(",") diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 11155c29..1a385aa1 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -146,6 +146,7 @@ have_del = {{ have_del|tojson }}, have_unpost = {{ have_unpost|tojson }}, have_zip = {{ have_zip|tojson }}, + turbolvl = {{ turbolvl|tojson }}, txt_ext = "{{ txt_ext }}", {% if no_prism %}no_prism = 1,{% endif %} readme = {{ readme|tojson }}, diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 31b19462..185422a5 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -667,8 +667,8 @@ function up2k_init(subtle) { bcfg_bind(uc, 'ask_up', 'ask_up', true, null, false); bcfg_bind(uc, 'flag_en', 'flag_en', false, apply_flag_cfg); bcfg_bind(uc, 'fsearch', 'fsearch', false, set_fsearch, false); - bcfg_bind(uc, 'turbo', 'u2turbo', false, draw_turbo, false); - bcfg_bind(uc, 'datechk', 'u2tdate', true, null, false); + bcfg_bind(uc, 'turbo', 'u2turbo', turbolvl > 1, draw_turbo, false); + bcfg_bind(uc, 'datechk', 'u2tdate', turbolvl < 3, null, false); var st = { "files": [], @@ -2024,9 +2024,12 @@ function up2k_init(subtle) { html = ebi('u2foot').innerHTML, ohtml = html; - if (uc.turbo && html.indexOf(msg) === -1) + if (turbolvl || !uc.turbo) + msg = null; + + if (msg && html.indexOf(msg) === -1) html = html.replace(omsg, '') + msg; - else if (!uc.turbo) + else if (!msg) html = html.replace(msgu, '').replace(msgs, ''); if (html !== ohtml)