diff --git a/app.js b/app.js index 6fde949..3fc6ff4 100644 --- a/app.js +++ b/app.js @@ -1,12 +1,3 @@ -// Reflector Dashboard — web front-end for SvxReflector -// Copyright (C) 2026 SA7AUX (Björn) -// SPDX-License-Identifier: AGPL-3.0-or-later -// -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU Affero General Public License as published by the Free -// Software Foundation, either version 3 of the License, or (at your option) any -// later version. See the LICENSE file for details. - 'use strict'; let lastNodes = {}; @@ -29,6 +20,7 @@ function setActive(panel){ const trkP = document.getElementById('trunksPanel'); const topP = document.getElementById('topologyPanel'); const lhP = document.getElementById('lastheardPanel'); + const lhLiveP = document.getElementById('lastheardLivePanel'); const ctcP = document.getElementById('ctcssPanel'); const chgP = document.getElementById('changelogPanel'); const tgmP = document.getElementById('tgmonPanel'); @@ -39,6 +31,7 @@ function setActive(panel){ if(trkP) trkP.style.display = (panel === 'trunks') ? 'block' : 'none'; if(topP) topP.style.display = (panel === 'topology') ? 'block' : 'none'; if(lhP) lhP.style.display = (panel === 'lastheard') ? 'block' : 'none'; + if(lhLiveP) lhLiveP.style.display = (panel === 'lastheardLive') ? 'block' : 'none'; if(ctcP) ctcP.style.display = (panel === 'ctcss') ? 'block' : 'none'; if(chgP) chgP.style.display = (panel === 'changelog') ? 'block' : 'none'; if(tgmP) tgmP.style.display = (panel === 'tgmon') ? 'block' : 'none'; @@ -70,6 +63,7 @@ function render(status){ if (document.getElementById('trunksPanel')?.style.display !== 'none') window.renderTrunks?.(lastStatus); if (document.getElementById('topologyPanel')?.style.display !== 'none') window.renderTopology?.(lastStatus); if (document.getElementById('lastheardPanel')?.style.display !== 'none') window.refreshLastheard?.(); + if (document.getElementById('lastheardLivePanel')?.style.display !== 'none') window.refreshLastheardLive?.(); if (document.getElementById('ctcssPanel')?.style.display !== 'none') window.renderCTCSS?.(lastStatus); if (document.getElementById('tgmonPanel')?.style.display !== 'none') window.renderTgMon?.(); } @@ -79,33 +73,6 @@ async function refresh(){ if(!j) return; lastUpdated = Date.now(); render(j); - applyFederationExtra(j); -} - -// On the AlabamaLink box fold the AlabamaLink line INTO the existing -// federation marquee so both scroll together in the one bar — same style, no -// second banner. Every other box keeps just the federation line. Gated on the -// local reflector identity from the status (KT4ROY / alabama.reflector-network.com), -// so it's a no-op everywhere else. -let _fedExtraDone = false; -function applyFederationExtra(status){ - if(_fedExtraDone) return; - const track = document.querySelector('#federationBanner .fed-track'); - if(!track) return; - const refs = (status && status.network && Array.isArray(status.network.reflectors)) ? status.network.reflectors : []; - const isAlabama = refs.some(r => r && r.self && ( - String(r.name || '').toUpperCase() === 'KT4ROY' || - /alabama\.reflector-network\.com/i.test(String(r.hostname || '') + ' ' + String(r.name || '')) - )); - if(!isAlabama) return; - _fedExtraDone = true; - const fed = 'Part of the reflector-network.com federation — a growing mesh of independent networks.'; - const ala = 'Powered by Executor — a multi-mode digital voice server, part of the AlabamaLink network.'; - const sep = ' • '; - const unit = fed + sep + ala; - const inner = document.createElement('span'); - inner.textContent = unit + sep + unit; // doubled so the loop stays seamless - track.replaceChildren(inner); } /* ===== Monitor submenu ===== */ @@ -123,6 +90,21 @@ document.addEventListener('click', (e) => { if(item && !item.contains(e.target)) closeMonitorSubMenu(); }); +/* ===== Last heard submenu ===== */ +function closeLastheardSubMenu(){ + const m = document.getElementById('lastheardSubMenu'); + if(m) m.style.display = 'none'; +} +function toggleLastheardSubMenu(){ + const m = document.getElementById('lastheardSubMenu'); + if(!m) return; + m.style.display = (m.style.display === 'none' || !m.style.display) ? 'block' : 'none'; +} +document.addEventListener('click', (e) => { + const item = document.getElementById('lastheardMenuItem'); + if(item && !item.contains(e.target)) closeLastheardSubMenu(); +}); + /* ===== Wire UI ===== */ document.getElementById('navList')?.addEventListener('click', (e) => { e.preventDefault(); @@ -172,6 +154,20 @@ document.getElementById('navMonitorTopology')?.addEventListener('click', (e) => document.getElementById('navLastheard')?.addEventListener('click', (e) => { e.preventDefault(); closeMonitorSubMenu(); + toggleLastheardSubMenu(); +}); + +document.getElementById('navLastheardLive')?.addEventListener('click', (e) => { + e.preventDefault(); + closeLastheardSubMenu(); + setNavActive('navLastheard'); + setActive('lastheardLive'); + window.refreshLastheardLive?.(); +}); + +document.getElementById('navLastheard24h')?.addEventListener('click', (e) => { + e.preventDefault(); + closeLastheardSubMenu(); setNavActive('navLastheard'); setActive('lastheard'); window.refreshLastheard?.(); @@ -202,7 +198,7 @@ document.getElementById('navTgmon')?.addEventListener('click', (e) => { }); /* ===== Remember the last view across reloads (Ctrl+Shift+R) ===== */ -const RESTORE_NAVS = ['navList','navClients','navMonitorNodes','navMonitorTrunks','navMonitorTopology','navTgmon','navLastheard','navCTCSS','navChangelog']; +const RESTORE_NAVS = ['navList','navClients','navMonitorNodes','navMonitorTrunks','navMonitorTopology','navTgmon','navLastheardLive','navLastheard24h','navCTCSS','navChangelog']; for (const id of RESTORE_NAVS) { document.getElementById(id)?.addEventListener('click', () => { try { localStorage.setItem('svxLastNav', id); } catch (_) {} }); } @@ -229,6 +225,8 @@ setInterval(() => { // keep Age ticking even without updates const sseTxt = document.getElementById('sseTxt'); function setSSE(state){ + window.__svxSSE = state; // read by the Live lastheard dot + window.updateLhLiveDot?.(); if(!sseTxt) return; sseTxt.textContent = "SSE: " + state; } diff --git a/auth/admin.js b/auth/admin.js index a5d7784..1556773 100644 --- a/auth/admin.js +++ b/auth/admin.js @@ -1,12 +1,3 @@ -// Reflector Dashboard — web front-end for SvxReflector -// Copyright (C) 2026 SA7AUX (Björn) -// SPDX-License-Identifier: AGPL-3.0-or-later -// -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU Affero General Public License as published by the Free -// Software Foundation, either version 3 of the License, or (at your option) any -// later version. See the LICENSE file for details. - 'use strict'; var LEVEL_LABELS = {1:'Normal', 2:'Admin', 3:'SuperAdmin'}; diff --git a/auth/admin.php b/auth/admin.php index e4c2543..40b812f 100644 --- a/auth/admin.php +++ b/auth/admin.php @@ -1,14 +1,4 @@ "]/g, function (c) { + return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); } + + function render(filter) { + var tb = document.querySelector('#lpTable tbody'); if (!tb) return; + filter = (filter || '').toLowerCase().trim(); + tb.innerHTML = ''; + rows.forEach(function (tg) { + if (filter && (tg.tg + ' ' + (tg.name || '')).toLowerCase().indexOf(filter) < 0) return; + var cur = tg.listen || 'free'; + var opts = LEVELS.map(function (l) { + return ''; + }).join(''); + var tr = document.createElement('tr'); + tr.innerHTML = '
| TG | Name | Access |
|---|