mirror of
https://github.com/9001/copyparty.git
synced 2025-08-20 02:12:20 -06:00
include filekeys in unpost list
This commit is contained in:
parent
d8bddede6a
commit
2a5a4e785f
|
@ -2321,25 +2321,56 @@ class HttpCli(object):
|
||||||
ret: list[dict[str, Any]] = []
|
ret: list[dict[str, Any]] = []
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
lim = time.time() - self.args.unpost
|
lim = time.time() - self.args.unpost
|
||||||
|
fk_vols = {
|
||||||
|
vol: vol.flags["fk"]
|
||||||
|
for vp, vol in self.asrv.vfs.all_vols.items()
|
||||||
|
if "fk" in vol.flags and (vp in self.rvol or vp in self.upvol)
|
||||||
|
}
|
||||||
for vol in self.asrv.vfs.all_vols.values():
|
for vol in self.asrv.vfs.all_vols.values():
|
||||||
cur = idx.get_cur(vol.realpath)
|
cur = idx.get_cur(vol.realpath)
|
||||||
if not cur:
|
if not cur:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
nfk = fk_vols.get(vol, 0)
|
||||||
|
|
||||||
q = "select sz, rd, fn, at from up where ip=? and at>?"
|
q = "select sz, rd, fn, at from up where ip=? and at>?"
|
||||||
for sz, rd, fn, at in cur.execute(q, (self.ip, lim)):
|
for sz, rd, fn, at in cur.execute(q, (self.ip, lim)):
|
||||||
vp = "/" + "/".join(x for x in [vol.vpath, rd, fn] if x)
|
vp = "/" + "/".join(x for x in [vol.vpath, rd, fn] if x)
|
||||||
if filt and filt not in vp:
|
if filt and filt not in vp:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ret.append({"vp": quotep(vp), "sz": sz, "at": at})
|
rv = {"vp": quotep(vp), "sz": sz, "at": at, "nfk": nfk}
|
||||||
|
if nfk:
|
||||||
|
rv["ap"] = vol.canonical(vjoin(rd, fn))
|
||||||
|
|
||||||
|
ret.append(rv)
|
||||||
if len(ret) > 3000:
|
if len(ret) > 3000:
|
||||||
ret.sort(key=lambda x: x["at"], reverse=True) # type: ignore
|
ret.sort(key=lambda x: x["at"], reverse=True) # type: ignore
|
||||||
ret = ret[:2000]
|
ret = ret[:2000]
|
||||||
|
|
||||||
ret.sort(key=lambda x: x["at"], reverse=True) # type: ignore
|
ret.sort(key=lambda x: x["at"], reverse=True) # type: ignore
|
||||||
ret = ret[:2000]
|
n = 0
|
||||||
|
for rv in ret[:11000]:
|
||||||
|
nfk = rv.pop("nfk")
|
||||||
|
if not nfk:
|
||||||
|
continue
|
||||||
|
|
||||||
|
ap = rv.pop("ap")
|
||||||
|
try:
|
||||||
|
st = bos.stat(ap)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
|
fk = self.gen_fk(
|
||||||
|
self.args.fk_salt, ap, st.st_size, 0 if ANYWIN else st.st_ino
|
||||||
|
)
|
||||||
|
rv["vp"] += "?k=" + fk[:nfk]
|
||||||
|
|
||||||
|
n += 1
|
||||||
|
if n > 2000:
|
||||||
|
break
|
||||||
|
|
||||||
|
ret = ret[:2000]
|
||||||
jtxt = json.dumps(ret, indent=2, sort_keys=True).encode("utf-8", "replace")
|
jtxt = json.dumps(ret, indent=2, sort_keys=True).encode("utf-8", "replace")
|
||||||
self.log("{} #{} {:.2f}sec".format(lm, len(ret), time.time() - t0))
|
self.log("{} #{} {:.2f}sec".format(lm, len(ret), time.time() - t0))
|
||||||
self.reply(jtxt, mime="application/json")
|
self.reply(jtxt, mime="application/json")
|
||||||
|
|
|
@ -6415,7 +6415,7 @@ var unpost = (function () {
|
||||||
|
|
||||||
for (var a = n; a < n2; a++)
|
for (var a = n; a < n2; a++)
|
||||||
if (QS('#op_unpost a.n' + a))
|
if (QS('#op_unpost a.n' + a))
|
||||||
req.push(uricom_dec(r.files[a].vp));
|
req.push(uricom_dec(r.files[a].vp.split('?')[0]));
|
||||||
|
|
||||||
var links = QSA('#op_unpost a.n' + n);
|
var links = QSA('#op_unpost a.n' + n);
|
||||||
for (var a = 0, aa = links.length; a < aa; a++) {
|
for (var a = 0, aa = links.length; a < aa; a++) {
|
||||||
|
|
Loading…
Reference in a new issue