Update static/js/04-main.js

This commit is contained in:
admin 2026-10-08 00:46:05 +00:00
parent ca7eae57d2
commit 09a7dd353d

View File

@ -2,6 +2,31 @@
"use strict";
window.Glow = window.Glow || {};
Glow.presenceModeLabel = mode => {
switch (String(mode || "").toLowerCase()) {
case "silent":
return "silent";
case "focus":
return "focus";
case "dnd":
return "do not disturb";
default:
return "online";
}
};
const originalUpdateAuthUI = Glow.updateAuthUI;
Glow.updateAuthUI = () => {
if (typeof originalUpdateAuthUI === "function") {
originalUpdateAuthUI();
}
const user = Glow.state.currentUser;
if (user && Glow.els.headerAccount) {
const mode = Glow.presenceModeLabel(user.presence_mode);
Glow.els.headerAccount.textContent = `${user.username} · ${user.role} · ${mode}`;
}
};
Glow.loadRooms = async () => {
const previousSlug = Glow.state.activeRoom?.slug;
const data = await Glow.apiRequest("/api/rooms");