diff --git a/infra/authentik/custom-templates/base/header_js.html b/infra/authentik/custom-templates/base/header_js.html index 7f1f237..f4b1658 100644 --- a/infra/authentik/custom-templates/base/header_js.html +++ b/infra/authentik/custom-templates/base/header_js.html @@ -96,11 +96,33 @@ if (!document.body || document.querySelector("[data-nodedc-auth-logo='true']")) return; document.body.classList.add("nodedc-auth-enhanced"); - const logo = document.createElement("div"); + const logo = document.createElement("a"); logo.className = "nodedc-auth-logo"; logo.dataset.nodedcAuthLogo = "true"; + logo.href = getLauncherBaseUrl(); + logo.setAttribute("aria-label", "NODE.DC"); logo.innerHTML = logoSvg; document.body.appendChild(logo); + updateLogoLink(logo); + } + + function getLauncherBaseUrl() { + const hostname = window.location.hostname; + const launcherHostname = hostname.startsWith("auth.") ? `launcher.${hostname.slice(5)}` : "launcher.local.nodedc"; + const port = window.location.port ? `:${window.location.port}` : ""; + + return `${window.location.protocol}//${launcherHostname}${port}/`; + } + + function updateLogoLink(logo) { + fetch(new URL("/api/public/brand", getLauncherBaseUrl()).toString(), { cache: "no-store" }) + .then((response) => (response.ok ? response.json() : null)) + .then((payload) => { + if (payload?.logoLinkUrl) { + logo.href = payload.logoLinkUrl; + } + }) + .catch(() => {}); } function translateTextValue(value) { diff --git a/infra/authentik/custom-templates/branding/nodedc-login.css b/infra/authentik/custom-templates/branding/nodedc-login.css index b8b44de..1c1fb82 100644 --- a/infra/authentik/custom-templates/branding/nodedc-login.css +++ b/infra/authentik/custom-templates/branding/nodedc-login.css @@ -79,8 +79,8 @@ body:not(.nodedc-auth-enhanced)::after { content: ""; display: block; position: fixed; - top: 1.6rem; - left: 1.25rem; + top: 1.7875rem; + left: calc(1.9375rem - 2px); width: 7.25rem; height: 1.79rem; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg id='nodedc-logo' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220.82 54.55'%3E%3Cpath fill='%23e2e1e1' d='M52.8 23.61 46.92 33.76 41.05 23.61H52.8m18-10.39H23.06l23.86 41.33Z'/%3E%3Cpolygon fill='%23e2e1e1' points='31.28 33.13 18.11 10.34 75.73 10.34 62.59 33.13 74.28 33.13 93.22 0 0 0 19.61 33.13 31.28 33.13'/%3E%3Cpath fill='%23dbdbdb' d='M116.35 18.49V1h1.27l10.34 15V1h1.33v17.49H128l-10.34-15v15Zm24.08.15c-4.79 0-8.16-3.72-8.16-8.89S135.64.86 140.43.86s8.17 3.72 8.17 8.89-3.35 8.89-8.17 8.89Zm0-1.25c4 0 6.79-3.17 6.79-7.64s-2.77-7.64-6.79-7.64-6.77 3.17-6.77 7.64 2.78 7.64 6.77 7.64ZM151.6 18.49V1h5.1c5.54 0 8.79 3.42 8.79 8.74s-3.25 8.74-8.79 8.74Zm1.4-1.25h3.75c4.77 0 7.42-2.92 7.42-7.49s-2.65-7.49-7.42-7.49H153ZM168.49 1h10.77v1.26h-9.42v6.67h7.89v1.25h-7.89v7.06h9.74v1.25h-11.09Zm20.39 17.49V1H194c5.54 0 8.79 3.42 8.79 8.74s-3.25 8.74-8.79 8.74Zm1.35-1.25H194c4.77 0 7.41-2.92 7.41-7.49S198.75 2.26 194 2.26h-3.75Zm14.92-7.49c0-5.24 3.19-8.89 8.11-8.89a6.8 6.8 0 0 1 7.1 5.52h-1.43a5.54 5.54 0 0 0-5.74-4.27c-4.05 0-6.64 3.17-6.64 7.64s2.54 7.64 6.59 7.64a5.46 5.46 0 0 0 5.74-4.29h1.43c-.75 3.52-3.4 5.54-7.15 5.54-4.89 0-8.01-3.59-8.01-8.89Z'/%3E%3C/svg%3E"); @@ -91,12 +91,15 @@ body:not(.nodedc-auth-enhanced)::after { .nodedc-auth-logo { position: fixed; - top: 1.6rem; - left: 1.25rem; + display: block; + top: 1.7875rem; + left: calc(1.9375rem - 2px); width: 7.25rem; height: 1.79rem; z-index: 20; - pointer-events: none; + line-height: 0; + text-decoration: none; + pointer-events: auto; color: var(--nodedc-auth-text-primary); } @@ -534,8 +537,8 @@ ak-user-interface, body::after, .nodedc-auth-logo { - top: 1.6rem; - left: 1.25rem; + top: 1.7875rem; + left: calc(1.9375rem - 2px); width: 7.25rem; height: 1.79rem; }