From 974ddc07f7fec439b29931aeb730c1f6117fb572 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 2 Jun 2021 21:19:39 +0200 Subject: [PATCH] web: improve loading of custom favicon Signed-off-by: Jens Langhammer --- authentik/core/templates/base/skeleton.html | 1 - web/src/api/Config.ts | 16 +++++++++++++--- web/src/interfaces/admin/index.html | 2 -- web/src/interfaces/flow/index.html | 2 -- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/authentik/core/templates/base/skeleton.html b/authentik/core/templates/base/skeleton.html index 47e6731e3..1efc101fd 100644 --- a/authentik/core/templates/base/skeleton.html +++ b/authentik/core/templates/base/skeleton.html @@ -8,7 +8,6 @@ {% block title %}{% trans title|default:tenant.branding_title %}{% endblock %} - diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index 43c604ec2..49c17aaee 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -26,10 +26,20 @@ let globalTenantPromise: Promise; export function tenant(): Promise { if (!globalTenantPromise) { globalTenantPromise = new CoreApi(DEFAULT_CONFIG).coreTenantsCurrentRetrieve().then(tenant => { - const relIcon = document.head.querySelector("link[rel=icon]"); - if (relIcon) { + /** + * + * + */ + const rels = ["icon", "shortcut icon"]; + rels.forEach(rel => { + let relIcon = document.head.querySelector("link[rel=icon]"); + if (!relIcon) { + relIcon = document.createElement('link'); + relIcon.rel = rel; + document.getElementsByTagName('head')[0].appendChild(relIcon); + } relIcon.href = tenant.brandingLogo; - } + }) return tenant; }); } diff --git a/web/src/interfaces/admin/index.html b/web/src/interfaces/admin/index.html index 0d068d06e..87067e3f5 100644 --- a/web/src/interfaces/admin/index.html +++ b/web/src/interfaces/admin/index.html @@ -3,8 +3,6 @@ - - diff --git a/web/src/interfaces/flow/index.html b/web/src/interfaces/flow/index.html index 1b14d8d39..a6d4aac47 100644 --- a/web/src/interfaces/flow/index.html +++ b/web/src/interfaces/flow/index.html @@ -3,8 +3,6 @@ - -