mte can enable: w .up_at up_by up_ip

This commit is contained in:
ed
2025-12-20 15:54:42 +00:00
parent 1f6e811674
commit 7bfd370b6c
2 changed files with 15 additions and 11 deletions

View File

@@ -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

View File

@@ -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: