[feat](trx-frontend-http): add guest button to auth gate

When RX access is unrestricted (no rx_passphrase required), show
a "Continue as Guest" button on the auth gate to allow immediate
access without requiring login. The button is only shown when guest
mode is available.

Guest mode:
- No authentication required
- Grants rx role immediately
- Can monitor radio but cannot transmit

Login path still available for full control access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-02-13 08:41:36 +01:00
parent 59ee8f5760
commit 599fa42bb3
2 changed files with 35 additions and 2 deletions
@@ -54,11 +54,17 @@ async function authLogout() {
}
}
function showAuthGate() {
function showAuthGate(allowGuest = false) {
document.getElementById("loading").style.display = "none";
document.getElementById("content").style.display = "none";
document.getElementById("auth-gate").style.display = "block";
document.getElementById("tab-bar").style.display = "none";
// Show guest button if guest mode is available
const guestBtn = document.getElementById("auth-guest-btn");
if (guestBtn) {
guestBtn.style.display = allowGuest ? "block" : "none";
}
}
function hideAuthGate() {
@@ -1150,6 +1156,15 @@ document.querySelector(".tab-bar").addEventListener("click", (e) => {
async function initializeApp() {
const authStatus = await checkAuthStatus();
if (authStatus.authenticated) {
// User has valid session
authRole = authStatus.role;
updateAuthUI();
applyAuthRestrictions();
connect();
resizeHeaderSignalCanvas();
startHeaderSignalSampling();
} else if (authStatus.role) {
// No session but role granted (guest mode available)
authRole = authStatus.role;
updateAuthUI();
applyAuthRestrictions();
@@ -1157,7 +1172,9 @@ async function initializeApp() {
resizeHeaderSignalCanvas();
startHeaderSignalSampling();
} else {
showAuthGate();
// Auth required - show login screen with optional guest button
const allowGuest = authStatus.role === "rx";
showAuthGate(allowGuest);
}
}
@@ -1188,6 +1205,21 @@ document.getElementById("auth-form").addEventListener("submit", async (e) => {
}
});
// Setup guest button
const guestBtn = document.getElementById("auth-guest-btn");
if (guestBtn) {
guestBtn.addEventListener("click", async () => {
authRole = "rx";
document.getElementById("auth-passphrase").value = "";
hideAuthGate();
updateAuthUI();
applyAuthRestrictions();
connect();
resizeHeaderSignalCanvas();
startHeaderSignalSampling();
});
}
// Setup logout button
document.getElementById("logout-btn").addEventListener("click", async () => {
if (confirm("Are you sure you want to logout?")) {
@@ -35,6 +35,7 @@
<input type="password" id="auth-passphrase" placeholder="Passphrase" autocomplete="off" style="width: 100%; padding: 0.5rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 0.25rem; background: var(--bg-secondary); color: var(--text); font-size: 1rem; box-sizing: border-box;" />
<button type="submit" style="width: 100%; padding: 0.5rem; background: var(--accent-green); color: var(--bg-primary); border: none; border-radius: 0.25rem; font-weight: 600; cursor: pointer; font-size: 1rem; box-sizing: border-box;">Login</button>
</form>
<button id="auth-guest-btn" type="button" style="width: 100%; padding: 0.5rem; background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); border-radius: 0.25rem; font-weight: 600; cursor: pointer; font-size: 1rem; box-sizing: border-box; margin-top: 0.5rem; display: none;">Continue as Guest</button>
<div id="auth-error" style="color: #ff6b6b; font-size: 0.9rem; margin-top: 1rem; display: none;"></div>
<div id="auth-role" style="margin-top: 1rem; color: var(--text-muted); font-size: 0.85rem; display: none;"></div>
</div>