diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 9c55b3ea..04507f5f 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -2514,13 +2514,17 @@ class AuthSrv(object): ico_url = vol.flags.get("ufavico") if ico_url: + ico_h = "" ico_ext = ico_url.split("?")[0].split(".")[-1].lower() if ico_ext in FAVICON_MIMES: zs = '\n' - head_s += zs % (FAVICON_MIMES[ico_ext], ico_url) + ico_h = zs % (FAVICON_MIMES[ico_ext], ico_url) elif ico_ext == "ico": zs = '\n' - head_s += zs % (ico_url,) + ico_h = zs % (ico_url,) + if ico_h: + vol.flags["ufavico_h"] = ico_h + head_s += ico_h if head_s: vol.flags["html_head_s"] = head_s @@ -3005,6 +3009,8 @@ class AuthSrv(object): "unlist": vf.get("unlist") or "", "sb_lg": "" if "no_sb_lg" in vf else (vf.get("lg_sbf") or "y"), } + if "ufavico_h" in vf: + vn.js_ls["ufavico"] = vf["ufavico_h"] js_htm = { "SPINNER": self.args.spinner, "s_name": self.args.bname, diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 1f584e98..e64d181c 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -19113,6 +19113,11 @@ var treectl = (function () { if (o) o.innerHTML = ebi('srv_info').innerHTML = '' + srvinf + ''; + if (res.ufavico && (!favico.en || !ebi('icot').value)) { + while (qsr('head>link[rel~="icon"]')) { } + document.head.insertAdjacentHTML('beforeend', res.ufavico); + } + if (this.hpush && !showfile.active()) hist_push(this.top + (dk ? '?k=' + dk : '')); diff --git a/tests/util.py b/tests/util.py index 527f9e61..c23e94b1 100644 --- a/tests/util.py +++ b/tests/util.py @@ -164,7 +164,7 @@ class Cfg(Namespace): ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin qr_wait re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs" ka.update(**{k: 0 for k in ex.split()}) - ex = "ah_alg bname chdir chmod_f chpw_db doctitle df exit favico ipa html_head html_head_d html_head_s idp_login idp_logout lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i opds_exts shr tcolor textfiles txt_eol ufavico unlist vname xff_src zipmaxt R RS SR" + ex = "ah_alg bname chdir chmod_f chpw_db doctitle df exit favico ipa html_head html_head_d html_head_s idp_login idp_logout lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i opds_exts shr tcolor textfiles txt_eol ufavico ufavico_h unlist vname xff_src zipmaxt R RS SR" ka.update(**{k: "" for k in ex.split()}) ex = "ban_403 ban_404 ban_422 ban_pw ban_pwc ban_url spinner"