From 7bfd370b6c37d17a3d5b48d8613f4a2a32931fba Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 20 Dec 2025 15:54:42 +0000 Subject: [PATCH] mte can enable: w .up_at up_by up_ip --- copyparty/authsrv.py | 14 ++++++++++++++ copyparty/httpcli.py | 12 +----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index a683d346..2b096334 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -93,6 +93,13 @@ LEELOO_DALLAS = "leeloo_dallas" ## thanks for coming to my ted talk +UP_MTE_MAP = { # db-order + "w": "substr(w,1,16)", + "up_ip": "ip", + ".up_at": "at", + "up_by": "un", +} + SEE_LOG = "see log for details" SEESLOG = " (see serverlog for details)" SSEELOG = " ({})".format(SEE_LOG) @@ -1058,6 +1065,7 @@ class AuthSrv(object): "tcolor": self.args.tcolor, "du_iwho": self.args.du_iwho, "shr_who": self.args.shr_who if self.args.shr else "no", + "ls_q_m": ("", ""), } self._vf0 = self._vf0b.copy() self._vf0["d2d"] = True @@ -2672,6 +2680,12 @@ class AuthSrv(object): self.log(t.format(vol.vpath, mtp), 1) errors = True + mte = vol.flags.get("mte") or {} + up_m = [x for x in UP_MTE_MAP if x in mte] + up_q = [UP_MTE_MAP[x] for x in up_m] + zs = "select %s from up where rd=? and fn=?" % (", ".join(up_q),) + vol.flags["ls_q_m"] = (zs if up_m else "", up_m) + for vol in vfs.all_nodes.values(): if not vol.flags.get("is_file"): continue diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 8281fc27..ee0a4e94 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -7032,18 +7032,8 @@ class HttpCli(object): if self.can_admin: 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 = "" + up_q, up_m = vn.flags["ls_q_m"] 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: