[fix](trx-frontend-http): fix rig initialization freeze caused by auth-badge inside template

The auth-badge element was wrapped inside <template id="tmpl-about">,
making it invisible to document.getElementById() at page load.
updateAuthUI() accessed badge.style without a null check, throwing a
TypeError that halted app initialization before connect() was called.

Move auth-badge outside the template so it is always in the live DOM,
and add defensive null guards on badge/badgeRole access.

https://claude.ai/code/session_01Km7uxYUzehpYBdYqncnt4n
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-04-01 08:58:47 +00:00
committed by Stan Grams
parent 941a37494b
commit c9167177e0
2 changed files with 4 additions and 4 deletions
@@ -174,14 +174,14 @@ function updateAuthUI() {
}
if (authRole) {
badge.style.display = "block";
badgeRole.textContent = authRole === "control" ? "Control (full access)" : "RX (read-only)";
if (badge) badge.style.display = "block";
if (badgeRole) badgeRole.textContent = authRole === "control" ? "Control (full access)" : "RX (read-only)";
if (headerAuthBtn) {
headerAuthBtn.textContent = "Logout";
headerAuthBtn.style.display = "block";
}
} else {
badge.style.display = "none";
if (badge) badge.style.display = "none";
if (headerAuthBtn) {
headerAuthBtn.textContent = "Login";
headerAuthBtn.style.display = "block";
@@ -1408,8 +1408,8 @@
</div>
</div>
<div id="tab-about" class="tab-panel" style="display:none;">
<template id="tmpl-about">
<div id="auth-badge" style="display:none; margin-bottom: 1rem; padding: 0.5rem; background: var(--bg-secondary); border-radius: 0.25rem; color: var(--text-muted); font-size: 0.85rem;">Authenticated as: <strong id="auth-role-badge">--</strong></div>
<template id="tmpl-about">
<div class="sub-tab-bar">
<button class="sub-tab active" data-subtab="about-server">Server</button>
<button class="sub-tab" data-subtab="about-client">Client</button>