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"]; const rels = ["icon", "shortcut icon"];
rels.forEach(rel => { rels.forEach(rel => {
let relIcon = document.head.querySelector<HTMLLinkElement>("link[rel=icon]"); let relIcon = document.head.querySelector<HTMLLinkElement>(`link[rel='${rel}']`);
if (!relIcon) { if (!relIcon) {
relIcon = document.createElement('link'); relIcon = document.createElement('link');
relIcon.rel = rel; relIcon.rel = rel;

View file

@ -17,6 +17,7 @@ export const MIN_WIDTH = 1200;
export const DefaultTenant: CurrentTenant = { 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", brandingTitle: "authentik",
uiFooterLinks: [], uiFooterLinks: [],
matchedDomain: "", matchedDomain: "",

View file

@ -8,6 +8,7 @@ import "../../elements/forms/FormGroup";
import { first } from "../../utils"; import { first } from "../../utils";
import { ModelForm } from "../../elements/forms/ModelForm"; import { ModelForm } from "../../elements/forms/ModelForm";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { DefaultTenant } from "../../elements/sidebar/SidebarBrand";
@customElement("ak-tenant-form") @customElement("ak-tenant-form")
export class TenantForm extends ModelForm<Tenant, string> { export class TenantForm extends ModelForm<Tenant, string> {
@ -66,21 +67,21 @@ export class TenantForm extends ModelForm<Tenant, string> {
label=${t`Title`} label=${t`Title`}
?required=${true} ?required=${true}
name="brandingTitle"> 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> <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>
<ak-form-element-horizontal <ak-form-element-horizontal
label=${t`Logo`} label=${t`Logo`}
?required=${true} ?required=${true}
name="brandingLogo"> 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> <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>
<ak-form-element-horizontal <ak-form-element-horizontal
label=${t`Favicon`} label=${t`Favicon`}
?required=${true} ?required=${true}
name="brandingFavicon"> 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> <p class="pf-c-form__helper-text">${t`Icon shown in the browser tab.`}</p>
</ak-form-element-horizontal> </ak-form-element-horizontal>
</div> </div>