Compare commits

...
27 Commits
Author SHA1 Message Date
iv3jdv 47b4bed21f update 2026-10-22 22:54:30 +02:00
iv3jdv 7a9008de78 update 2026-10-22 22:53:42 +02:00
iv3jdv dad1a656fe update 2026-10-22 22:35:51 +02:00
iv3jdv b33d495474 add agent version 2026-10-22 21:47:57 +02:00
iv3jdv 38f7efce6b add OTAcClient update signal 2026-10-22 18:59:09 +02:00
iv3jdv 24c81c1abb update CCS class 2026-10-22 14:01:58 +02:00
iv3jdv 126ad8cdaf add update logging 2026-10-22 13:21:19 +02:00
iv3jdv 2f0abdc9bf add Server OTA Update 2026-10-22 13:11:46 +02:00
iv3jdv a1449eedfb add Telemetry node Uptime 2026-10-22 12:52:10 +02:00
iv3jdv 2fa1b476c4 feat(ui): mostrato hash e messaggio dell'ultimo commit nel footer tramite subprocess 2026-10-22 01:36:35 +02:00
iv3jdv 8ce2ed243d fix/feat: stabilizzazione dashboard in tempo reale e log dinamici
- Modificato app.py per leggere i parametri del RotatingFileHandler dal config.json, permettendo la regolazione dello spazio su disco senza toccare il codice.
- Identificato e risolto il bug degli azzeramenti della tabella Lastheard (causato da un fallback continuo di Socket.IO a causa della mancata direttiva Upgrade nei reverse proxy)
2026-10-20 21:37:18 +02:00
iv3jdv 8ee2958b8e fix(dmr): risolto campo source mancante nei log
- MMDVMHost omette il campo source nel payload JSON dell'azione end per il DMR.
- Aggiunto il salvataggio in RAM di  e  (su active_calls) durante l'evento start.
- Ripristinata l'iniezione di questi dati prima della scrittura nel DB SQLite.
- Ora i badge RF/NET e la telemetria estesa funzionano correttamente anche sul DMR
2026-10-20 17:53:55 +02:00
iv3jdv 298478e36d feat(dashboard): estensione filtro nodo globale sulla UI
- Aggiunto  all'evento onchange del menu a tendina.
- Implementata logica lato client in index.html per filtrare dinamicamente i transiti.
- Ora la selezione di un singolo nodo isola sia i widget statistici che lo storico dei log sottostante, senza interferire con i log grezzi della vista NODES
2026-10-20 17:39:22 +02:00
iv3jdv 502244dff4 feat(dashboard): aggiunte colonne Source e YSF Mode, fix visibilità CQCQCQ per D-STAR e DG-ID per C4FM 2026-10-20 17:17:48 +02:00
iv3jdv c5dcacefd1 fix(mqtt): previene eccezione di decodifica su payload sporchi
- Aggiunto  alla decodifica dei messaggi MQTT in app.py.
- Evita che errori come UnicodeDecodeError (es. byte 0xb2) scartino interi pacchetti validi.
- Ora gli alias radio o i beacon con caratteri speciali/obsoleti vengono gestiti senza bloccare la visualizzazione del transito sulla dashboard
2026-10-20 15:34:46 +02:00
iv3jdv cae5c4ea83 fix(dashboard): refactoring colonne Target e REF/SLOT
- Separata la destinazione radio (Target) dall'infrastruttura di rete (REF/SLOT).
- Risolto il bug dei moduli D-STAR troncati causato dai beacon INFO locali di MMDVMHost.
- La colonna Target ora mostra l'UR CALL reale, mentre REF/SLOT usa in modo esclusivo la memoria di linking iniziale.
- Aggiornati index.html (nuova UI) e la logica di parsing/salvataggio in app.py.
2026-10-20 14:27:47 +02:00
iv3jdv 445cc5e97d refactor: rimossa etichetta Network dai Time Slot nell'interfaccia
Rimossa l'estrazione MQTT in app.py e la visualizzazione frontend (es. [BM]) accanto a TS1 e TS2. Il mapping esclusivo non è più coerente quando si utilizzano configurazioni multi-network con politiche di TGRewrite avanzate.
2026-10-19 22:49:42 +02:00
iv3jdv c502da2dfb update 2026-10-19 21:22:21 +02:00
iv3jdv 3b45c14ded frequency precision display 2026-10-18 13:49:21 +02:00
iv3jdv 255066eefa Delete system_monitor.py 2026-10-17 18:50:35 +02:00
iv3jdv 74d7910fec Upload files to "/" 2026-10-17 18:48:51 +02:00
iv3jdv bcb885c878 Merge pull request 'update' (#6) from develop into main
Reviewed-on: #6
2026-10-17 18:36:45 +02:00
iv3jdv 869b09f8a9 Merge pull request 'update index.html' (#5) from develop into main
Reviewed-on: #5
2026-10-16 23:49:36 +02:00
iv3jdv caf77819a2 Merge pull request 'update index.html' (#4) from develop into main
Reviewed-on: #4
2026-10-16 21:01:30 +02:00
iv3jdv d56d3d6b5b Merge pull request 'update index.html' (#3) from develop into main
Reviewed-on: #3
2026-10-16 20:48:43 +02:00
iv3jdv cf4dd93c06 Merge pull request 'add RSSI data' (#2) from develop into main
Reviewed-on: #2
2026-10-16 19:51:12 +02:00
iv3jdv a5dd99ecdc Merge pull request 'Release Rev 2.0' (#1) from develop into main
Reviewed-on: #1
2026-10-16 12:06:46 +02:00
4 changed files with 437 additions and 233 deletions
+44
View File
@@ -37,6 +37,27 @@ The server acts as the brain of the network:
Please note that **Web Push Notifications** and the **Service Worker** require a secure connection to function. For security reasons, modern browsers only enable these features over **HTTPS**. If you are accessing the console via HTTP (outside of `localhost`), the "Push" button and notification registration will not work. We recommend using a reverse proxy (like Nginx, Caddy, or Traefik) with an SSL certificate.
**Pro Tip:** You can use Let's Encrypt to get a free SSL certificate for your domain.
### ⚠️ Reverse Proxy & WebSocket Configuration
If you expose the Fleet Console through a reverse proxy like **Apache** on a public IP (HTTPS), standard HTTP proxying will drop Socket.IO real-time connections, causing the dashboard's tables to randomly clear or flash.
You must enable the WebSocket tunnel in Apache:
```bash
sudo a2enmod proxy_wstunnel rewrite headers
```
And insert the **Rewrite** rules *before* the `ProxyPass` directives inside your `<VirtualHost *:443>` block:
```apache
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:9000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://127.0.0.1:9000/$1 [P,L]
ProxyPass /socket.io/ ws://127.0.0.1:9000/socket.io/
ProxyPassReverse /socket.io/ ws://127.0.0.1:9000/socket.io/
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://127.0.0.1:9000/
```
#### 🛠️ Advanced Remote Control & Maintenance
* **Remote .INI Editor:** Edit daemon configuration files (e.g., MMDVMHost.ini) directly from the web interface without SSH access.
* **Service Management:** Start, Stop, or Restart remote system daemons with a single click.
@@ -82,6 +103,7 @@ pip install -r requirements.txt
2. Configure your MQTT broker credentials.
3. Define your repeaters in `clients.json`.
4. Generate VAPID keys at [vapidkeys.com](https://vapidkeys.com/) and add them to `config.json` to enable Web Push notifications. *(Note: Push notifications require HTTPS).*
5. Configure dynamic log rotation sizes (`log_max_mb` and `log_backup_count`) directly in `config.json` to manage disk space.
#### 4. Running as a Service
To run the server continuously in production using Gunicorn:
@@ -126,6 +148,27 @@ Il server agisce da cervello della rete:
Si prega di notare che le **Notifiche Web Push** e il **Service Worker** richiedono una connessione sicura per funzionare. Per motivi di sicurezza, i browser moderni abilitano queste funzionalità solo su **HTTPS**. Se accedi alla console via HTTP (al di fuori di `localhost`), il tasto "Push" e la registrazione delle notifiche non saranno attivi. Si consiglia l'uso di un reverse proxy (come Nginx, Caddy o Traefik) con certificato SSL.
**Suggerimento:** Puoi usare Let's Encrypt per ottenere un certificato SSL gratuito per il tuo dominio.
### ⚠️ Configurazione Reverse Proxy & WebSocket
Se esponi la Fleet Console tramite un reverse proxy come **Apache** su IP pubblico (HTTPS), il proxy HTTP standard farà cadere continuamente la connessione in tempo reale di Socket.IO, causando fastidiosi "azzeramenti" o lampeggiamenti della dashboard.
Devi abilitare il tunnel WebSocket in Apache:
```bash
sudo a2enmod proxy_wstunnel rewrite headers
```
E inserire le regole di **Rewrite** *prima* del `ProxyPass` all'interno del tuo blocco `<VirtualHost *:443>`:
```apache
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:9000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://127.0.0.1:9000/$1 [P,L]
ProxyPass /socket.io/ ws://127.0.0.1:9000/socket.io/
ProxyPassReverse /socket.io/ ws://127.0.0.1:9000/socket.io/
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://127.0.0.1:9000/
```
#### 🛠️ Controllo Remoto & Manutenzione Avanzata
* **Editor .INI Remoto:** Modifica i file di configurazione (es. MMDVMHost.ini) direttamente dal pannello web, senza bisogno di accessi SSH.
* **Gestione Demoni:** Avvia, arresta o riavvia i servizi di sistema remoti con un clic.
@@ -171,6 +214,7 @@ pip install -r requirements.txt
2. Inserisci le credenziali del broker MQTT.
3. Definisci i ripetitori nel file `clients.json`.
4. Genera le chiavi VAPID su [vapidkeys.com](https://vapidkeys.com/) e inseriscile in `config.json` per attivare le notifiche Push. *(Attenzione: le notifiche Push richiedono obbligatoriamente un certificato HTTPS).*
5. Configura le dimensioni della rotazione dei log (`log_max_mb` e `log_backup_count`) direttamente nel `config.json` per gestire lo spazio su disco.
#### 4. Esecuzione come Servizio (systemd)
Per eseguire il server in produzione in modo continuo e stabile con Gunicorn:
+240 -212
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -37,5 +37,7 @@
"id_urls": {
"dmr": "https://radioid.net/static/dmrid.dat",
"nxdn": "https://radioid.net/static/nxdn.csv"
}
},
"log_max_mb": 50,
"log_backup_count": 10
}
+147 -17
View File
@@ -170,7 +170,7 @@
<div id="top-bar">
<div class="title-brand">FLEET CONTROL CONSOLE</div>
<!-- NUOVO: Menu a schede -->
<!-- Menu a schede -->
<div class="nav-tabs">
<button class="nav-tab active" onclick="switchView('home')" id="tab-home">HOME</button>
<button class="nav-tab" onclick="switchView('nodes')" id="tab-nodes">NODES</button>
@@ -196,7 +196,7 @@
<h3 style="margin: 0; font-weight: 800; display: flex; align-items: center; gap: 10px; color: var(--text-main);">
<span style="font-size: 1.5rem;">📊</span> <span data-i18n="statTitle">DAILY STATISTICS</span>
</h3>
<select id="stat-node-filter" onchange="refreshStats()" style="background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 15px; border-radius: 6px; font-family: 'JetBrains Mono', monospace; font-weight: bold; cursor: pointer; outline: none;">
<select id="stat-node-filter" onchange="refreshStats(); refreshLogs();" style="background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 15px; border-radius: 6px; font-family: 'JetBrains Mono', monospace; font-weight: bold; cursor: pointer; outline: none;">
<option value="all">🌐 ALL NODES</option>
</select>
</div>
@@ -236,12 +236,14 @@
<th data-i18n="thTime">Time</th>
<th data-i18n="thRep">Repeater</th>
<th data-i18n="thMode">Mode</th>
<th style="text-align: center;">Slot</th>
<th style="text-align: center;">YSF Mode</th>
<th style="text-align: center;">Source</th>
<th style="text-align: center;">REF / SLOT</th>
<th data-i18n="thCall">Callsign</th>
<th>Target / TG</th>
<th data-i18n="thDur">Duration</th>
<th>BER</th>
<th>RSSI</th> <!-- Colonna S-Meter -->
<th>RSSI</th>
</tr>
</thead>
<tbody id="log-body"></tbody>
@@ -264,10 +266,11 @@
<span>GitHub Mirror</span>
</a>
<span style="opacity: 0.5;">|</span>
<span style="font-family: 'JetBrains Mono', monospace; color: var(--accent);">Rev: {{ git_commit }}</span>
<span style="opacity: 0.5;">|</span>
<span id="last-update">Sync: --:--</span>
</div>
</footer>
<div id="login-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:20px;">
@@ -420,6 +423,19 @@
</div>
</div>
<!-- NUOVO MODALE VERSIONI -->
<div id="versions-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:450px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--primary);">ℹ️ <span data-i18n="modVersions">Software & Firmware</span></h2>
<button onclick="closeVersionsModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button>
</div>
<div id="versions-list" style="background: #010409; padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; line-height: 1.8; color: var(--text-main);">
<!-- Dati iniettati via JS -->
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.2/socket.io.min.js"></script>
<script>
@@ -451,8 +467,8 @@
ttReqCfg: "Request immediate data update", ttGlobal: "Force profile switch on network", ttAdmin: "User and system management", ttPass: "Change your password", ttLogout: "Log out",
ttProfA: "Switch to Profile A", ttProfB: "Switch to Profile B", ttTgOn: "Enable Telegram notifications", ttTgOff: "Disable Telegram notifications", ttSvc: "Manage system daemons", ttFile: "Edit .ini configuration files", ttHat: "Send physical reset to modem", ttBoot: "Reboot node operating system",
ttSwitchTo: "Switch to profile: ", ttSvcStart: "Start service", ttSvcRestart: "Restart service", ttSvcEdit: "Edit configuration", ttSvcStop: "Stop service", ttLang: "Change language",
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Loading...", statAvgDur: "⏱️ AVERAGE DURATION", statTodayTx: "📡 TRANSITS TODAY", statNoData: "No data",
statTitle: "DAILY STATISTICS", statAllNodes: "ALL NODES"
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Loading...", statAvgDur: "⏱️ AVERAGE DURATION", statTodayTx: "📡 TRANSITI TODAY", statNoData: "No data",
statTitle: "DAILY STATISTICS", statAllNodes: "ALL NODES", modVersions: "Software & Firmware"
},
it: {
lastTransits: "Ultimi ascolti", loginTitle: "🔒 Login di Sistema",
@@ -481,7 +497,7 @@
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: "Passa al profilo: ", ttSvcStart: "Avvia servizio", ttSvcRestart: "Riavvia servizio", ttSvcEdit: "Modifica configurazione", ttSvcStop: "Ferma servizio", ttLang: "Cambia lingua",
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Caricamento...", statAvgDur: "⏱️ DURATA MEDIA", statTodayTx: "📡 TRANSITI OGGI", statNoData: "Nessun dato",
statTitle: "STATISTICHE GIORNALIERE", statAllNodes: "TUTTA LA RETE"
statTitle: "STATISTICHE GIORNALIERE", statAllNodes: "TUTTA LA RETE", modVersions: "Software & Firmware"
}
};
let currentLang = localStorage.getItem('lang') || 'en';
@@ -526,7 +542,7 @@
switchView(savedView);
});
// --- DIAGNOSTICA: "ultimo messaggio ricevuto" per nodo (MMDVM / gateway / agent) ---
// --- DIAGNOSTICA ---
function fmtAge(sec) {
sec = Math.max(0, Math.round(sec));
if (sec < 60) return sec + 's';
@@ -576,6 +592,7 @@
let isAuthenticated = false;
let usersCache = {};
let globalHealthData = {};
let globalVersionsData = {}; // NUOVA VARIABILE VERSIONI
let editingUserId = null;
let currentResetHatId = null;
let confirmActionCallback = null;
@@ -703,6 +720,7 @@
if (isAuthenticated) {
let adminBtn = role === 'admin' ? `
<button id="server-update-btn" onclick="confirmServerUpdate()" class="auth-btn" style="background:var(--danger); color:white !important; display:none; border: 2px solid white; animation: pulse-red 1.5s infinite;" title="Aggiornamento Server Disponibile">🔄 UPDATE SERVER</button>
<button onclick="sendGlobalUpdate()" class="auth-btn" style="background:#f59e0b; color:white;" data-i18n-title="ttReqCfg" title="${t('ttReqCfg')}">${t('btnReqCfg')}</button>
<button onclick="triggerGlobalEmergency()" class="auth-btn" style="background:#ef4444; color:white;" data-i18n-title="ttGlobal" title="${t('ttGlobal')}">${t('btnGlobal')}</button>
<button onclick="openAdmin()" class="auth-btn" style="background:var(--accent); color:white;" data-i18n-title="ttAdmin" title="${t('ttAdmin')}">${t('btnAdmin')}</button>` : '';
@@ -725,6 +743,7 @@
<span class="client-name" title="${esc(c.name)}">${esc(c.name)}</span>
<div style="display: flex; align-items: center;">
<span class="badge-id">ID: ${c.id.toUpperCase()}</span>
<span class="badge-id" id="agent-badge-${c.id}" style="display: none; margin-left: 6px; color: #38bdf8; border-color: rgba(56, 189, 248, 0.4); background: rgba(56, 189, 248, 0.1);" title="Versione Node Agent"></span>
<div id="type-badge-${c.id}" class="type-badge" style="display: none;"></div>
</div>
</div>
@@ -741,6 +760,7 @@
<span>🌡️ <span id="temp-${c.id}">--</span>°C</span>
<span>🧠 <span id="ram-${c.id}">--</span>%</span>
<span>💾 <span id="disk-${c.id}">--</span>%</span>
<span title="System Uptime">⏱️ <span id="up-${c.id}">--</span></span>
</div>
<div class="seen-bar" id="seen-${c.id}" style="display: none;"></div>
@@ -768,13 +788,14 @@
` : ''}
${showReboot ? `
<div style="width: 100%; display: flex; gap: 8px;">
<button class="btn-cmd" style="background: var(--primary); padding: 8px 4px;" title="Mostra Versioni Software" onclick="openVersionsModal('${c.id}')">ℹ️ INFO</button>
<button id="btn-svc-${c.id}" class="btn-cmd" style="background: #334155; padding: 8px 4px;" title="${t('ttSvc')}" onclick="openServicesModal('${c.id}')">${t('btnSvc')}</button>
<button class="btn-cmd" style="background: #8e44ad; padding: 8px 4px;" title="${t('ttFile')}" onclick="openConfigsModal('${c.id}')">${t('btnFile')}</button>
<button class="btn-cmd" style="background: #ea580c; padding: 8px 4px;" title="${t('ttHat')}" onclick="confirmHatReset('${c.id}')">${t('btnHat')}</button>
<button class="btn-cmd" style="background: var(--danger); padding: 8px 4px;" title="${t('ttBoot')}" onclick="confirmReboot('${c.id}')">${t('btnBoot')}</button>
</div>
<div style="width: 100%; display: flex; gap: 8px;">
<button class="btn-cmd" style="background: #2563eb; padding: 8px 4px;" title="Scarica l'ultima versione da Gitea" onclick="confirmUpdateAgent('${c.id}')">⬇️ UPDATE OTA</button>
<button id="btn-ota-${c.id}" class="btn-cmd" style="background: #2563eb; padding: 8px 4px;" title="Scarica l'ultima versione da Gitea" onclick="confirmUpdateAgent('${c.id}')">⬇️ UPDATE OTA</button>
</div>
` : ''}
</div>`;
@@ -803,6 +824,10 @@
async function refreshStates() {
try {
const res = await fetch('/api/states'); const data = await res.json();
// AGGIORNAMENTO DATI VERSIONI GLOBALI
globalVersionsData = data.versions || {};
clients.forEach(c => {
const statusDiv = document.getElementById(`status-${c.id}`); const cardDiv = document.getElementById(`card-${c.id}`);
if (!statusDiv || !cardDiv) return;
@@ -870,7 +895,6 @@
if (altDiv) altDiv.style.display = "none";
if (tsContainer) tsContainer.style.display = "flex";
let netObj = data.networks && data.networks[c.id.toLowerCase()] ? data.networks[c.id.toLowerCase()] : {ts1: "", ts2: ""};
activeModeColor = "var(--primary)";
if (ts1Div && ts2Div) {
@@ -880,8 +904,8 @@
[ts1Div, ts2Div].forEach((div, idx) => {
if (isSimplex && idx === 0) return;
const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? ''); const netName = idx === 0 ? netObj.ts1 : netObj.ts2;
const fullLabel = netName ? `TS${idx + 1} [${netName}]` : `TS${idx + 1}`;
const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? '');
const fullLabel = `TS${idx + 1}`;
div.innerText = `${fullLabel}: ${val}`;
div.style.setProperty('--pulse-color', activeModeColor);
@@ -926,6 +950,15 @@
let tempVal = healthObj.temp; tempSpan.innerText = tempVal; tempSpan.style.color = tempVal < 55 ? 'var(--success)' : (tempVal < 70 ? '#f59e0b' : 'var(--danger)');
ramSpan.innerText = healthObj.ram; let d = healthObj.disk; diskSpan.innerText = d; diskSpan.style.color = d < 85 ? 'inherit' : (d < 95 ? '#f59e0b' : 'var(--danger)');
let upSpan = document.getElementById(`up-${c.id}`);
if (upSpan && healthObj.uptime) {
upSpan.innerText = fmtAge(healthObj.uptime);
}
let agentBadge = document.getElementById(`agent-badge-${c.id}`);
if (agentBadge && healthObj.agent_version) {
agentBadge.innerText = `Agent v${healthObj.agent_version}`;
agentBadge.style.display = 'inline-block';
}
const profBtnsDiv = document.getElementById(`prof-btns-${c.id}`);
const profKeys = JSON.stringify(healthObj.profiles || {});
@@ -948,7 +981,11 @@
}
}
} else { if (healthContainer) healthContainer.style.display = 'none'; }
} else {
if (healthContainer) healthContainer.style.display = 'none';
let agentBadge = document.getElementById(`agent-badge-${c.id}`);
if (agentBadge) agentBadge.style.display = 'none';
}
globalHealthData[c.id.toLowerCase()] = healthObj;
@@ -964,6 +1001,19 @@
else { btnSvc.style.background = '#334155'; btnSvc.classList.remove('blink'); btnSvc.innerHTML = t('btnSvc'); }
}
let btnOta = document.getElementById(`btn-ota-${c.id}`);
if (btnOta) {
if (healthObj && healthObj.agent_update_available) {
btnOta.style.setProperty('background', 'var(--danger)', 'important');
btnOta.style.setProperty('color', 'white', 'important');
btnOta.style.animation = 'pulse-red 1.5s infinite';
} else {
btnOta.style.setProperty('background', '#2563eb', 'important');
btnOta.style.setProperty('color', 'white', 'important');
btnOta.style.animation = 'none';
}
}
if (isOnline) {
cardDiv.classList.add('online'); statusDiv.classList.remove('status-offline'); cardDiv.style.opacity = "1"; cardDiv.style.filter = "none";
@@ -999,13 +1049,36 @@
const clientId = row[1]; const protocol = row[2] || "DMR"; let source = row[3] || "---"; const target = row[4] || "---";
const rawSlot = row[5]; const source_ext = row[8];
const rawRssi = row[9];
const sourceConn = row[10];
const ysfMode = row[11];
let sourceHtml = esc(source);
if (source_ext && source_ext.trim() !== "") { sourceHtml += ` <span style="font-size:0.8em; color:#94a3b8; font-family:'JetBrains Mono', monospace;">/${esc(source_ext)}</span>`; }
const slotDisplay = protocol === "DMR" ? `TS${rawSlot}` : "--";
let slotDisplay = "---";
if (rawSlot && String(rawSlot).trim() !== "" && rawSlot !== "undefined") {
if (protocol === "DMR" && !String(rawSlot).toUpperCase().startsWith("TS")) {
slotDisplay = `TS${rawSlot}`;
} else {
slotDisplay = rawSlot;
}
}
let protoColor = "#3b82f6"; if (protocol === "NXDN") protoColor = "#10b981"; else if (protocol === "YSF") protoColor = "#8b5cf6"; else if (protocol === "D-STAR") protoColor = "#06b6d4"; else if (protocol === "P25") protoColor = "#f59e0b";
// Formatta il Source (RF o NET)
let sourceBadge = "---";
if (sourceConn) {
if (sourceConn.toLowerCase() === 'rf') sourceBadge = '<span style="color:#f87171; font-weight:800;">RF</span>';
else if (sourceConn.toLowerCase() === 'network') sourceBadge = '<span style="color:#38bdf8; font-weight:800;">NET</span>';
else sourceBadge = `<span style="font-weight:800; color:var(--text-muted);">${esc(sourceConn).toUpperCase()}</span>`;
}
// Formatta l'YSF Mode
let modeDisplay = "---";
if (ysfMode && ysfMode.trim() !== "") {
modeDisplay = `<span style="font-size:0.7rem; color:#a78bfa; border: 1px solid #a78bfa; padding: 2px 4px; border-radius: 4px;">${esc(ysfMode).toUpperCase()}</span>`;
}
// Formatta l'RSSI con S-Meter grafico a segmenti
let rssiDisplay = '---';
if (rawRssi && rawRssi !== 0) {
@@ -1057,7 +1130,11 @@
if (!networkLogs[clientId]) networkLogs[clientId] = "";
networkLogs[clientId] += `<div style="border-bottom:1px solid rgba(255,255,255,0.1); padding:4px 0;"><span style="color:#64748b;">[${esc(time)}]</span> <span style="color:${protoColor}; font-weight:bold;">[${esc(protocol)}]</span> <span style="color:#cbd5e1;">${esc(source.replace("🌐", "").trim())}</span></div>`;
} else {
tableHTML += `<tr><td>${esc(time)}</td><td><b style="color:var(--text-main);">${esc(String(clientId).toUpperCase())}</b></td><td><span style="background:${protoColor}; color:white; padding:3px 8px; border-radius:8px; font-size:0.7rem; font-weight:800;">${esc(protocol)}</span></td><td style="font-family:'JetBrains Mono', monospace; font-weight:bold; text-align:center;">${esc(slotDisplay)}</td><td style="color:var(--accent); font-weight:800;">${sourceHtml}</td><td style="font-family:'JetBrains Mono', monospace;">${esc(target.trim())}</td><td>${esc(row[6])}s</td><td>${esc(row[7])}%</td><td style="font-family:'JetBrains Mono', monospace;">${rssiDisplay}</td></tr>`;
// FILTRO TENDINA: Controlla il nodo selezionato prima di aggiungere la riga
const selectedFilter = document.getElementById('stat-node-filter').value;
if (selectedFilter === 'all' || String(clientId).toLowerCase() === selectedFilter) {
tableHTML += `<tr><td>${esc(time)}</td><td><b style="color:var(--text-main);">${esc(String(clientId).toUpperCase())}</b></td><td><span style="background:${protoColor}; color:white; padding:3px 8px; border-radius:8px; font-size:0.7rem; font-weight:800;">${esc(protocol)}</span></td><td style="text-align:center;">${modeDisplay}</td><td style="text-align:center; font-family:'JetBrains Mono', monospace;">${sourceBadge}</td><td style="font-family:'JetBrains Mono', monospace; font-weight:bold; text-align:center;">${esc(slotDisplay)}</td><td style="color:var(--accent); font-weight:800;">${sourceHtml}</td><td style="font-family:'JetBrains Mono', monospace;">${esc(target.trim())}</td><td>${esc(row[6])}s</td><td>${esc(row[7])}%</td><td style="font-family:'JetBrains Mono', monospace;">${rssiDisplay}</td></tr>`;
}
}
});
tbody.innerHTML = tableHTML;
@@ -1178,7 +1255,6 @@
}
// --- SERVICES & CONFIGS ---
// Etichetta del file: nome in maiuscolo + estensione reale (es. DSTARGATEWAY.cfg); .ini solo come ripiego per agent vecchi
function fileLabel(stem, names) {
const key = String(stem).toLowerCase();
const full = (names || []).find(n => String(n).replace(/\.[^.]*$/, '').toLowerCase() === key);
@@ -1247,6 +1323,28 @@
});
}
// --- NUOVE FUNZIONI PER POP-UP VERSIONI ---
function openVersionsModal(clientId) {
const versions = globalVersionsData[clientId.toLowerCase()];
const listDiv = document.getElementById('versions-list');
if (!versions || Object.keys(versions).length === 0) {
listDiv.innerHTML = "<span style='color: var(--text-muted);'>Nessun dato ancora ricevuto. Usa il tasto 🔄 RESTART sui servizi del nodo per forzare l'invio del log di avvio.</span>";
} else {
let html = "";
for (const [software, version] of Object.entries(versions)) {
html += `<div><strong style="color: var(--primary); display: inline-block; width: 140px;">${esc(software)}:</strong> <span style="color: var(--success); font-weight: bold;">${esc(version)}</span></div>`;
}
listDiv.innerHTML = html;
}
document.getElementById('versions-modal').style.display = 'flex';
}
function closeVersionsModal() {
document.getElementById('versions-modal').style.display = 'none';
}
// --- PUSH NOTIFICATIONS ---
async function subscribeToPush() {
if (!('serviceWorker' in navigator) || !('PushManager' in window)) { customAlert("Error", "Push notifications are not supported by this browser.", true); return; }
@@ -1267,6 +1365,38 @@
}
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() {
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("Errore check update server:", e); }
}
function confirmServerUpdate() {
customConfirm("🔄 UPDATE SERVER", "Vuoi scaricare l'ultima versione del server da Gitea/GitHub e riavviare il servizio backend?", "var(--danger)", async () => {
try {
const res = await fetch('/api/server_update/apply', { method: 'POST' });
const data = await res.json();
if (data.success) {
customAlert("✅ SUCCESS", "Aggiornamento in corso. La pagina si ricaricherà a breve.");
setTimeout(() => location.reload(), 5000); // Ricarica dopo 5 secondi
} else {
customAlert("❌ ERRORE", esc(data.error), true);
}
} catch (e) { console.error(e); customAlert("❌ ERRORE", "Errore di rete.", true); }
});
}
// Controlla gli aggiornamenti ogni ora
setInterval(checkServerUpdate, 3600000);
// Effettua un controllo 5 secondi dopo l'avvio della UI
setTimeout(checkServerUpdate, 5000);
initUI();
checkPushStatus();