Compare commits

..
9 Commits
5 changed files with 233 additions and 119 deletions
+31 -13
View File
@@ -15,6 +15,10 @@ from services.mqtt_service import mqtt_publish
from services.push_service import node_allowed from services.push_service import node_allowed
from routes.auth_routes import get_auth, json_body, err from routes.auth_routes import get_auth, json_body, err
# --- AGGIUNTE PER GITEA BACKGROUND CHECK ---
GLOBAL_SERVER_UPDATE_AVAILABLE = False
LAST_GITEA_CHECK_TIME = 0
api_bp = Blueprint('api', __name__) api_bp = Blueprint('api', __name__)
# --- REGEX & COSTANTI COMANDI --- # --- REGEX & COSTANTI COMANDI ---
@@ -128,7 +132,7 @@ def get_stats():
top_tgs = [{"target": row[0], "count": row[1]} for row in c.fetchall()] top_tgs = [{"target": row[0], "count": row[1]} for row in c.fetchall()]
c.execute(f"""SELECT source_id, COUNT(*) as cnt FROM radio_logs c.execute(f"""SELECT source_id, COUNT(*) as cnt FROM radio_logs
WHERE source_id NOT LIKE '🌐%' WHERE source_id NOT LIKE '倹%'
AND timestamp >= date('now', 'localtime') AND timestamp < date('now', 'localtime', '+1 day'){node_filter} AND timestamp >= date('now', 'localtime') AND timestamp < date('now', 'localtime', '+1 day'){node_filter}
GROUP BY source_id ORDER BY cnt DESC LIMIT 5""", params) GROUP BY source_id ORDER BY cnt DESC LIMIT 5""", params)
top_calls = [{"call": row[0], "count": row[1]} for row in c.fetchall()] top_calls = [{"call": row[0], "count": row[1]} for row in c.fetchall()]
@@ -182,7 +186,7 @@ def cmd():
return err("Broker MQTT non raggiungibile - comando non inviato", 503) return err("Broker MQTT non raggiungibile - comando non inviato", 503)
audit(auth['username'], cid, cmd_type) audit(auth['username'], cid, cmd_type)
state.client_telemetry[cid] = {"ts1": "🔄 Inviato...", "ts2": "🔄 Inviato...", "alt": ""} state.client_telemetry[cid] = {"ts1": "売 Inviato...", "ts2": "売 Inviato...", "alt": ""}
return jsonify({"success": True}) return jsonify({"success": True})
@api_bp.route('/api/global_command', methods=['POST']) @api_bp.route('/api/global_command', methods=['POST'])
@@ -222,6 +226,9 @@ def service_control():
d = json_body() d = json_body()
cid = str(d.get('clientId', '')).strip().lower() cid = str(d.get('clientId', '')).strip().lower()
if not check_node_allowed(auth['allowed_nodes'], cid):
return err("Permesso negato per questo nodo", 403)
action = str(d.get('action', '')).strip().lower() action = str(d.get('action', '')).strip().lower()
service = str(d.get('service', '')).strip() service = str(d.get('service', '')).strip()
if not CID_RE.match(cid): if not CID_RE.match(cid):
@@ -243,7 +250,7 @@ def update_nodes():
return err("Non autorizzato", 403) return err("Non autorizzato", 403)
if not mqtt_publish("devices/control/request", "update"): if not mqtt_publish("devices/control/request", "update"):
return err("Broker MQTT non raggiungibile", 503) return err("Broker MQTT non raggiungibile", 503)
logger.info(f"📢 REQ CONFIG inviata a tutta la flotta da {auth['username']}") logger.info(f"討 REQ CONFIG inviata a tutta la flotta da {auth['username']}")
audit(auth['username'], '*', 'REQ_CONFIG_ALL') audit(auth['username'], '*', 'REQ_CONFIG_ALL')
return jsonify({"success": True}) return jsonify({"success": True})
@@ -319,6 +326,8 @@ def get_config_file(cid, service):
if not auth or auth['role'] != 'admin': if not auth or auth['role'] != 'admin':
return err("Non autorizzato", 403) return err("Non autorizzato", 403)
cid = cid.lower() cid = cid.lower()
if not check_node_allowed(auth['allowed_nodes'], cid):
return err("Permesso negato per questo nodo", 403)
service = service.lower() service = service.lower()
if not CID_RE.match(cid) or not SERVICE_RE.match(service): if not CID_RE.match(cid) or not SERVICE_RE.match(service):
return err("Parametri non validi") return err("Parametri non validi")
@@ -335,6 +344,9 @@ def save_config_file():
d = json_body() d = json_body()
cid = str(d.get('clientId', '')).strip().lower() cid = str(d.get('clientId', '')).strip().lower()
if not check_node_allowed(auth['allowed_nodes'], cid):
return err("Permesso negato per questo nodo", 403)
service = str(d.get('service', '')).strip().lower() service = str(d.get('service', '')).strip().lower()
new_config = d.get('config_data') new_config = d.get('config_data')
if not CID_RE.match(cid) or not SERVICE_RE.match(service): if not CID_RE.match(cid) or not SERVICE_RE.match(service):
@@ -357,20 +369,26 @@ def save_config_file():
# --- AGGIORNAMENTO SERVER OTA --- # --- AGGIORNAMENTO SERVER OTA ---
@api_bp.route('/api/server_update/check', methods=['GET']) @api_bp.route('/api/server_update/check', methods=['GET'])
def check_server_update(): def get_server_update_status():
global LAST_GITEA_CHECK_TIME, GLOBAL_SERVER_UPDATE_AVAILABLE
auth = get_auth() auth = get_auth()
if not auth or auth['role'] != 'admin': if not auth or auth['role'] != 'admin':
return err("Non autorizzato", 403) return err("Non autorizzato", 403)
try: force_check = request.args.get('force') == '1'
subprocess.run(['git', 'fetch'], timeout=10, cwd=BASE_DIR)
local_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=BASE_DIR).decode('utf-8').strip() # Eseguiamo il controllo sincrono se è passata 1 ora OPPURE se forzato dal client
remote_hash = subprocess.check_output(['git', 'rev-parse', '@{u}'], cwd=BASE_DIR).decode('utf-8').strip() if force_check or (time.time() - LAST_GITEA_CHECK_TIME > 3600):
update_available = local_hash != remote_hash try:
return jsonify({"success": True, "update_available": update_available}) subprocess.run(['git', 'fetch'], timeout=10, cwd=BASE_DIR)
except Exception as e: local_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=BASE_DIR).decode('utf-8').strip()
logger.error(f"Errore controllo aggiornamenti server: {e}") remote_hash = subprocess.check_output(['git', 'rev-parse', '@{u}'], cwd=BASE_DIR).decode('utf-8').strip()
return jsonify({"success": False, "error": "Impossibile verificare aggiornamenti"}) GLOBAL_SERVER_UPDATE_AVAILABLE = (local_hash != remote_hash)
LAST_GITEA_CHECK_TIME = time.time()
except Exception as e:
logger.error(f"Errore controllo Gitea: {e}")
return jsonify({"success": True, "update_available": GLOBAL_SERVER_UPDATE_AVAILABLE})
@api_bp.route('/api/server_update/apply', methods=['POST']) @api_bp.route('/api/server_update/apply', methods=['POST'])
def apply_server_update(): def apply_server_update():
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

