mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
include links in bup summary
This commit is contained in:
parent
78ba16f722
commit
3b8f697dd4
|
@ -249,14 +249,16 @@ class HttpCli(object):
|
||||||
r = ["{}={}".format(k, quotep(v)) if v else k for k, v in kv.items()]
|
r = ["{}={}".format(k, quotep(v)) if v else k for k, v in kv.items()]
|
||||||
return "?" + "&".join(r)
|
return "?" + "&".join(r)
|
||||||
|
|
||||||
def redirect(self, vpath, suf="", msg="aight", flavor="go to", use302=False):
|
def redirect(
|
||||||
|
self, vpath, suf="", msg="aight", flavor="go to", click=True, use302=False
|
||||||
|
):
|
||||||
html = self.j2(
|
html = self.j2(
|
||||||
"msg",
|
"msg",
|
||||||
h2='<a href="/{}">{} /{}</a>'.format(
|
h2='<a href="/{}">{} /{}</a>'.format(
|
||||||
quotep(vpath) + suf, flavor, html_escape(vpath, crlf=True) + suf
|
quotep(vpath) + suf, flavor, html_escape(vpath, crlf=True) + suf
|
||||||
),
|
),
|
||||||
pre=msg,
|
pre=msg,
|
||||||
click=True,
|
click=click,
|
||||||
).encode("utf-8", "replace")
|
).encode("utf-8", "replace")
|
||||||
|
|
||||||
if use302:
|
if use302:
|
||||||
|
@ -679,7 +681,7 @@ class HttpCli(object):
|
||||||
self.log("failed to utime ({}, {})".format(path, times))
|
self.log("failed to utime ({}, {})".format(path, times))
|
||||||
|
|
||||||
spd = self._spd(post_sz)
|
spd = self._spd(post_sz)
|
||||||
self.log("binpost {} thank".format(spd))
|
self.log("{} thank".format(spd))
|
||||||
self.reply(b"thank")
|
self.reply(b"thank")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -795,7 +797,7 @@ class HttpCli(object):
|
||||||
if sz == 0:
|
if sz == 0:
|
||||||
raise Pebkac(400, "empty files in post")
|
raise Pebkac(400, "empty files in post")
|
||||||
|
|
||||||
files.append([sz, sha512_hex])
|
files.append([sz, sha512_hex, p_file, fname])
|
||||||
self.conn.hsrv.broker.put(
|
self.conn.hsrv.broker.put(
|
||||||
False, "up2k.hash_file", vfs.realpath, vfs.flags, rem, fname
|
False, "up2k.hash_file", vfs.realpath, vfs.flags, rem, fname
|
||||||
)
|
)
|
||||||
|
@ -830,10 +832,13 @@ class HttpCli(object):
|
||||||
errmsg = "ERROR: " + errmsg
|
errmsg = "ERROR: " + errmsg
|
||||||
status = "ERROR"
|
status = "ERROR"
|
||||||
|
|
||||||
msg = "{0} // {1} bytes // {2:.3f} MiB/s\n".format(status, sz_total, spd)
|
msg = "{} // {} bytes // {:.3f} MiB/s\n".format(status, sz_total, spd)
|
||||||
|
|
||||||
for sz, sha512 in files:
|
for sz, sha512, ofn, lfn in files:
|
||||||
msg += "sha512: {0} // {1} bytes\n".format(sha512[:56], sz)
|
vpath = self.vpath + "/" + lfn
|
||||||
|
msg += 'sha512: {} // {} bytes // <a href="/{}">{}</a>\n'.format(
|
||||||
|
sha512[:56], sz, quotep(vpath), html_escape(ofn, crlf=True)
|
||||||
|
)
|
||||||
# truncated SHA-512 prevents length extension attacks;
|
# truncated SHA-512 prevents length extension attacks;
|
||||||
# using SHA-512/224, optionally SHA-512/256 = :64
|
# using SHA-512/224, optionally SHA-512/256 = :64
|
||||||
|
|
||||||
|
@ -847,7 +852,7 @@ class HttpCli(object):
|
||||||
ft = "{}\n{}\n{}\n".format(ft, msg.rstrip(), errmsg)
|
ft = "{}\n{}\n{}\n".format(ft, msg.rstrip(), errmsg)
|
||||||
f.write(ft.encode("utf-8"))
|
f.write(ft.encode("utf-8"))
|
||||||
|
|
||||||
self.redirect(self.vpath, msg=msg, flavor="return to")
|
self.redirect(self.vpath, msg=msg, flavor="return to", click=False)
|
||||||
self.parser.drop()
|
self.parser.drop()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue