From 1a1d73104386106c34cac9b4a957cecd15f4634e Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 2 Dec 2024 22:52:39 +0000 Subject: [PATCH] misc cleanup: * u2c: remove superfluous pathsep (harmless) * tl: new strings --- bin/u2c.py | 8 +++++--- copyparty/up2k.py | 5 ++++- scripts/tl.js | 9 ++++++--- scripts/tl.py | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/bin/u2c.py b/bin/u2c.py index 2bdcf2f9..b55a832b 100755 --- a/bin/u2c.py +++ b/bin/u2c.py @@ -1132,7 +1132,9 @@ class Ctl(object): isdir = stat.S_ISDIR(inf.st_mode) if self.ar.z or self.ar.drd: rd = rel if isdir else os.path.dirname(rel) - srd = rd.decode("utf-8", "replace").replace("\\", "/") + srd = rd.decode("utf-8", "replace").replace("\\", "/").rstrip("/") + if srd: + srd += "/" if prd != rd: prd = rd ls = {} @@ -1167,11 +1169,11 @@ class Ctl(object): bnames = [x for x in ls if x not in lnodes and x != b".hist"] vpath = self.ar.url.split("://")[-1].split("/", 1)[-1] names = [x.decode("utf-8", WTF8) for x in bnames] - locs = [vpath + srd + "/" + x for x in names] + locs = [vpath + srd + x for x in names] while locs: req = locs while req: - print("DELETING ~%s/#%s" % (srd, len(req))) + print("DELETING ~%s#%s" % (srd, len(req))) body = json.dumps(req).encode("utf-8") sc, txt = web.req( "POST", self.ar.url + "?delete", {}, body, MJ diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 47174df1..e7bfd744 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -97,6 +97,9 @@ SBUSY = "cannot receive uploads right now;\nserver busy with %s.\nPlease wait; t HINT_HISTPATH = "you could try moving the database to another location (preferably an SSD or NVME drive) using either the --hist argument (global option for all volumes), or the hist volflag (just for this volume)" +NULLSTAT = os.stat_result((0, -1, -1, 0, 0, 0, 0, 0, 0, 0)) + + class Dbw(object): def __init__(self, c: "sqlite3.Cursor", n: int, nf: int, t: float) -> None: self.c = c @@ -2942,7 +2945,7 @@ class Up2k(object): raise Exception() except Exception as ex: if n4g: - st = os.stat_result((0, -1, -1, 0, 0, 0, 0, 0, 0, 0)) + st = NULLSTAT else: lost.append((cur, dp_dir, dp_fn)) continue diff --git a/scripts/tl.js b/scripts/tl.js index e88d71ff..1f02c58e 100644 --- a/scripts/tl.js +++ b/scripts/tl.js @@ -414,7 +414,7 @@ var tl_browser = { "fr_emore": "select at least one item to rename", "fd_emore": "select at least one item to delete", "fc_emore": "select at least one item to cut", - "fcp_emore": "select at least one item to copy", + "fcp_emore": "select at least one item to copy to clipboard", "fs_sc": "share the folder you're in", "fs_ss": "share the selected files", @@ -470,9 +470,11 @@ var tl_browser = { "fcc_ok": "copied {0} items to clipboard", "fcc_warn": 'copied {0} items to clipboard\n\nbut: only this browser-tab can paste them\n(since the selection is so absolutely massive)', + "fp_apply": "use these names", "fp_ecut": "first cut or copy some files / folders to paste / move\n\nnote: you can cut / paste across different browser tabs", - "fp_ename": "these {0} items cannot be moved here (names already exist):", - "fcp_ename": "these {0} items cannot be copied here (names already exist):", + "fp_ename": "{0} items cannot be moved here because the names are already taken. Give them new names below to continue, or blank the name to skip them:", + "fcp_ename": "{0} items cannot be copied here because the names are already taken. Give them new names below to continue, or blank the name to skip them:", + "fp_emore": "there are still some filename collisions left to fix", "fp_ok": "move OK", "fcp_ok": "copy OK", "fp_busy": "moving {0} items...\n\n{1}", @@ -604,6 +606,7 @@ var tl_browser = { "u_pott": "

files:   {0} finished,   {1} failed,   {2} busy,   {3} queued

", "u_ever": "this is the basic uploader; up2k needs at least
chrome 21 // firefox 13 // edge 12 // opera 12 // safari 5.1", "u_su2k": 'this is the basic uploader; up2k is better', + "u_uput": 'optimize for speed (skip checksum)', "u_ewrite": 'you do not have write-access to this folder', "u_eread": 'you do not have read-access to this folder', "u_enoi": 'file-search is not enabled in server config', diff --git a/scripts/tl.py b/scripts/tl.py index 2499fc62..666e4cf8 100755 --- a/scripts/tl.py +++ b/scripts/tl.py @@ -114,6 +114,7 @@ var tl_cpanel = {{ "ab1": "disable no304", "ac1": "enable no304", "ad1": "enabling no304 will disable all caching; try this if k304 wasn't enough. This will waste a huge amount of network traffic!", + "ae1": "active downloads:", }}, }};