Add client info
All checks were successful
Deploy / deploy (push) Successful in 18s

This commit is contained in:
informaticker 2024-11-04 23:37:38 +01:00
parent 47aa4e9893
commit 7a63da4cfc

View File

@ -68,6 +68,21 @@ function eraselabel(label) {
label.setAttribute("data-animation-interval", eraseInterval);
}
// we get the client info from the headers
// unclean but it works
function updateClientInfo() {
fetch(window.location.href)
.then((response) => {
const clientInfo = response.headers.get("X-Client-Info");
if (clientInfo) {
document.querySelector(".location").textContent = clientInfo;
}
})
.catch((error) => {
console.error("Error fetching X-Client-Info:", error);
});
}
// updates the time display
// probably updates too much but eh
function updateTime() {
@ -291,6 +306,8 @@ document.addEventListener("DOMContentLoaded", () => {
updateStatus();
setInterval(updateStatus, STATUS_UPDATE_INTERVAL);
updateClientInfo();
const activeNavIcon = document.querySelector(".nav-icon.active");
if (activeNavIcon) {
const label = activeNavIcon.querySelector(".nav-label");