diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 40aafe25..a6fe3b9e 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -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 diff --git a/copyparty/util.py b/copyparty/util.py index 6ad1f984..2c145b6a 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -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) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 039f0bc5..785c0878 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -123,6 +123,9 @@ a { #path span { padding-left: .2em; } +.logue { + padding: .2em 1.5em; +} a.play { color: #e70; } diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 067a0cc7..31cc2edf 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -24,6 +24,10 @@ {{ vpnodes[-1][1] }} + {%- if prologue %} +
{{ prologue }}
+ {%- endif %} + @@ -41,6 +45,10 @@
+ + {%- if epilogue %} +
{{ epilogue }}
+ {%- endif %}

control-panel