mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
hide dotfiles, add logues
This commit is contained in:
parent
ff332b07b5
commit
68943ca454
|
@ -550,10 +550,10 @@ class HttpCli(object):
|
||||||
|
|
||||||
dirs = []
|
dirs = []
|
||||||
files = []
|
files = []
|
||||||
for fn in vfs_ls:
|
for fn in exclude_dotfiles(vfs_ls):
|
||||||
href = fn
|
href = fn
|
||||||
if self.absolute_urls:
|
if self.absolute_urls:
|
||||||
href = vpath + "/" + fn
|
href = "/" + vpath + "/" + fn
|
||||||
|
|
||||||
fspath = fsroot + "/" + fn
|
fspath = fsroot + "/" + fn
|
||||||
inf = os.stat(fsenc(fspath))
|
inf = os.stat(fsenc(fspath))
|
||||||
|
@ -575,6 +575,13 @@ class HttpCli(object):
|
||||||
else:
|
else:
|
||||||
files.append(item)
|
files.append(item)
|
||||||
|
|
||||||
|
logues = [None, None]
|
||||||
|
for n, fn in enumerate([".prologue.html", ".epilogue.html"]):
|
||||||
|
fn = os.path.join(abspath, fn)
|
||||||
|
if os.path.exists(fn):
|
||||||
|
with open(fn, "rb") as f:
|
||||||
|
logues[n] = f.read().decode("utf-8")
|
||||||
|
|
||||||
ts = ""
|
ts = ""
|
||||||
# ts = "?{}".format(time.time())
|
# ts = "?{}".format(time.time())
|
||||||
|
|
||||||
|
@ -585,6 +592,8 @@ class HttpCli(object):
|
||||||
files=dirs,
|
files=dirs,
|
||||||
can_upload=self.writable,
|
can_upload=self.writable,
|
||||||
ts=ts,
|
ts=ts,
|
||||||
|
prologue=logues[0],
|
||||||
|
epilogue=logues[1],
|
||||||
)
|
)
|
||||||
self.reply(html.encode("utf-8", "replace"))
|
self.reply(html.encode("utf-8", "replace"))
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -344,6 +344,12 @@ def sanitize_fn(fn):
|
||||||
return fn.replace("\\", "/").split("/")[-1].strip()
|
return fn.replace("\\", "/").split("/")[-1].strip()
|
||||||
|
|
||||||
|
|
||||||
|
def exclude_dotfiles(filepaths):
|
||||||
|
for fpath in filepaths:
|
||||||
|
if not fpath.split("/")[-1].startswith("."):
|
||||||
|
yield fpath
|
||||||
|
|
||||||
|
|
||||||
def quotep(txt):
|
def quotep(txt):
|
||||||
"""url quoter which deals with bytes correctly"""
|
"""url quoter which deals with bytes correctly"""
|
||||||
btxt = fsenc(txt)
|
btxt = fsenc(txt)
|
||||||
|
|
|
@ -123,6 +123,9 @@ a {
|
||||||
#path span {
|
#path span {
|
||||||
padding-left: .2em;
|
padding-left: .2em;
|
||||||
}
|
}
|
||||||
|
.logue {
|
||||||
|
padding: .2em 1.5em;
|
||||||
|
}
|
||||||
a.play {
|
a.play {
|
||||||
color: #e70;
|
color: #e70;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
<span>{{ vpnodes[-1][1] }}</span>
|
<span>{{ vpnodes[-1][1] }}</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
{%- if prologue %}
|
||||||
|
<div id="pro" class="logue">{{ prologue }}</div>
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
<table id="files">
|
<table id="files">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -42,6 +46,10 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{%- if epilogue %}
|
||||||
|
<div id="epi" class="logue">{{ epilogue }}</div>
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
<h2><a href="?h">control-panel</a></h2>
|
<h2><a href="?h">control-panel</a></h2>
|
||||||
|
|
||||||
<div id="widget">
|
<div id="widget">
|
||||||
|
|
Loading…
Reference in a new issue