diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 21371443..437ddd65 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1269,6 +1269,7 @@ def add_ui(ap, retry): ap2.add_argument("--bname", metavar="TXT", type=u, default="--name", help="server name (displayed in filebrowser document title)") ap2.add_argument("--pb-url", metavar="URL", type=u, default="https://github.com/9001/copyparty", help="powered-by link; disable with \033[33m-np\033[0m") ap2.add_argument("--ver", action="store_true", help="show version on the control panel (incompatible with \033[33m-nb\033[0m)") + ap2.add_argument("--k304", metavar="NUM", type=int, default=0, help="configure the option to enable/disable k304 on the controlpanel (workaround for buggy reverse-proxies); [\033[32m0\033[0m] = hidden and default-off, [\033[32m1\033[0m] = visible and default-off, [\033[32m2\033[0m] = visible and default-on") ap2.add_argument("--md-sbf", metavar="FLAGS", type=u, default="downloads forms popups scripts top-navigation-by-user-activation", help="list of capabilities to ALLOW for README.md docs (volflag=md_sbf); see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox") ap2.add_argument("--lg-sbf", metavar="FLAGS", type=u, default="downloads forms popups scripts top-navigation-by-user-activation", help="list of capabilities to ALLOW for prologue/epilogue docs (volflag=lg_sbf)") ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README.md documents (volflags: no_sb_md | sb_md)") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 0cf531ed..a97c32ce 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -655,7 +655,11 @@ class HttpCli(object): def k304(self) -> bool: k304 = self.cookies.get("k304") - return k304 == "y" or ("; Trident/" in self.ua and not k304) + return ( + k304 == "y" + or (self.args.k304 == 2 and k304 != "n") + or ("; Trident/" in self.ua and not k304) + ) def send_headers( self, @@ -3352,6 +3356,7 @@ class HttpCli(object): dbwt=vs["dbwt"], url_suf=suf, k304=self.k304(), + k304vis=self.args.k304 > 0, ver=S_VERSION if self.args.ver else "", ahttps="" if self.is_https else "https://" + self.host + self.req, ) @@ -3360,7 +3365,7 @@ class HttpCli(object): def set_k304(self) -> bool: v = self.uparam["k304"].lower() - if v == "y": + if v in "yn": dur = 86400 * 299 else: dur = 0 diff --git a/copyparty/web/splash.html b/copyparty/web/splash.html index 73bb6d87..8e3fe668 100644 --- a/copyparty/web/splash.html +++ b/copyparty/web/splash.html @@ -78,13 +78,15 @@
enabling this will disconnect your client on every HTTP 304, which can prevent some buggy proxies from getting stuck (suddenly not loading pages), but it will also make things slower in general