mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
remember ?edit and trailing-slash during login redirect
This commit is contained in:
parent
d03e96a392
commit
3966266207
|
@ -141,6 +141,7 @@ class HttpCli(object):
|
||||||
self.vn = self.asrv.vfs
|
self.vn = self.asrv.vfs
|
||||||
self.rem = " "
|
self.rem = " "
|
||||||
self.vpath = " "
|
self.vpath = " "
|
||||||
|
self.vpaths = " "
|
||||||
self.uname = " "
|
self.uname = " "
|
||||||
self.pw = " "
|
self.pw = " "
|
||||||
self.rvol = [" "]
|
self.rvol = [" "]
|
||||||
|
@ -384,6 +385,9 @@ class HttpCli(object):
|
||||||
self.uparam = uparam
|
self.uparam = uparam
|
||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
self.vpath = unquotep(vpath) # not query, so + means +
|
self.vpath = unquotep(vpath) # not query, so + means +
|
||||||
|
self.vpaths = (
|
||||||
|
self.vpath + "/" if self.trailing_slash and self.vpath else self.vpath
|
||||||
|
)
|
||||||
|
|
||||||
ok = "\x00" not in self.vpath
|
ok = "\x00" not in self.vpath
|
||||||
if ANYWIN:
|
if ANYWIN:
|
||||||
|
@ -687,6 +691,21 @@ class HttpCli(object):
|
||||||
r = ["%s=%s" % (k, quotep(zs)) if zs else k for k, zs in kv.items()]
|
r = ["%s=%s" % (k, quotep(zs)) if zs else k for k, zs in kv.items()]
|
||||||
return "?" + "&".join(r)
|
return "?" + "&".join(r)
|
||||||
|
|
||||||
|
def ourlq(self) -> str:
|
||||||
|
skip = ("pw", "k")
|
||||||
|
ret = []
|
||||||
|
for k, v in self.ouparam.items():
|
||||||
|
if k in skip:
|
||||||
|
continue
|
||||||
|
|
||||||
|
t = "{}={}".format(quotep(k), quotep(v))
|
||||||
|
ret.append(t.replace(" ", "+").rstrip("="))
|
||||||
|
|
||||||
|
if not ret:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
return "?" + "&".join(ret)
|
||||||
|
|
||||||
def redirect(
|
def redirect(
|
||||||
self,
|
self,
|
||||||
vpath: str,
|
vpath: str,
|
||||||
|
@ -2025,7 +2044,9 @@ class HttpCli(object):
|
||||||
|
|
||||||
dst = self.args.SRS
|
dst = self.args.SRS
|
||||||
if self.vpath:
|
if self.vpath:
|
||||||
dst += quotep(self.vpath)
|
dst += quotep(self.vpaths)
|
||||||
|
|
||||||
|
dst += self.ourlq()
|
||||||
|
|
||||||
msg = self.get_pwd_cookie(pwd)
|
msg = self.get_pwd_cookie(pwd)
|
||||||
html = self.j2s("msg", h1=msg, h2='<a href="' + dst + '">ack</a>', redir=dst)
|
html = self.j2s("msg", h1=msg, h2='<a href="' + dst + '">ack</a>', redir=dst)
|
||||||
|
@ -3090,7 +3111,7 @@ class HttpCli(object):
|
||||||
html = self.j2s(
|
html = self.j2s(
|
||||||
"splash",
|
"splash",
|
||||||
this=self,
|
this=self,
|
||||||
qvpath=quotep(self.vpath),
|
qvpath=quotep(self.vpaths) + self.ourlq(),
|
||||||
rvol=rvol,
|
rvol=rvol,
|
||||||
wvol=wvol,
|
wvol=wvol,
|
||||||
avol=avol,
|
avol=avol,
|
||||||
|
@ -3148,7 +3169,8 @@ class HttpCli(object):
|
||||||
t = '<h1 id="n">404 not found ┐( ´ -`)┌</h1><p><a id="r" href="{}/?h">go home</a></p>'
|
t = '<h1 id="n">404 not found ┐( ´ -`)┌</h1><p><a id="r" href="{}/?h">go home</a></p>'
|
||||||
|
|
||||||
t = t.format(self.args.SR)
|
t = t.format(self.args.SR)
|
||||||
html = self.j2s("splash", this=self, qvpath=quotep(self.vpath), msg=t)
|
qv = quotep(self.vpaths) + self.ourlq()
|
||||||
|
html = self.j2s("splash", this=self, qvpath=qv, msg=t)
|
||||||
self.reply(html.encode("utf-8"), status=rc)
|
self.reply(html.encode("utf-8"), status=rc)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue