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