+55 -28
View File
@@ -105,11 +105,14 @@ function openNodeFocus(clientId) {
document.getElementById('tab-aprs').classList.remove('active'); document.getElementById('tab-aprs').classList.remove('active');
document.getElementById('view-focus').style.display = 'block'; document.getElementById('view-focus').style.display = 'block';
window.scrollTo({ top: 0, behavior: 'smooth' }); window.scrollTo({ top: 0, behavior: 'smooth' });
const role = me.role || ''; const role = me.role || '';
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase())); let canControl = isAuthenticated && (allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
const modesCard = document.getElementById('focus-modes-card'); const modesCard = document.getElementById('focus-modes-card');
if (modesCard) { if (modesCard) {
@@ -168,10 +171,10 @@ function applyViewMode() {
const btnToggle = document.getElementById('view-toggle-btn'); const btnToggle = document.getElementById('view-toggle-btn');
if (viewMode === 'list') { if (viewMode === 'list') {
gridDiv.className = 'list-view'; gridDiv.className = 'list-view';
btnToggle.innerText = '[ LIST ]'; btnToggle.innerText = t('btnList') || '[ LIST ]';
} else { } else {
gridDiv.className = 'grid'; gridDiv.className = 'grid';
btnToggle.innerText = '[ GRID ]'; btnToggle.innerText = t('btnGrid') || '[ GRID ]';
} }
} }
@@ -287,7 +290,7 @@ function sendTgCommand(clientId, comando) {
async function fetchNodeConfigForModes(clientId) { async function fetchNodeConfigForModes(clientId) {
const role = me.role || ''; const role = me.role || '';
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase())); let canControl = isAuthenticated && (allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
const modesCard = document.getElementById('focus-modes-card'); const modesCard = document.getElementById('focus-modes-card');
if (!canControl) { if (!canControl) {
if (modesCard) modesCard.style.display = 'none'; if (modesCard) modesCard.style.display = 'none';
@@ -346,7 +349,7 @@ async function fetchNodeConfigForModes(clientId) {
function renderModeToggles(clientId, statusMsg = "") { function renderModeToggles(clientId, statusMsg = "") {
const role = me.role || ''; const role = me.role || '';
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase())); let canControl = isAuthenticated && (allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
const modesCard = document.getElementById('focus-modes-card'); const modesCard = document.getElementById('focus-modes-card');
if (modesCard) { if (modesCard) {
@@ -527,13 +530,22 @@ async function initUI() {
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
if (isAuthenticated) { if (isAuthenticated) {
let adminBtn = role === 'admin' ? ` const hasAllNodes = allowedList.includes('all');
<button id="server-update-btn" onclick="confirmServerUpdate()" class="auth-btn" style="border-color:var(--danger); color:var(--danger) !important; display:none;" title="Aggiornamento Server Disponibile">[ UPD_SERVER ]</button> const canOverride = hasAllNodes;
<button onclick="sendGlobalUpdate()" class="auth-btn" style="color:var(--accent);" data-i18n-title="ttReqCfg" title="${t('ttReqCfg')}">[ ${t('btnReqCfg')} ]</button>
<button onclick="triggerGlobalEmergency()" class="auth-btn" style="color:var(--danger);" data-i18n-title="ttGlobal" title="${t('ttGlobal')}">[ ${t('btnGlobal')} ]</button> let actionBtns = '';
<button onclick="openAdmin()" class="auth-btn" style="color:var(--primary);" data-i18n-title="ttAdmin" title="${t('ttAdmin')}">[ ${t('btnAdmin')} ]</button>` : ''; if (role === 'admin') {
actionBtns += `<button id="server-update-btn" onclick="confirmServerUpdate()" class="auth-btn" style="border-color:var(--danger); color:var(--danger) !important; display:none;" title="Aggiornamento Server Disponibile">[ UPD_SERVER ]</button>`;
actionBtns += `<button onclick="sendGlobalUpdate()" class="auth-btn" style="color:var(--accent);" data-i18n-title="ttReqCfg" title="${t('ttReqCfg')}">[ ${t('btnReqCfg')} ]</button>`;
}
if (canOverride) {
actionBtns += `<button onclick="triggerGlobalEmergency()" class="auth-btn" style="color:var(--danger);" data-i18n-title="ttGlobal" title="${t('ttGlobal')}">[ ${t('btnGlobal')} ]</button>`;
}
if (role === 'admin') {
actionBtns += `<button onclick="openAdmin()" class="auth-btn" style="color:var(--primary);" data-i18n-title="ttAdmin" title="${t('ttAdmin')}">[ ${t('btnAdmin')} ]</button>`;
}
authContainer.innerHTML = `${adminBtn} authContainer.innerHTML = `${actionBtns}
<span style="font-weight:300; font-size:0.85rem; margin: 0 10px; font-family:'JetBrains Mono', monospace; color:var(--primary);">USR: ${esc(String(me.user).toUpperCase())}</span> <span style="font-weight:300; font-size:0.85rem; margin: 0 10px; font-family:'JetBrains Mono', monospace; color:var(--primary);">USR: ${esc(String(me.user).toUpperCase())}</span>
<button onclick="changeMyPassword()" class="auth-btn" data-i18n-title="ttPass" title="${t('ttPass')}">[ ${t('btnPass')} ]</button> <button onclick="changeMyPassword()" class="auth-btn" data-i18n-title="ttPass" title="${t('ttPass')}">[ ${t('btnPass')} ]</button>
<button onclick="logout()" class="auth-btn" data-i18n-title="ttLogout" title="${t('ttLogout')}">[ ${t('btnLogout')} ]</button>`; <button onclick="logout()" class="auth-btn" data-i18n-title="ttLogout" title="${t('ttLogout')}">[ ${t('btnLogout')} ]</button>`;
@@ -542,8 +554,8 @@ async function initUI() {
} }
grid.innerHTML = clients.map(c => { grid.innerHTML = clients.map(c => {
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(c.id.toLowerCase())); let canControl = isAuthenticated && (allowedList.includes('all') || allowedList.includes(c.id.toLowerCase()));
let showReboot = (role === 'admin'); let showReboot = (role === 'admin' && canControl);
return ` return `
<div class="card" id="card-${c.id}" data-status="offline" data-gateways="" data-loc="" data-has-warn="false"> <div class="card" id="card-${c.id}" data-status="offline" data-gateways="" data-loc="" data-has-warn="false">
@@ -753,8 +765,8 @@ async function refreshStates() {
const role = me.role || ''; const role = me.role || '';
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(c.id.toLowerCase())); let canControl = isAuthenticated && (allowedList.includes('all') || allowedList.includes(c.id.toLowerCase()));
let showReboot = (role === 'admin'); let showReboot = (role === 'admin' && canControl);
let isTx = false; let isTx = false;
let activeModeColor = "var(--primary)"; let activeModeColor = "var(--primary)";
@@ -786,7 +798,22 @@ async function refreshStates() {
cardDiv.dataset.status = isOnline ? 'online' : 'offline'; cardDiv.dataset.status = isOnline ? 'online' : 'offline';
renderSeen(c, data, isOnline); renderSeen(c, data, isOnline);
const warns = (data.warnings && data.warnings[c.id.toLowerCase()]) || []; let warns = (data.warnings && data.warnings[c.id.toLowerCase()]) ? [...data.warnings[c.id.toLowerCase()]] : [];
let hasOfflineService = false;
if (healthObj && healthObj.processes) {
for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) {
let s = svcStatus.toLowerCase();
if (s !== 'online' && s !== 'standby') {
hasOfflineService = true;
warns.push(`SVC KO: ${svcName.toUpperCase()}`);
}
}
}
if (!latestStatesData.warnings) latestStatesData.warnings = {};
latestStatesData.warnings[c.id.toLowerCase()] = warns;
cardDiv.dataset.hasWarn = (warns.length > 0) ? 'true' : 'false'; cardDiv.dataset.hasWarn = (warns.length > 0) ? 'true' : 'false';
const diagDiv = document.getElementById(`diag-warn-${c.id}`); const diagDiv = document.getElementById(`diag-warn-${c.id}`);
if (diagDiv) { if (diagDiv) {
@@ -933,16 +960,7 @@ async function refreshStates() {
if (healthContainer) healthContainer.style.display = 'none'; if (healthContainer) healthContainer.style.display = 'none';
} }
// Logica tollerante per i Gateway in standby (spenti dalla UI) // Logica tollerante per i Gateway in standby (hasOfflineService calcolato in alto)
let hasOfflineService = false;
if (healthObj && healthObj.processes) {
for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) {
let s = svcStatus.toLowerCase();
if (s !== 'online' && s !== 'standby') {
hasOfflineService = true; break;
}
}
}
const warnBadge = document.getElementById(`svc-warn-${c.id}`); const btnSvc = document.getElementById(`btn-svc-${c.id}`); const warnBadge = document.getElementById(`svc-warn-${c.id}`); const btnSvc = document.getElementById(`btn-svc-${c.id}`);
if (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none'; if (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none';
if (btnSvc) { if (hasOfflineService) { btnSvc.style.borderColor = 'var(--danger)'; btnSvc.style.color = 'var(--danger)'; } else { btnSvc.style.borderColor = 'var(--text-main)'; btnSvc.style.color = 'var(--text-main)'; } } if (btnSvc) { if (hasOfflineService) { btnSvc.style.borderColor = 'var(--danger)'; btnSvc.style.color = 'var(--danger)'; } else { btnSvc.style.borderColor = 'var(--text-main)'; btnSvc.style.color = 'var(--text-main)'; } }
@@ -1367,9 +1385,18 @@ async function checkPushStatus() {
function urlB64ToUint8Array(base64String) { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/'); const rawData = window.atob(base64); const outputArray = new Uint8Array(rawData.length); for (let i = 0; i < rawData.length; ++i) outputArray[i] = rawData.charCodeAt(i); return outputArray; } function urlB64ToUint8Array(base64String) { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/'); const rawData = window.atob(base64); const outputArray = new Uint8Array(rawData.length); for (let i = 0; i < rawData.length; ++i) outputArray[i] = rawData.charCodeAt(i); return outputArray; }
async function checkServerUpdate() { async function checkServerUpdate(force = false) {
if (!isAuthenticated || me.role !== 'admin') return; if (!isAuthenticated || me.role !== 'admin') return;
try { const res = await fetch('/api/server_update/check'); const data = await res.json(); const btn = document.getElementById('server-update-btn'); if (btn) { btn.style.display = data.update_available ? 'inline-block' : 'none'; } } catch (e) { console.error(e); } try {
const url = force ? '/api/server_update/check?force=1' : '/api/server_update/check';
const res = await fetch(url);
if (!res.ok) return;
const data = await res.json();
const btn = document.getElementById('server-update-btn');
if (btn) {
btn.style.display = data.update_available ? 'inline-block' : 'none';
}
} catch (e) { console.error(e); }
} }
function confirmServerUpdate() { function confirmServerUpdate() {
+83 -31
View File
@@ -30,39 +30,59 @@ const i18n = {
ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG", ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG",
statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA", statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA",
statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS", statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS",
filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS" filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS",
fleetStatus: "[ FLEET_STATUS ]", aprsTraffic: "[ APRS_TRAFFIC ]", btnClear: "[ CLEAR ]", btnReturn: "[ < RETURN TO OVERVIEW ]",
hwTelemetry: "[ HARDWARE_TELEMETRY ]", rfConfig: "[ RF_CONFIGURATION ]", opModes: "[ OPERATING_MODES ]", actGateways: "[ ACTIVE_GATEWAYS ]",
tsModes: "[ TIMESLOTS_MODES ]", liveTerminal: "[ LIVE_TERMINAL ]", nodeLastheard: "[ NODE_LASTHEARD ]", adminControls: "[ ADMIN_CONTROLS ]",
cpuLoad: "CPU_LOAD:", sysTemp: "SYS_TEMP:", ramUsage: "RAM_USAGE:", diskSpace: "DISK_SPACE:", sysUptime: "UPTIME:",
txFreq: "TX_FREQ:", rxFreq: "RX_FREQ:", nodeLoc: "LOCATION:",
statusOffline: "OFFLINE", statusAlert: "(!) ALERT", awaitingStream: "> AWAITING_STREAM...", focusNode: "FOCUS_NODE", noActiveGw: "NO_ACTIVE_GATEWAYS",
lblSysUptime: "System Uptime", lblSwVersions: "Software Versions", lblOtaUpdate: "OTA Update", waitConfig: "WAITING FOR CONFIG...",
noDaemonData: "NO DAEMON DATA YET. RETRYING...", cfgEmpty: "[!] CFG MEMORY EMPTY", netError: "NETWORK ERROR", noModesFound: "NO MODES FOUND IN CONFIG",
accessDenied: "[ ACCESS DENIED ]", savingRestart: "⏳ SAVING & RESTARTING...", stateUpdated: "✅ STATE UPDATED SUCCESSFULLY!",
phSearch: "SEARCH ID/CALL...", btnGrid: "[ GRID ]", btnList: "[ LIST ]"
}, },
it: { it: {
lblLogLimit: "Righe:", lblLogLimit: "Righe:",
lastTransits: "Ultimi ascolti", loginTitle: "SYSTEM_LOGIN", lastTransits: "Ultimi ascolti", loginTitle: "ACCESSO SISTEMA",
thTime: "Ora", thRep: "Ripetitore", thMode: "Modo", thCall: "Nominativo", thDur: "Durata", thTime: "Ora", thRep: "Ripetitore", thMode: "Modo", thCall: "Nominativo", thDur: "Durata",
thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni", thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni",
btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT", btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "ESCI",
btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD", btnSvc: "SERVIZI", btnFile: "CFG", btnBoot: "RIAVVIA", btnAdd: "AGGIUNGI",
waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "FORCE_UPD", waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "FORZA AGGIORNAMENTO",
adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Orario Aggiornamento:", adminSave: "SAVE_CFG", roleOp: "Operatore", adminTitle: "AMMINISTRAZIONE SISTEMA", adminDBSync: "SINCRONIZZAZIONE DB", adminTime: "Orario Aggiornamento:", adminSave: "SALVA CONFIG", roleOp: "Operatore",
modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:", modSvcTitle: "DEMONI:", modFileTitle: "FILE CONFIGURAZIONE", modEditTitle: "MODIFICA:",
warnEdit: "[WARN] DIRECT EDIT ACTIVE", warnEdit: "[ATTENZIONE] MODIFICA DIRETTA ATTIVA",
btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE", btnEdit: "MODIFICA", btnStart: "AVVIA", btnRestart: "RIAVVIA", btnStop: "FERMA", btnSave: "SALVA FILE",
btnHat: "RST_HAT", confHat: "PHYSICAL RESET MMDVM ON: ", btnHat: "RESET HAT", confHat: "Reset hardware modem MMDVM su: ",
confOta: "ESEGUIRE GIT PULL SUL NODO ", confOta: "Eseguire git pull sul nodo ",
confOp: "Confermi l'operazione su ", confTgOn: "Vuoi ATTIVARE le notifiche Telegram per il nodo ", confTgOff: "Vuoi SILENZIARE le notifiche Telegram per il nodo ", confOvr: "Sei sicuro di voler sovrascrivere il file su ", confOp: "Confermi l'operazione su ", confTgOn: "Vuoi ATTIVARE le notifiche Telegram per il nodo ", confTgOff: "Vuoi SILENZIARE le notifiche Telegram per il nodo ", confOvr: "Sei sicuro di voler sovrascrivere il file su ",
warnDaemon: "[WARN] DAEMON OFFLINE", warnDaemon: "[ATTENZIONE] DEMONE OFFLINE",
promptOvr: "GBL_OVR", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?", promptOvr: "OVERRIDE GLOBALE", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?",
modUpdateTitle: "GBL_UPDATE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "ACK", modUpdateTitle: "AGGIORNAMENTO FLOTTA", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "CONFERMATO",
btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:", btnConfReset: "CONFERMA", btnCancel: "ANNULLA", promptPass: "NUOVA PASSWORD:",
titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR", titleError: "ERRORE", titleSuccess: "OK", titleAction: "CONFERMA", titleDelete: "ELIMINA UTENTE", titleSave: "SALVA", titleGlobal: "OVERRIDE GLOBALE",
btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL", btnYes: "ESEGUI", msgDelUser: "Eliminare definitivamente l'utente?", msgPassOk: "PASSWORD AGGIORNATA", msgPassErr: "ERRORE AGGIORNAMENTO PASSWORD", msgLoginFail: "CREDENZIALI NON VALIDE",
msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:", msgConfigSaved: "CONFIGURAZIONE SALVATA", msgConfigErr: "ERRORE SALVATAGGIO CONFIG", msgNetErr: "ERRORE DI RETE", msgOvrSel: "SELEZIONA PROFILO:",
msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR", msgOvrOk: "COMANDO INVIATO ALLA RETE", msgMissUser: "SPECIFICARE NOME UTENTE", msgMissPass: "SPECIFICARE PASSWORD", btnSvcKo: "ERRORE DEMONE",
phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD", phNewPass: "NUOVA PWD (VUOTA = INVARIATA)", phPass: "PASSWORD",
titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "REBOOT NODE ", titleSwitch: "CAMBIO PROFILO", confSwitch: "Passa al profilo ", titleBoot: "RIAVVIO NODO", confBoot: "Riavviare il nodo ",
ttReqCfg: "REQ_DATA", ttGlobal: "GBL_OVR", ttAdmin: "ADMIN", ttPass: "CHG_PWD", ttLogout: "LOGOUT", ttReqCfg: "Richiedi dati nodi", ttGlobal: "Override globale profili", ttAdmin: "Pannello amministrazione", ttPass: "Cambia password", ttLogout: "Disconnetti",
ttProfA: "Passa al Profilo A", ttProfB: "Passa al Profilo B", ttTgOn: "Abilita notifiche Telegram", ttTgOff: "Disabilita notifiche Telegram", ttSvc: "Gestisci demoni di sistema", ttFile: "Modifica file .ini da remoto", ttHat: "Reset fisico scheda modem", ttBoot: "Riavvia sistema operativo", ttProfA: "Passa al Profilo A", ttProfB: "Passa al Profilo B", ttTgOn: "Abilita notifiche Telegram", ttTgOff: "Disabilita notifiche Telegram", ttSvc: "Gestisci demoni di sistema", ttFile: "Modifica file .ini da remoto", ttHat: "Reset fisico scheda modem", ttBoot: "Riavvia sistema operativo",
ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG", ttSwitchTo: "Passa a: ", ttSvcStart: "Avvia demone", ttSvcRestart: "Riavvia demone", ttSvcEdit: "Modifica configurazione", ttSvcStop: "Arresta demone", ttLang: "Lingua",
statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA", statTopTG: "TOP TALKGROUP", statTopCall: "TOP NOMINATIVI", statLoading: "CARICAMENTO...", statAvgDur: "DURATA MEDIA", statTodayTx: "PASSAGGI OGGI", statNoData: "NESSUN DATO",
statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS", statTitle: "STATISTICHE GIORNALIERE", statAllNodes: "TUTTI I NODI", modVersions: "VERSIONI SOFTWARE",
filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS" filtAll: "TUTTI I NODI", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "AVVISI",
fleetStatus: "[ STATO FLOTTA ]", aprsTraffic: "[ TRAFFICO APRS ]", btnClear: "[ PULISCI ]", btnReturn: "[ < TORNA ALLA DASHBOARD ]",
hwTelemetry: "[ TELEMETRIA HARDWARE ]", rfConfig: "[ CONFIGURAZIONE RF ]", opModes: "[ MODI OPERATIVI ]", actGateways: "[ GATEWAY ATTIVI ]",
tsModes: "[ TIMESLOT E MODI ]", liveTerminal: "[ TERMINALE LIVE ]", nodeLastheard: "[ ULTIMI ASCOLTI NODO ]", adminControls: "[ CONTROLLI AMMINISTRATORE ]",
cpuLoad: "CARICO CPU:", sysTemp: "TEMP. SIS:", ramUsage: "UTILIZZO RAM:", diskSpace: "SPAZIO DISCO:", sysUptime: "ATTIVITÀ:",
txFreq: "FREQ. TX:", rxFreq: "FREQ. RX:", nodeLoc: "POSIZIONE:",
statusOffline: "OFFLINE", statusAlert: "(!) AVVISO", awaitingStream: "> IN ATTESA DI FLUSSO DATI...", focusNode: "DETTAGLI NODO", noActiveGw: "NESSUN GATEWAY ATTIVO",
lblSysUptime: "Tempo di attività sistema", lblSwVersions: "Versioni Software", lblOtaUpdate: "Aggiornamento OTA", waitConfig: "IN ATTESA DELLA CONFIGURAZIONE...",
noDaemonData: "NESSUN DATO DAL DEMONE. RETENTATIVO...", cfgEmpty: "[!] MEMORIA CFG VUOTA", netError: "ERRORE DI RETE", noModesFound: "NESSUN MODO TROVATO NELLA CONFIGURAZIONE",
accessDenied: "[ ACCESSO NEGATO ]", savingRestart: "⏳ SALVATAGGIO & RIAVVIO IN CORSO...", stateUpdated: "✅ STATO AGGIORNATO CON SUCCESSO!",
phSearch: "CERCA ID/CALL...", btnGrid: "[ GRIGLIA ]", btnList: "[ LISTA ]"
} }
}; };
@@ -82,8 +102,13 @@ function applyTranslations() {
if (i18n[currentLang][key]) el.title = i18n[currentLang][key]; if (i18n[currentLang][key]) el.title = i18n[currentLang][key];
}); });
const newPassInput = document.getElementById('new-pass'); const newPassInput = document.getElementById('new-pass');
if (newPassInput && editingUserId) newPassInput.placeholder = t('phNewPass'); if (newPassInput && typeof editingUserId !== 'undefined' && editingUserId) newPassInput.placeholder = t('phNewPass');
else if (newPassInput) newPassInput.placeholder = t('phPass'); else if (newPassInput) newPassInput.placeholder = t('phPass');
const searchInput = document.getElementById('node-search');
if (searchInput) searchInput.placeholder = t('phSearch') || 'SEARCH ID/CALL...';
if (typeof applyViewMode === 'function') applyViewMode();
} }
function esc(s) { return String(s ?? '').replace(/[&<>"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c])); } function esc(s) { return String(s ?? '').replace(/[&<>"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c])); }
@@ -205,8 +230,13 @@ async function saveSettings() {
// --- GLOBAL OVERRIDE --- // --- GLOBAL OVERRIDE ---
function triggerGlobalEmergency() { function triggerGlobalEmergency() {
const role = me.role || '';
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
const hasAll = allowedList.includes('all');
let uniqueProfiles = {}; let uniqueProfiles = {};
for (const id in globalHealthData) { for (const id in globalHealthData) {
if (!hasAll && !allowedList.includes(id.toLowerCase())) continue;
if (globalHealthData[id] && globalHealthData[id].profiles) { if (globalHealthData[id] && globalHealthData[id].profiles) {
for (const [k, v] of Object.entries(globalHealthData[id].profiles)) { uniqueProfiles[k] = v; } for (const [k, v] of Object.entries(globalHealthData[id].profiles)) { uniqueProfiles[k] = v; }
} }
@@ -218,14 +248,36 @@ function triggerGlobalEmergency() {
idx++; idx++;
} }
if (Object.keys(uniqueProfiles).length === 0) { html = `<p style="color:var(--danger); font-weight:400; font-family:'JetBrains Mono',monospace;">NO_PROFS_FOUND</p>`; } if (Object.keys(uniqueProfiles).length === 0) { html = `<p style="color:var(--danger); font-weight:400; font-family:'JetBrains Mono',monospace;">NO_PROFS_FOUND</p>`; }
container.innerHTML = html; document.getElementById('override-desc').innerText = t('msgOvrSel'); document.getElementById('override-modal').style.display = 'flex'; container.innerHTML = html;
const descText = hasAll ? t('msgOvrSel') : (currentLang === 'it' ? `SELEZIONA PROFILO (NODI ASSEGNATI: ${allowedList.length}):` : `SELECT PROFILE (NODES: ${allowedList.length}):`);
document.getElementById('override-desc').innerText = descText;
document.getElementById('override-modal').style.display = 'flex';
} }
function sendGlobalAction(action) { function sendGlobalAction(action) {
document.getElementById('override-modal').style.display = 'none'; document.getElementById('override-modal').style.display = 'none';
customConfirm(t('titleGlobal'), t('promptOvrConfirm'), "var(--danger)", async () => { const role = me.role || '';
try { const res = await fetch('/api/global_command', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({type: action}) }); const d = await res.json(); const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
if(d.success) customAlert(t('titleSuccess'), t('msgOvrOk')); else customAlert(t('titleError'), esc(d.error), true); refreshStates(); const hasAll = allowedList.includes('all');
const confirmMsg = hasAll
? t('promptOvrConfirm')
: (currentLang === 'it'
? `Confermi l'invio ai tuoi nodi autorizzati (${allowedList.map(n => n.toUpperCase()).join(', ')})?`
: `Confirm sending to your authorized nodes (${allowedList.map(n => n.toUpperCase()).join(', ')})?`);
customConfirm(t('titleGlobal'), confirmMsg, "var(--danger)", async () => {
try {
const res = await fetch('/api/global_command', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({type: action})
});
const d = await res.json();
if(d.success) customAlert(t('titleSuccess'), t('msgOvrOk'));
else customAlert(t('titleError'), esc(d.error), true);
refreshStates();
} catch(e) { console.error(e); } } catch(e) { console.error(e); }
}); });
} }
+64 -47
View File
@@ -25,31 +25,45 @@
</head> </head>
<body> <body>
<div id="top-bar-container"> <div id="top-bar-container" style="border-bottom: 2px solid var(--border-main); background: var(--bg-main, #04102e);">
<div id="top-bar"> <div id="top-bar" style="display: flex; justify-content: space-between; align-items: stretch; padding: 0; min-height: 90px; flex-wrap: wrap;">
<div class="brand-container" style="display: flex; flex-direction: column; justify-content: center; align-items: flex-start;">
<div class="title-brand" style="line-height: 1.1; padding-bottom: 2px;">SCHEMATIC // FLEET C2</div>
<div id="live-clock" style="font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-muted); letter-spacing: 1px; padding-left: 2px;">SYS_TIME: --:--:--</div>
</div>
<div class="nav-tabs"> <!-- HEADER SX: BANNER CON RIEMPIMENTO ASSOLUTO A FILO -->
<button class="nav-tab active" onclick="switchView('home')" id="tab-home">HOME</button> <div id="master-banner-container" style="display: none; flex: 0 0 45%; max-width: 45%; border-right: 2px solid var(--border-main); background: #020b1e; align-items: stretch; justify-content: stretch; padding: 0; box-sizing: border-box; overflow: hidden;">
<button class="nav-tab" onclick="switchView('nodes')" id="tab-nodes">NODES</button> <img src="/static/banners/banner.png" style="width: 100%; height: 100%; object-fit: cover; object-position: center; display: block;"
<button class="nav-tab" onclick="switchView('map')" id="tab-map">MAP</button> onload="this.parentElement.style.display='flex';"
<button class="nav-tab" onclick="switchView('aprs')" id="tab-aprs">APRS</button> onerror="this.parentElement.style.display='none';">
</div> </div>
<div class="top-bar-right"> <!-- HEADER DX: STRUTTURA FLUIDA A 3 RIGHE -->
<span id="mqtt-badge" class="mqtt-badge mqtt-offline">MQTT: CHK</span> <div id="header-right-controls" style="flex: 1; display: flex; flex-direction: column; gap: 10px; justify-content: center; padding: 12px 20px; box-sizing: border-box; background: rgba(0, 15, 45, 0.25); min-width: 350px;">
<button class="theme-switch" id="layout-btn" onclick="cycleLayout()" title="Cambia Layout">[ L: BLU ]</button>
<button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang">ITA</button> <!-- RIGA 1: BRAND E OROLOGIO -->
<button class="theme-switch" id="push-btn" onclick="subscribeToPush()">PUSH</button> <div style="display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; border-bottom: 1px dashed var(--border-light, rgba(255,255,255,0.15)); padding-bottom: 4px;">
<div id="auth-container" style="display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end;"></div> <span class="title-brand" style="font-size: 1.15rem; font-weight: 700; letter-spacing: 2px; color: var(--text-main);">SCHEMATIC // FLEET C2</span>
<span id="live-clock" style="font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--primary); letter-spacing: 1px;">SYS_TIME: --:--:--</span>
</div>
<!-- RIGA 2: TASTI DI NAVIGAZIONE -->
<div class="nav-tabs" style="display: flex; flex-wrap: wrap; gap: 8px; border: none; margin: 0; padding: 0; width: 100%;">
<button class="nav-tab active" onclick="switchView('home')" id="tab-home" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">HOME</button>
<button class="nav-tab" onclick="switchView('nodes')" id="tab-nodes" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">NODES</button>
<button class="nav-tab" onclick="switchView('map')" id="tab-map" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">MAP</button>
<button class="nav-tab" onclick="switchView('aprs')" id="tab-aprs" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">APRS</button>
</div>
<!-- RIGA 3: BADGES E TASTI ADMIN -->
<div class="top-bar-right" style="display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; border: none; margin: 0; padding: 0; width: 100%;">
<span id="mqtt-badge" class="mqtt-badge mqtt-offline" style="padding: 4px 10px; font-size: 0.75rem; font-weight: bold; letter-spacing: 1px;">MQTT: CHK</span>
<button class="theme-switch" id="layout-btn" onclick="cycleLayout()" title="Cambia Layout" style="padding: 4px 10px; font-size: 0.75rem;">[ L: BLU ]</button>
<button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang" style="padding: 4px 10px; font-size: 0.75rem;">ITA</button>
<button class="theme-switch" id="push-btn" onclick="subscribeToPush()" style="padding: 4px 10px; font-size: 0.75rem;">PUSH</button>
<div id="auth-container" style="display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end;"></div>
</div>
</div> </div>
</div> </div>
</div> </div><!-- VISTA FLEET MAP -->
<!-- VISTA FLEET MAP -->
<div id="view-map" style="display: none; padding: 0 20px;"> <div id="view-map" style="display: none; padding: 0 20px;">
<div id="map-container"></div> <div id="map-container"></div>
</div> </div>
@@ -58,8 +72,8 @@
<div id="view-aprs" style="display: none;"> <div id="view-aprs" style="display: none;">
<div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;">
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--border-main); padding-bottom: 5px; margin-bottom: 15px;"> <div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--border-main); padding-bottom: 5px; margin-bottom: 15px;">
<h3 style="margin: 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main);">[ APRS_TRAFFIC ]</h3> <h3 style="margin: 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main);"><span data-i18n="aprsTraffic">[ APRS_TRAFFIC ]</span></h3>
<button class="btn-cmd" onclick="document.getElementById('aprs-body').innerHTML='';" style="width: auto; padding: 4px 12px; flex: none;">[ CLEAR ]</button> <button class="btn-cmd" onclick="document.getElementById('aprs-body').innerHTML='';" style="width: auto; padding: 4px 12px; flex: none;"><span data-i18n="btnClear">[ CLEAR ]</span></button>
</div> </div>
<div class="table-container" style="max-height: calc(100vh - 200px);"> <div class="table-container" style="max-height: calc(100vh - 200px);">
<table> <table>
@@ -83,7 +97,7 @@
<div style="max-width: 1400px; margin: 0 auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto; padding: 0 20px;">
<!-- Header Ritorno e Titolo --> <!-- Header Ritorno e Titolo -->
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 2px dashed var(--border-main); padding-bottom: 15px; margin-bottom: 25px; flex-wrap: wrap; gap: 15px;"> <div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 2px dashed var(--border-main); padding-bottom: 15px; margin-bottom: 25px; flex-wrap: wrap; gap: 15px;">
<button class="btn-cmd" style="width: auto; padding: 12px 25px; font-size: 1.1rem; border-color: var(--accent); color: var(--accent) !important;" onclick="closeNodeFocus()">[ < RETURN TO OVERVIEW ]</button> <button class="btn-cmd" style="width: auto; padding: 12px 25px; font-size: 1.1rem; border-color: var(--accent); color: var(--accent) !important;" onclick="closeNodeFocus()"><span data-i18n="btnReturn">[ < RETURN TO OVERVIEW ]</span></button>
<div style="text-align: right; flex-grow: 1;"> <div style="text-align: right; flex-grow: 1;">
<h2 id="focus-name" style="margin: 0; color: var(--text-main); font-weight: 300; font-size: 2.5rem; letter-spacing: 2px; display: flex; align-items: center; justify-content: flex-end; gap: 15px;">--</h2> <h2 id="focus-name" style="margin: 0; color: var(--text-main); font-weight: 300; font-size: 2.5rem; letter-spacing: 2px; display: flex; align-items: center; justify-content: flex-end; gap: 15px;">--</h2>
<div id="focus-id" style="color: var(--primary); font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; margin-top: 5px;">--</div> <div id="focus-id" style="color: var(--primary); font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; margin-top: 5px;">--</div>
@@ -91,31 +105,32 @@
</div> </div>
</div> </div>
<!-- BANNER PERSONALIZZATO -->
<div class="grid" style="grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));"> <div class="grid" style="grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));">
<!-- COLONNA SX: HARDWARE E RF --> <!-- COLONNA SX: HARDWARE E RF -->
<div style="display: flex; flex-direction: column; gap: 20px;"> <div style="display: flex; flex-direction: column; gap: 20px;">
<div class="card" style="border-width: 1px !important;"> <div class="card" style="border-width: 1px !important;">
<h3 style="margin: 0 0 20px 0; color: var(--accent); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ HARDWARE_TELEMETRY ]</h3> <h3 style="margin: 0 0 20px 0; color: var(--accent); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="hwTelemetry">[ HARDWARE_TELEMETRY ]</span></h3>
<div style="font-size: 1.2rem; font-family: 'JetBrains Mono', monospace; display: flex; flex-direction: column; gap: 15px;"> <div style="font-size: 1.2rem; font-family: 'JetBrains Mono', monospace; display: flex; flex-direction: column; gap: 15px;">
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>CPU_LOAD:</span> <span id="focus-cpu">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="cpuLoad">CPU_LOAD:</span></span> <span id="focus-cpu">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>SYS_TEMP:</span> <span id="focus-temp">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="sysTemp">SYS_TEMP:</span></span> <span id="focus-temp">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>RAM_USAGE:</span> <span id="focus-ram">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="ramUsage">RAM_USAGE:</span></span> <span id="focus-ram">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>DISK_SPACE:</span> <span id="focus-disk">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="diskSpace">DISK_SPACE:</span></span> <span id="focus-disk">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>UPTIME:</span> <span id="focus-up">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="sysUptime">UPTIME:</span></span> <span id="focus-up">--</span></div>
</div> </div>
</div> </div>
<div class="card" style="border-width: 1px !important;"> <div class="card" style="border-width: 1px !important;">
<h3 style="margin: 0 0 20px 0; color: var(--primary); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ RF_CONFIGURATION ]</h3> <h3 style="margin: 0 0 20px 0; color: var(--primary); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="rfConfig">[ RF_CONFIGURATION ]</span></h3>
<div style="font-size: 1.2rem; font-family: 'JetBrains Mono', monospace; display: flex; flex-direction: column; gap: 15px;"> <div style="font-size: 1.2rem; font-family: 'JetBrains Mono', monospace; display: flex; flex-direction: column; gap: 15px;">
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>TX_FREQ:</span> <span id="focus-tx" style="color: var(--danger);">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="txFreq">TX_FREQ:</span></span> <span id="focus-tx" style="color: var(--danger);">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>RX_FREQ:</span> <span id="focus-rx" style="color: var(--success);">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="rxFreq">RX_FREQ:</span></span> <span id="focus-rx" style="color: var(--success);">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>LOCATION:</span> <span id="focus-loc" style="color: var(--text-main);">--</span></div> <div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span><span data-i18n="nodeLoc">LOCATION:</span></span> <span id="focus-loc" style="color: var(--text-main);">--</span></div>
</div> </div>
</div> </div>
<div class="card" id="focus-modes-card" style="border-width: 1px !important; display: none;"> <div class="card" id="focus-modes-card" style="border-width: 1px !important; display: none;">
<h3 style="margin: 0 0 15px 0; color: #fff; font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ OPERATING_MODES ]</h3> <h3 style="margin: 0 0 15px 0; color: #fff; font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="opModes">[ OPERATING_MODES ]</span></h3>
<div id="focus-modes-toggles" style="display: flex; flex-wrap: wrap; gap: 10px; font-family: 'JetBrains Mono', monospace;"> <div id="focus-modes-toggles" style="display: flex; flex-wrap: wrap; gap: 10px; font-family: 'JetBrains Mono', monospace;">
<span style="color:var(--text-muted); font-size: 0.9rem;">WAITING FOR CONFIG...</span> <span style="color:var(--text-muted); font-size: 0.9rem;">WAITING FOR CONFIG...</span>
</div> </div>
@@ -125,13 +140,13 @@
<!-- COLONNA DX: SOFTWARE E LOG --> <!-- COLONNA DX: SOFTWARE E LOG -->
<div style="display: flex; flex-direction: column; gap: 20px;"> <div style="display: flex; flex-direction: column; gap: 20px;">
<div class="card" style="border-width: 1px !important; flex: 1;"> <div class="card" style="border-width: 1px !important; flex: 1;">
<h3 style="margin: 0 0 20px 0; color: var(--success); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ ACTIVE_GATEWAYS ]</h3> <h3 style="margin: 0 0 20px 0; color: var(--success); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="actGateways">[ ACTIVE_GATEWAYS ]</span></h3>
<div id="focus-gw" style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; min-height: 40px; font-size: 0.9rem;"></div> <div id="focus-gw" style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; min-height: 40px; font-size: 0.9rem;"></div>
<h3 style="margin: 0 0 20px 0; color: var(--primary); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ TIMESLOTS_MODES ]</h3> <h3 style="margin: 0 0 20px 0; color: var(--primary); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="tsModes">[ TIMESLOTS_MODES ]</span></h3>
<div id="focus-ts" style="display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px; font-family: 'JetBrains Mono', monospace; font-size: 1.2rem;"></div> <div id="focus-ts" style="display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px; font-family: 'JetBrains Mono', monospace; font-size: 1.2rem;"></div>
<h3 style="margin: 0 0 15px 0; color: var(--border-main); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ LIVE_TERMINAL ]</h3> <h3 style="margin: 0 0 15px 0; color: var(--border-main); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="liveTerminal">[ LIVE_TERMINAL ]</span></h3>
<div id="focus-log" class="terminal-log" style="height: 320px; max-height: 320px; font-size: 0.95rem; border-color: var(--border-main);">> AWAITING_STREAM...</div> <div id="focus-log" class="terminal-log" style="height: 320px; max-height: 320px; font-size: 0.95rem; border-color: var(--border-main);">> AWAITING_STREAM...</div>
</div> </div>
</div> </div>
@@ -139,7 +154,7 @@
<!-- FOCUS LASTHEARD --> <!-- FOCUS LASTHEARD -->
<div style="margin-top: 30px; border-top: 1px dashed var(--border-light); padding-top: 20px;"> <div style="margin-top: 30px; border-top: 1px dashed var(--border-light); padding-top: 20px;">
<h3 style="margin: 0 0 15px 0; color: var(--text-main); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ NODE_LASTHEARD ]</h3> <h3 style="margin: 0 0 15px 0; color: var(--text-main); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;"><span data-i18n="nodeLastheard">[ NODE_LASTHEARD ]</span></h3>
<div class="table-container" style="margin: 0; max-height: 400px;"> <div class="table-container" style="margin: 0; max-height: 400px;">
<table> <table>
<thead> <thead>
@@ -164,7 +179,7 @@
<!-- CONTROLLI ADMIN DEL NODO --> <!-- CONTROLLI ADMIN DEL NODO -->
<div id="focus-controls" style="display: none; margin-top: 30px; border: 1px dashed var(--danger); padding: 30px; background: rgba(6, 36, 111, 0.6); backdrop-filter: blur(2px);"> <div id="focus-controls" style="display: none; margin-top: 30px; border: 1px dashed var(--danger); padding: 30px; background: rgba(6, 36, 111, 0.6); backdrop-filter: blur(2px);">
<h3 style="margin: 0 0 20px 0; color: var(--danger); font-weight: 300; font-size: 1.5rem; text-align: center; letter-spacing: 2px;">[ ADMIN_CONTROLS ]</h3> <h3 style="margin: 0 0 20px 0; color: var(--danger); font-weight: 300; font-size: 1.5rem; text-align: center; letter-spacing: 2px;"><span data-i18n="adminControls">[ ADMIN_CONTROLS ]</span></h3>
<div id="focus-admin-btns" style="display: flex; gap: 15px; flex-wrap: wrap; justify-content: center;"> <div id="focus-admin-btns" style="display: flex; gap: 15px; flex-wrap: wrap; justify-content: center;">
</div> </div>
</div> </div>
@@ -199,8 +214,10 @@
<!-- VISTA HOME --> <!-- VISTA HOME -->
<div id="view-home"> <div id="view-home">
<div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;">
<h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;"> <h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
[ FLEET_STATUS ] <span data-i18n="fleetStatus">[ FLEET_STATUS ]</span>
</h3> </h3>
<div id="home-mini-nodes" style="display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;"></div> <div id="home-mini-nodes" style="display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;"></div>
</div> </div>
@@ -246,27 +263,27 @@
</div> </div>
<div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;">
<h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;" data-i18n="statTitle">[ DAILY_STATISTICS ]</h3> <h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;" data-i18n="statTitle">[ <span data-i18n="statTitle">DAILY_STATISTICS</span> ]</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;"> <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;">
<div class="card" style="border-left: 1px solid var(--accent) !important; padding: 15px;"> <div class="card" style="border-left: 1px solid var(--accent) !important; padding: 15px;">
<h4 style="margin: 0 0 10px 0; color: var(--accent); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopTG">TOP_TALKGROUPS</h4> <h4 style="margin: 0 0 10px 0; color: var(--accent); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopTG"><span data-i18n="statTopTG">TOP_TALKGROUPS</span></h4>
<div id="stat-tgs" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">LOADING...</div> <div id="stat-tgs" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading"><span data-i18n="statLoading">LOADING...</span></div>
</div> </div>
<div class="card" style="border-left: 1px solid var(--success) !important; padding: 15px;"> <div class="card" style="border-left: 1px solid var(--success) !important; padding: 15px;">
<h4 style="margin: 0 0 10px 0; color: var(--success); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopCall">TOP_CALLSIGNS</h4> <h4 style="margin: 0 0 10px 0; color: var(--success); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopCall"><span data-i18n="statTopCall">TOP_CALLSIGNS</span></h4>
<div id="stat-calls" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">LOADING...</div> <div id="stat-calls" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading"><span data-i18n="statLoading">LOADING...</span></div>
</div> </div>
<div class="card" style="border-left: 1px solid var(--primary) !important; padding: 15px; display: flex; justify-content: space-around; align-items: center; text-align: center; flex-direction: row;"> <div class="card" style="border-left: 1px solid var(--primary) !important; padding: 15px; display: flex; justify-content: space-around; align-items: center; text-align: center; flex-direction: row;">
<div> <div>
<div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-avg">--</span>s</div> <div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-avg">--</span>s</div>
<div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statAvgDur">AVG_DURATION</div> <div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statAvgDur"><span data-i18n="statAvgDur">AVG_DURATION</span></div>
</div> </div>
<div style="width: 1px; height: 50px; border-left: 1px dashed var(--border-light);"></div> <div style="width: 1px; height: 50px; border-left: 1px dashed var(--border-light);"></div>
<div> <div>
<div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-today">--</span></div> <div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-today">--</span></div>
<div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statTodayTx">TRANSITS_TODAY</div> <div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statTodayTx"><span data-i18n="statTodayTx">TRANSITS_TODAY</span></div>
</div> </div>
</div> </div>
</div> </div>