web: fix missing default favicon and not updating correctly

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-02 21:47:56 +02:00
parent 3ea2b16a12
commit 4d773274d4
3 changed files with 7 additions and 5 deletions

View File

@ -32,7 +32,7 @@ export function tenant(): Promise<CurrentTenant> {
*/
const rels = ["icon", "shortcut icon"];
rels.forEach(rel => {
let relIcon = document.head.querySelector<HTMLLinkElement>("link[rel=icon]");
let relIcon = document.head.querySelector<HTMLLinkElement>(`link[rel='${rel}']`);
if (!relIcon) {
relIcon = document.createElement('link');
relIcon.rel = rel;

View File

@ -16,7 +16,8 @@ import { tenant } from "../../api/Config";
export const MIN_WIDTH = 1200;
export const DefaultTenant: CurrentTenant = {
brandingLogo: " /static/dist/assets/icons/icon_left_brand.svg",
brandingLogo: "/static/dist/assets/icons/icon_left_brand.svg",
brandingFavicon: "/static/dist/assets/icons/icon.png",
brandingTitle: "authentik",
uiFooterLinks: [],
matchedDomain: "",

View File

@ -8,6 +8,7 @@ import "../../elements/forms/FormGroup";
import { first } from "../../utils";
import { ModelForm } from "../../elements/forms/ModelForm";
import { until } from "lit-html/directives/until";
import { DefaultTenant } from "../../elements/sidebar/SidebarBrand";
@customElement("ak-tenant-form")
export class TenantForm extends ModelForm<Tenant, string> {
@ -66,21 +67,21 @@ export class TenantForm extends ModelForm<Tenant, string> {
label=${t`Title`}
?required=${true}
name="brandingTitle">
<input type="text" value="${first(this.instance?.brandingTitle, "authentik")}" class="pf-c-form-control" required>
<input type="text" value="${first(this.instance?.brandingTitle, DefaultTenant.brandingTitle)}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${t`Branding shown in page title and several other places.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${t`Logo`}
?required=${true}
name="brandingLogo">
<input type="text" value="${first(this.instance?.brandingLogo, "/static/dist/assets/icons/icon_left_brand.svg")}" class="pf-c-form-control" required>
<input type="text" value="${first(this.instance?.brandingLogo, DefaultTenant.brandingLogo)}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${t`Icon shown in sidebar/header and flow executor.`}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${t`Favicon`}
?required=${true}
name="brandingFavicon">
<input type="text" value="${first(this.instance?.brandingFavicon, "/static/dist/assets/icons/icon.png")}" class="pf-c-form-control" required>
<input type="text" value="${first(this.instance?.brandingFavicon, DefaultTenant.brandingFavicon)}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${t`Icon shown in the browser tab.`}</p>
</ak-form-element-horizontal>
</div>