UI - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: брендинг Authentik под NODE.DC
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user