Compare commits
23
Commits
v2.1.0
...
47b4bed21f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47b4bed21f | ||
|
|
7a9008de78 | ||
|
|
dad1a656fe | ||
|
|
b33d495474 | ||
|
|
38f7efce6b | ||
|
|
24c81c1abb | ||
|
|
126ad8cdaf | ||
|
|
2f0abdc9bf | ||
|
|
a1449eedfb | ||
|
|
2fa1b476c4 | ||
|
|
8ce2ed243d | ||
|
|
8ee2958b8e | ||
|
|
298478e36d | ||
|
|
502244dff4 | ||
|
|
c5dcacefd1 | ||
|
|
cae5c4ea83 | ||
|
|
445cc5e97d | ||
|
|
c502da2dfb | ||
|
|
3b45c14ded | ||
|
|
255066eefa | ||
|
|
74d7910fec | ||
|
|
bcb885c878 | ||
|
|
3f59b905c7 |
@@ -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:
|
||||
|
||||
+3
-1
@@ -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
|
||||
}
|
||||
|
||||
+158
-18
@@ -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,10 +1255,19 @@
|
||||
}
|
||||
|
||||
// --- SERVICES & CONFIGS ---
|
||||
function fileLabel(stem, names) {
|
||||
const key = String(stem).toLowerCase();
|
||||
const full = (names || []).find(n => String(n).replace(/\.[^.]*$/, '').toLowerCase() === key);
|
||||
if (full) {
|
||||
const m = String(full).match(/^(.*?)(\.[^.]*)?$/);
|
||||
return String(m[1]).toUpperCase() + (m[2] || '');
|
||||
}
|
||||
return String(stem).toUpperCase() + '.ini';
|
||||
}
|
||||
function openConfigsModal(clientId) {
|
||||
const data = globalHealthData[clientId.toLowerCase()]; const listDiv = document.getElementById('configs-list'); let listaFile = data ? (data.config_files || data.files || []) : [];
|
||||
const data = globalHealthData[clientId.toLowerCase()]; const listDiv = document.getElementById('configs-list'); let listaFile = data ? (data.config_files || data.files || []) : []; const fileNames = (data && data.file_names) || [];
|
||||
if (listaFile.length === 0) listDiv.innerHTML = `<div style="text-align:center; padding:20px;"><p style="color:var(--text-muted); margin-bottom:15px;">${t('waitData')}</p><button onclick="sendGlobalUpdate(); closeConfigsModal();" class="btn-cmd" style="background:var(--accent);">${t('forceUpdate')}</button></div>`;
|
||||
else listDiv.innerHTML = listaFile.map(f => `<div style="display:flex; justify-content:space-between; align-items:center; padding:12px; background:rgba(128,128,128,0.1); border-radius:12px; border:1px solid var(--border-color); margin-bottom:8px;"><span style="font-family:'JetBrains Mono',monospace; font-weight:bold;">${esc(String(f).toUpperCase())}.ini</span><button onclick="closeConfigsModal(); openEditorModal(${q(clientId)}, ${q(f)})" class="btn-cmd" style="background:#8e44ad; max-width:120px;">${t('btnEdit')}</button></div>`).join('');
|
||||
else listDiv.innerHTML = listaFile.map(f => `<div style="display:flex; justify-content:space-between; align-items:center; padding:12px; background:rgba(128,128,128,0.1); border-radius:12px; border:1px solid var(--border-color); margin-bottom:8px;"><span style="font-family:'JetBrains Mono',monospace; font-weight:bold;">${esc(fileLabel(f, fileNames))}</span><button onclick="closeConfigsModal(); openEditorModal(${q(clientId)}, ${q(f)})" class="btn-cmd" style="background:#8e44ad; max-width:120px;">${t('btnEdit')}</button></div>`).join('');
|
||||
document.getElementById('configs-modal').style.display = 'flex';
|
||||
}
|
||||
function closeConfigsModal() { document.getElementById('configs-modal').style.display = 'none'; }
|
||||
@@ -1237,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; }
|
||||
@@ -1257,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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user