show warks in folder-listings

This commit is contained in:
ed 2025-09-28 21:37:46 +00:00
parent 4e38e4087e
commit 456addf26f
2 changed files with 53 additions and 51 deletions

View file

@ -1579,6 +1579,7 @@ the same arguments can be set as volflags, in addition to `d2d`, `d2ds`, `d2t`,
note: note:
* upload-times can be displayed in the file listing by enabling the `.up_at` metadata key, either globally with `-e2d -mte +.up_at` or per-volume with volflags `e2d,mte=+.up_at` (will have a ~17% performance impact on directory listings) * upload-times can be displayed in the file listing by enabling the `.up_at` metadata key, either globally with `-e2d -mte +.up_at` or per-volume with volflags `e2d,mte=+.up_at` (will have a ~17% performance impact on directory listings)
* and file checksums can be shown with global-option `-e2d -mte +w` or volflag `e2d,mte=+w` (always active for users with permission `a`)
* `e2tsr` is probably always overkill, since `e2ds`/`e2dsa` would pick up any file modifications and `e2ts` would then reindex those, unless there is a new copyparty version with new parsers and the release note says otherwise * `e2tsr` is probably always overkill, since `e2ds`/`e2dsa` would pick up any file modifications and `e2ts` would then reindex those, unless there is a new copyparty version with new parsers and the release note says otherwise
config file example (these options are recommended btw): config file example (these options are recommended btw):

View file

@ -6802,62 +6802,63 @@ class HttpCli(object):
ap = vn.canonical(rem) ap = vn.canonical(rem)
return self.tx_file(ap) # is no-cache return self.tx_file(ap) # is no-cache
mte = vn.flags.get("mte", {}) if icur:
add_up_at = ".up_at" in mte mte = vn.flags.get("mte") or {}
is_admin = self.can_admin
tagset: set[str] = set() tagset: set[str] = set()
rd = vrem rd = vrem
for fe in files if icur else []: if self.can_admin:
assert icur # !rm up_q = "select substr(w,1,16), ip, at, un from up where rd=? and fn=?"
up_m = ["w", "up_ip", ".up_at", "up_by"]
elif ".up_at" in mte:
if "w" in mte:
up_q = "select substr(w,1,16), at from up where rd=? and fn=?"
up_m = ["w", ".up_at"]
else:
up_q = "select at from up where rd=? and fn=?"
up_m = [".up_at"]
elif "w" in mte:
up_q = "select substr(w,1,16) from up where rd=? and fn=?"
up_m = ["w"]
else:
up_q = ""
mt_q = "select mt.k, mt.v from up inner join mt on mt.w = substr(up.w,1,16) where up.rd = ? and up.fn = ? and +mt.k != 'x'"
for fe in files:
fn = fe["name"] fn = fe["name"]
erd_efn = (rd, fn) erd_efn = (rd, fn)
q = "select mt.k, mt.v from up inner join mt on mt.w = substr(up.w,1,16) where up.rd = ? and up.fn = ? and +mt.k != 'x'"
try: try:
r = icur.execute(q, erd_efn) r = icur.execute(mt_q, erd_efn)
except Exception as ex: except Exception as ex:
if "database is locked" in str(ex): if "database is locked" in str(ex):
break break
try: try:
erd_efn = s3enc(idx.mem_cur, rd, fn) erd_efn = s3enc(idx.mem_cur, rd, fn)
r = icur.execute(q, erd_efn) r = icur.execute(mt_q, erd_efn)
except: except:
self.log("tag read error, %r / %r\n%s" % (rd, fn, min_ex())) self.log("tag read error, %r / %r\n%s" % (rd, fn, min_ex()))
break break
tags = {k: v for k, v in r} tags = {k: v for k, v in r}
if is_admin: if up_q:
q = "select ip, at, un from up where rd=? and fn=?"
try: try:
zs1, zs2, zs3 = icur.execute(q, erd_efn).fetchone() up_v = icur.execute(up_q, erd_efn).fetchone()
if zs1: for zs1, zs2 in zip(up_m, up_v):
tags["up_ip"] = zs1
if zs2: if zs2:
tags[".up_at"] = zs2 tags[zs1] = zs2
if zs3:
tags["up_by"] = zs3
except:
pass
elif add_up_at:
q = "select at from up where rd=? and fn=?"
try:
(zs1,) = icur.execute(q, erd_efn).fetchone()
if zs1:
tags[".up_at"] = zs1
except: except:
pass pass
_ = [tagset.add(k) for k in tags] _ = [tagset.add(k) for k in tags]
fe["tags"] = tags fe["tags"] = tags
if icur:
for fe in dirs: for fe in dirs:
fe["tags"] = ODict() fe["tags"] = ODict()
lmte = list(mte) lmte = list(mte)
if self.can_admin: if self.can_admin:
lmte.extend(("up_by", "up_ip", ".up_at")) lmte.extend(("w", "up_by", "up_ip", ".up_at"))
if "nodirsz" not in vf: if "nodirsz" not in vf:
tagset.add(".files") tagset.add(".files")
@ -6872,7 +6873,7 @@ class HttpCli(object):
taglist = [k for k in lmte if k in tagset] taglist = [k for k in lmte if k in tagset]
else: else:
taglist = list(tagset) taglist = []
logues, readmes = self._add_logues(vn, abspath, lnames) logues, readmes = self._add_logues(vn, abspath, lnames)
ls_ret["logues"] = j2a["logues"] = logues ls_ret["logues"] = j2a["logues"] = logues