mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
hide k304 config from controlpanel by default;
as this option is very rarely useful, add global-option `--k304` to unhide the button and/or set it default-enabled the toggle will still appear when the feature was previously enabled by a client, and the feature is still default-enabled for all IE clients
This commit is contained in:
parent
a1ad608267
commit
1c011ff0bb
|
@ -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)")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -78,12 +78,14 @@
|
|||
|
||||
<h1 id="cc">client config:</h1>
|
||||
<ul>
|
||||
{% if k304 or k304vis %}
|
||||
{% if k304 %}
|
||||
<li><a id="h" href="{{ r }}/?k304=n">disable k304</a> (currently enabled)
|
||||
{%- else %}
|
||||
<li><a id="i" href="{{ r }}/?k304=y" class="r">enable k304</a> (currently disabled)
|
||||
{% endif %}
|
||||
<blockquote id="j">enabling this will disconnect your client on every HTTP 304, which can prevent some buggy proxies from getting stuck (suddenly not loading pages), <em>but</em> it will also make things slower in general</blockquote></li>
|
||||
{% endif %}
|
||||
|
||||
<li><a id="k" href="{{ r }}/?reset" class="r" onclick="localStorage.clear();return true">reset client settings</a></li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue