support url-pwd on mounts page

This commit is contained in:
ed 2021-04-11 20:43:35 +02:00
parent 98a944f7cc
commit bf4949353d
3 changed files with 12 additions and 7 deletions

View file

@ -1214,9 +1214,14 @@ class HttpCli(object):
return True
def tx_mounts(self):
suf = [
"{}={}".format(k, v) if v else k for k, v in self.uparam.items() if k != "h"
]
suf = "?" + "&".join(suf) if suf else ""
rvol = [x + "/" if x else x for x in self.rvol]
wvol = [x + "/" if x else x for x in self.wvol]
html = self.j2("splash", this=self, rvol=rvol, wvol=wvol)
html = self.j2("splash", this=self, rvol=rvol, wvol=wvol, url_suf=suf)
self.reply(html.encode("utf-8"))
return True
@ -1356,7 +1361,7 @@ class HttpCli(object):
if pwd:
url_suf.append("pw=" + quotep(pwd))
url_suf = ("?" + "&".join(url_suf)) if url_suf else ""
url_suf = ("?" + "&".join(url_suf)) if url_suf else ""
dirs = []
files = []

View file

@ -10,7 +10,7 @@
<body>
{%- if srv_info %}
<p>{{ srv_info }}</p>
<p><span>{{ srv_info }}</span></p>
{%- endif %}
{%- if have_b_u %}
@ -49,7 +49,7 @@
<div>{{ logues[1] }}</div><br />
{%- endif %}
<h2><a href="?h">control-panel</a></h2>
<h2><a href="{{ url_suf }}&amp;h">control-panel</a></h2>
</body>
</html>

View file

@ -16,20 +16,20 @@
<h1>you can browse these:</h1>
<ul>
{% for mp in rvol %}
<li><a href="/{{ mp }}">/{{ mp }}</a></li>
<li><a href="/{{ mp }}{{ url_suf }}">/{{ mp }}</a></li>
{% endfor %}
</ul>
<h1>you can upload to:</h1>
<ul>
{% for mp in wvol %}
<li><a href="/{{ mp }}">/{{ mp }}</a></li>
<li><a href="/{{ mp }}{{ url_suf }}">/{{ mp }}</a></li>
{% endfor %}
</ul>
<h1>login for more:</h1>
<ul>
<form method="post" enctype="multipart/form-data" action="/">
<form method="post" enctype="multipart/form-data" action="/{{ url_suf }}">
<input type="hidden" name="act" value="login" />
<input type="password" name="cppwd" />
<input type="submit" value="Login" />