From a61f8133d526fa56428897bbc891e2c6cb3d9e9b Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 5 Sep 2021 22:33:42 +0200 Subject: [PATCH] add option to disable logues --- copyparty/__main__.py | 1 + copyparty/httpcli.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 1846e601..fd2424d4 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -355,6 +355,7 @@ def run_argparse(argv, formatter): ap2.add_argument("-nih", action="store_true", help="no info hostname") ap2.add_argument("-nid", action="store_true", help="no info disk-usage") ap2.add_argument("--no-zip", action="store_true", help="disable download as zip/tar") + ap2.add_argument("--no-logues", action="store_true", help="disable rendering .prologue/.epilogue.html into directory listings") ap2.add_argument("--no-lifetime", action="store_true", help="disable automatic deletion of uploads after a certain time (lifetime volflag)") ap2 = ap.add_argument_group('safety options') diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index b5e49ffc..d445fd0b 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1868,11 +1868,12 @@ class HttpCli(object): tpl = "browser2" logues = ["", ""] - for n, fn in enumerate([".prologue.html", ".epilogue.html"]): - fn = os.path.join(abspath, fn) - if bos.path.exists(fn): - with open(fsenc(fn), "rb") as f: - logues[n] = f.read().decode("utf-8") + if not self.args.no_logues: + for n, fn in enumerate([".prologue.html", ".epilogue.html"]): + fn = os.path.join(abspath, fn) + if bos.path.exists(fn): + with open(fsenc(fn), "rb") as f: + logues[n] = f.read().decode("utf-8") ls_ret = { "dirs": [],