From 67ff57f3a3eb352b506af4dbc199f57eafb538d4 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 20 Mar 2022 02:45:53 +0100 Subject: [PATCH] add option to disable html folder listings --- copyparty/__main__.py | 1 + copyparty/httpcli.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 8e317481..176e5bfe 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -471,6 +471,7 @@ def run_argparse(argv, formatter): ap2.add_argument("--no-logues", action="store_true", help="disable rendering .prologue/.epilogue.html into directory listings") ap2.add_argument("--no-readme", action="store_true", help="disable rendering readme.md into directory listings") ap2.add_argument("--vague-403", action="store_true", help="send 404 instead of 403 (security through ambiguity, very enterprise)") + ap2.add_argument("--force-js", action="store_true", help="don't send HTML folder listings, force clients to use the embedded json instead") ap2 = ap.add_argument_group('yolo options') ap2.add_argument("--ign-ebind", action="store_true", help="continue running even if it's impossible to listen on some of the requested endpoints") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 454231aa..b19de920 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -2156,7 +2156,7 @@ class HttpCli(object): url_suf = self.urlq({}, []) is_ls = "ls" in self.uparam - is_js = self.cookies.get("js") == "y" + is_js = self.args.force_js or self.cookies.get("js") == "y" tpl = "browser" if "b" in self.uparam: