Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35f1598393 | ||
|
|
9a4dc1eea7 | ||
|
|
be0cbbb64b | ||
|
|
6d11c355df | ||
|
|
efca23c64f | ||
|
|
69308c4580 | ||
|
|
a39389fe1a | ||
|
|
a934a53898 | ||
|
|
81eff4300d | ||
|
|
b6f1993e26 | ||
|
|
164525e035 |
@@ -14,32 +14,54 @@
|
|||||||
> ℹ️ **Note:** This is the Central Server repository. To monitor remote repeaters, you must install the [Fleet Control Agent](https://git.arifvg.it/iv3jdv/fleet-node-agent.git) on each node.
|
> ℹ️ **Note:** This is the Central Server repository. To monitor remote repeaters, you must install the [Fleet Control Agent](https://git.arifvg.it/iv3jdv/fleet-node-agent.git) on each node.
|
||||||
|
|
||||||
### 🏗️ Architecture & Technology Stack
|
### 🏗️ Architecture & Technology Stack
|
||||||
The server acts as the brain of the network:
|
The server acts as the brain of the network, built on a highly scalable foundation (v5.0+):
|
||||||
* **Backend:** Flask (Python) with `gevent` for high-concurrency handling.
|
* **Modular Backend:** Completely decoupled architecture (`core/`, `services/`, `routes/`) for high maintainability and robust background task handling.
|
||||||
|
* **Core Engine:** Flask (Python) with `gevent` for high-concurrency WebSocket handling.
|
||||||
* **Database:** SQLite (WAL mode) for robust User Management, Audit Logs, and Radio Traffic storage.
|
* **Database:** SQLite (WAL mode) for robust User Management, Audit Logs, and Radio Traffic storage.
|
||||||
* **Communication:** MQTT for instant data routing + WebSockets (SocketIO) for zero-latency UI updates.
|
* **Communication:** MQTT for instant data routing + WebSockets (SocketIO) for zero-latency UI updates.
|
||||||
* **Frontend:** Vanilla JS with a modern *Glassmorphism* NOC (Network Operations Center) design.
|
* **Frontend:** Vanilla JS with a modern *Glassmorphism* NOC (Network Operations Center) design and separated logic (`app.js`, `modals.js`).
|
||||||
|
|
||||||
### ✨ Ultimate Features
|
### ✨ Ultimate Features
|
||||||
|
|
||||||
|
#### 🛡️ Proactive Diagnostics (Watchdog)
|
||||||
|
* **Hardware Monitoring:** Continuous analysis of remote CPU temperatures and disk space saturation. Automatically triggers Push Notifications before critical failures (e.g., CPU throttling or log overflow) occur.
|
||||||
|
* **RF Anomaly Detection:** Real-time monitoring of local RF BER (Bit Error Rate). Detects hardware RF degradation on local transits and alerts admins instantly.
|
||||||
|
|
||||||
#### ⚡ Zero-Latency Real-Time Dashboard
|
#### ⚡ Zero-Latency Real-Time Dashboard
|
||||||
* **WebSocket Powered:** The dashboard updates instantly upon radio traffic or telemetry changes. No heavy HTTP polling, no page reloads.
|
* **WebSocket Powered:** The dashboard updates instantly upon radio traffic or telemetry changes. No heavy HTTP polling, no page reloads.
|
||||||
* **Live MQTT Status:** A real-time badge continuously monitors the connection to the MQTT broker, instantly alerting you if the backend loses connectivity.
|
* **Live MQTT Status:** A real-time badge continuously monitors the connection to the MQTT broker, instantly alerting you if the backend loses connectivity.
|
||||||
* **PWA Ready:** Install the dashboard as a Progressive Web App on iOS/Android for a native, full-screen mobile experience.
|
* **PWA Ready v6:** Install the dashboard as a Progressive Web App on iOS/Android for a native, full-screen mobile experience with offline asset caching.
|
||||||
|
|
||||||
#### 🔔 Web Push Notifications
|
#### 🔔 Web Push Notifications
|
||||||
* Get instant, native alerts directly on your desktop or mobile device when:
|
* Get instant, native alerts directly on your desktop or mobile device when:
|
||||||
* A node goes offline or comes back online.
|
* A node goes offline or comes back online.
|
||||||
* A critical system daemon crashes (Auto-healing failed).
|
* A critical system daemon crashes (Auto-healing failed).
|
||||||
|
* The Watchdog detects thermal warnings, disk full alerts, or high RF BER.
|
||||||
* Works securely even when the web app is closed or in the background.
|
* Works securely even when the web app is closed or in the background.
|
||||||
|
|
||||||
|
#### 🛠️ Advanced Remote Control & Maintenance
|
||||||
|
* **OTA Server Updates:** Apply server-side Git updates with a single click directly from the admin dashboard (Over-The-Air) without SSH access.
|
||||||
|
* **Remote .INI Editor:** Edit daemon configuration files (e.g., MMDVMHost.ini) directly from the web interface.
|
||||||
|
* **Service Management:** Start, Stop, or Restart remote system daemons.
|
||||||
|
* **Global Overrides:** Switch profiles (e.g., Profile A/B) or force updates simultaneously on all nodes in the fleet.
|
||||||
|
* **Hardware Interventions:** Trigger a physical OS reboot or a hard GPIO reset of the MMDVM HAT directly from the web panel.
|
||||||
|
|
||||||
|
#### 📊 Unified Monitoring & Statistics
|
||||||
|
* **Interactive Fleet Map:** Real-time GIS map showing repeater locations, online/offline status, active TX states (pulsing pins), and active watchdog warnings.
|
||||||
|
* **Live Heard Log:** A centralized view of radio traffic across the entire network, auto-resolving DMR and NXDN IDs into callsigns.
|
||||||
|
* **Software & Firmware Tracking:** Instantly view MMDVM firmware versions and Pi-Star/Gateway component versions for each node.
|
||||||
|
* **Daily Analytics:** Automatically tracks Top Talkgroups, Top Callsigns, Average duration, and daily transit counts.
|
||||||
|
|
||||||
|
#### 🔐 Security & Access Control
|
||||||
|
* **Role-Based Access Control (RBAC):** Create `admin` and `operator` accounts.
|
||||||
|
* **Granular Permissions:** Restrict operators to view/control only specific repeaters.
|
||||||
|
* **Audit Trail:** Every critical action (reboots, config edits, daemon restarts) is logged with the username, timestamp, and target node.
|
||||||
|
|
||||||
### ⚠️ Security Requirement: HTTPS
|
### ⚠️ Security Requirement: HTTPS
|
||||||
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.
|
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
|
### ⚠️ 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.
|
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. You must enable the WebSocket tunnel in Apache:
|
||||||
You must enable the WebSocket tunnel in Apache:
|
|
||||||
```bash
|
```bash
|
||||||
sudo a2enmod proxy_wstunnel rewrite headers
|
sudo a2enmod proxy_wstunnel rewrite headers
|
||||||
```
|
```
|
||||||
@@ -58,26 +80,10 @@ ProxyPass / http://127.0.0.1:9000/
|
|||||||
ProxyPassReverse / 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.
|
|
||||||
* **Global Overrides:** Switch profiles (e.g., Profile A/B) or force updates simultaneously on all nodes in the fleet.
|
|
||||||
* **Hardware Interventions:** Trigger a physical OS reboot or a hard GPIO reset of the MMDVM HAT directly from the web panel.
|
|
||||||
|
|
||||||
#### 📊 Unified Monitoring & Statistics
|
|
||||||
* **Live Heard Log:** A centralized view of radio traffic across the entire network, auto-resolving DMR and NXDN IDs into callsigns.
|
|
||||||
* **Real-Time Telemetry:** Monitor CPU, RAM, Disk, and Temperature for every connected node.
|
|
||||||
* **Daily Analytics:** Automatically tracks Top Talkgroups, Top Callsigns, Average duration, and daily transit counts.
|
|
||||||
|
|
||||||
#### 🔐 Security & Access Control
|
|
||||||
* **Role-Based Access Control (RBAC):** Create `admin` and `operator` accounts.
|
|
||||||
* **Granular Permissions:** Restrict operators to view/control only specific repeaters.
|
|
||||||
* **Audit Trail:** Every critical action (reboots, config edits, daemon restarts) is logged with the username, timestamp, and target node.
|
|
||||||
|
|
||||||
### 🚀 Installation Guide
|
### 🚀 Installation Guide
|
||||||
|
|
||||||
#### 0. Root Privileges
|
#### 0. Root Privileges
|
||||||
All installation steps must be executed as the `root` user. Before starting, elevate your privileges by running:
|
All installation steps must be executed as the `root` user.
|
||||||
```bash
|
```bash
|
||||||
apt update
|
apt update
|
||||||
apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
||||||
@@ -85,7 +91,7 @@ apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python
|
|||||||
#### 1. Clone Repository
|
#### 1. Clone Repository
|
||||||
Clone the repository into the /opt directory to ensure all systemd paths work correctly:
|
Clone the repository into the /opt directory to ensure all systemd paths work correctly:
|
||||||
```bash
|
```bash
|
||||||
git clone https://tuo-gitea.com/utente/fleet-control-server.git /opt/fleet-control-server
|
git clone https://git.arifvg.it/iv3jdv/fleet-control-server.git /opt/fleet-control-server
|
||||||
cd /opt/fleet-control-server
|
cd /opt/fleet-control-server
|
||||||
```
|
```
|
||||||
#### 2. Virtual Environment Setup (Recommended)
|
#### 2. Virtual Environment Setup (Recommended)
|
||||||
@@ -125,31 +131,54 @@ systemctl start fleet-console
|
|||||||
> ℹ️ **Nota:** Questo è il repository del Server Centrale. Per monitorare i ripetitori, devi installare il [Fleet Control Agent](https://git.arifvg.it/iv3jdv/fleet-node-agent.git) su ciascun nodo remoto.
|
> ℹ️ **Nota:** Questo è il repository del Server Centrale. Per monitorare i ripetitori, devi installare il [Fleet Control Agent](https://git.arifvg.it/iv3jdv/fleet-node-agent.git) su ciascun nodo remoto.
|
||||||
|
|
||||||
### 🏗️ Architettura e Tecnologie
|
### 🏗️ Architettura e Tecnologie
|
||||||
Il server agisce da cervello della rete:
|
Il server agisce da cervello della rete, basato su fondamenta altamente scalabili (v5.0+):
|
||||||
* **Backend:** Flask (Python) con `gevent` per la gestione ad alta concorrenza.
|
* **Backend Modulare:** Architettura completamente disaccoppiata (`core/`, `services/`, `routes/`) per un'elevata manutenibilità e gestione robusta dei task in background.
|
||||||
|
* **Motore Core:** Flask (Python) con `gevent` per la gestione ad alta concorrenza dei WebSocket.
|
||||||
* **Database:** SQLite (in modalità WAL) per gestire in sicurezza Utenti, Log operativi e traffico radio.
|
* **Database:** SQLite (in modalità WAL) per gestire in sicurezza Utenti, Log operativi e traffico radio.
|
||||||
* **Comunicazione:** MQTT per il routing istantaneo dei dati + WebSockets (SocketIO) per aggiornare la UI a latenza zero.
|
* **Comunicazione:** MQTT per il routing istantaneo dei dati + WebSockets (SocketIO) per aggiornare la UI a latenza zero.
|
||||||
* **Frontend:** Vanilla JS con un moderno design *Glassmorphism* in stile NOC (Network Operations Center).
|
* **Frontend:** Vanilla JS con un moderno design *Glassmorphism* in stile NOC (Network Operations Center) e logica completamente separata (`app.js`, `modals.js`).
|
||||||
|
|
||||||
### ✨ Funzionalità Principali
|
### ✨ Funzionalità Principali
|
||||||
|
|
||||||
|
#### 🛡️ Diagnostica Proattiva (Watchdog)
|
||||||
|
* **Monitoraggio Hardware:** Analisi continua delle temperature CPU e della saturazione disco da remoto. Innesca automaticamente notifiche Push prima che si verifichino guasti critici (es. thermal throttling o blocco log MMDVM).
|
||||||
|
* **Rilevamento Anomalie RF:** Monitoraggio in tempo reale del BER (Bit Error Rate) sul traffico RF locale. Rileva il degrado hardware in radiofrequenza avvisando istantaneamente gli amministratori.
|
||||||
|
|
||||||
#### ⚡ Dashboard Real-Time a Latenza Zero
|
#### ⚡ Dashboard Real-Time a Latenza Zero
|
||||||
* **Motore WebSocket:** La dashboard scatta all'istante al passaggio di traffico radio o ai cambi di telemetria. Nessun polling HTTP pesante, nessun refresh della pagina.
|
* **Motore WebSocket:** La dashboard scatta all'istante al passaggio di traffico radio o ai cambi di telemetria. Nessun polling HTTP pesante, nessun refresh della pagina.
|
||||||
* **Stato MQTT Live:** Un badge in tempo reale monitora continuamente la connessione al broker MQTT, avvisandoti istantaneamente in caso di problemi di rete.
|
* **Stato MQTT Live:** Un badge in tempo reale monitora continuamente la connessione al broker MQTT, avvisandoti istantaneamente in caso di problemi di rete.
|
||||||
* **PWA Ready:** Installabile su smartphone Android e iOS come Progressive Web App per un'esperienza nativa a schermo intero.
|
* **PWA Ready v6:** Installabile su smartphone Android e iOS come Progressive Web App per un'esperienza nativa a schermo intero con cache offline intelligente.
|
||||||
|
|
||||||
#### 🔔 Notifiche Web Push
|
#### 🔔 Notifiche Web Push
|
||||||
* Ricevi avvisi nativi e immediati su PC o smartphone quando:
|
* Ricevi avvisi nativi e immediati su PC o smartphone quando:
|
||||||
* Un nodo va offline o torna operativo.
|
* Un nodo va offline o torna operativo.
|
||||||
* Un demone di sistema remoto si blocca (fallimento auto-healing).
|
* Un demone di sistema remoto si blocca (fallimento auto-healing).
|
||||||
|
* Il Watchdog rileva allarmi termici, disco pieno o anomalie BER.
|
||||||
* Funzionano in modo sicuro anche quando la web app è chiusa o in background.
|
* Funzionano in modo sicuro anche quando la web app è chiusa o in background.
|
||||||
|
|
||||||
|
#### 🛠️ Controllo Remoto & Manutenzione Avanzata
|
||||||
|
* **Aggiornamenti Server OTA:** Applica gli aggiornamenti del server tramite Git direttamente dalla dashboard di amministrazione (Over-The-Air) con un clic, senza usare SSH.
|
||||||
|
* **Editor .INI Remoto:** Modifica i file di configurazione (es. MMDVMHost.ini) direttamente dal pannello web.
|
||||||
|
* **Gestione Demoni:** Avvia, arresta o riavvia i servizi di sistema remoti.
|
||||||
|
* **Override Globali:** Cambia i profili operativi (es. Profilo A/B) simultaneamente su tutta la rete.
|
||||||
|
* **Interventi Hardware:** Innesca un riavvio del sistema operativo o un reset fisico (tramite pin GPIO) della scheda MMDVM.
|
||||||
|
|
||||||
|
#### 📊 Monitoraggio & Statistiche
|
||||||
|
* **Mappa Interattiva di Flotta:** Mappa GIS in tempo reale che mostra la posizione dei ripetitori, stato online/offline, trasmissione attiva (pin lampeggianti) e allarmi diagnostici in corso.
|
||||||
|
* **Log Ascolti Live:** Vista unificata in tempo reale del traffico radio di tutta la rete, con traduzione automatica degli ID DMR e NXDN in nominativi.
|
||||||
|
* **Tracciamento Versioni:** Controlla all'istante le versioni firmware MMDVM e software (Pi-Star/Gateway) a bordo di ciascun nodo.
|
||||||
|
* **Analisi Giornaliera:** Statistiche automatiche su Top Talkgroups, Top Callsign, durata media e numero totale di transiti.
|
||||||
|
|
||||||
|
#### 🔐 Sicurezza e Controllo Accessi
|
||||||
|
* **Gestione Ruoli (RBAC):** Creazione di account `admin` e `operator`.
|
||||||
|
* **Permessi Granulari:** Limita un operatore al controllo e alla visualizzazione di specifici ripetitori.
|
||||||
|
* **Audit Trail:** Ogni azione critica (riavvii, modifiche file, gestione demoni) viene registrata con data, ora, utente e nodo di destinazione.
|
||||||
|
|
||||||
### ⚠️ Sicurezza Richiesta: HTTPS
|
### ⚠️ Sicurezza Richiesta: HTTPS
|
||||||
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.
|
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
|
### ⚠️ 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.
|
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.
|
||||||
Devi abilitare il tunnel WebSocket in Apache:
|
Devi abilitare il tunnel WebSocket in Apache:
|
||||||
```bash
|
```bash
|
||||||
sudo a2enmod proxy_wstunnel rewrite headers
|
sudo a2enmod proxy_wstunnel rewrite headers
|
||||||
@@ -169,26 +198,10 @@ ProxyPass / http://127.0.0.1:9000/
|
|||||||
ProxyPassReverse / 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.
|
|
||||||
* **Override Globali:** Cambia i profili operativi (es. Profilo A/B) simultaneamente su tutta la rete.
|
|
||||||
* **Interventi Hardware:** Innesca un riavvio del sistema operativo o un reset fisico (tramite pin GPIO) della scheda MMDVM direttamente dall'interfaccia web.
|
|
||||||
|
|
||||||
#### 📊 Monitoraggio & Statistiche
|
|
||||||
* **Log Ascolti Live:** Vista unificata in tempo reale del traffico radio di tutta la rete, con traduzione automatica degli ID DMR e NXDN in nominativi.
|
|
||||||
* **Telemetria in Diretta:** Monitora l'utilizzo di CPU, RAM, Disco e le Temperature per ogni nodo connesso.
|
|
||||||
* **Analisi Giornaliera:** Statistiche automatiche su Top Talkgroups, Top Callsign, durata media e numero totale di transiti.
|
|
||||||
|
|
||||||
#### 🔐 Sicurezza e Controllo Accessi
|
|
||||||
* **Gestione Ruoli (RBAC):** Creazione di account `admin` e `operator`.
|
|
||||||
* **Permessi Granulari:** Limita un operatore al controllo e alla visualizzazione di specifici ripetitori.
|
|
||||||
* **Audit Trail:** Ogni azione critica (riavvii, modifiche file, gestione demoni) viene registrata con data, ora, utente e nodo di destinazione.
|
|
||||||
|
|
||||||
### 🚀 Guida all'Installazione
|
### 🚀 Guida all'Installazione
|
||||||
|
|
||||||
#### 0. Privilegi di Root
|
#### 0. Privilegi di Root
|
||||||
Tutti i passaggi di installazione devono essere eseguiti come utente `root`. Prima di iniziare, eleva i tuoi privilegi eseguendo:
|
Tutti i passaggi di installazione devono essere eseguiti come utente `root`.
|
||||||
```bash
|
```bash
|
||||||
apt update
|
apt update
|
||||||
apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
||||||
@@ -196,7 +209,7 @@ apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python
|
|||||||
#### 1. Clonazione dei Repository
|
#### 1. Clonazione dei Repository
|
||||||
Clona il repository nella cartella /opt per assicurarti che tutti i percorsi dei servizi systemd siano corretti:
|
Clona il repository nella cartella /opt per assicurarti che tutti i percorsi dei servizi systemd siano corretti:
|
||||||
```bash
|
```bash
|
||||||
git clone https://tuo-gitea.com/utente/fleet-control-server.git /opt/fleet-control-server
|
git clone https://git.arifvg.it/iv3jdv/fleet-control-server.git /opt/fleet-control-server
|
||||||
cd /opt/fleet-control-server
|
cd /opt/fleet-control-server
|
||||||
```
|
```
|
||||||
#### 2. Setup Ambiente Virtuale (Consigliato)
|
#### 2. Setup Ambiente Virtuale (Consigliato)
|
||||||
|
|||||||
+2
-1
@@ -39,5 +39,6 @@
|
|||||||
"nxdn": "https://radioid.net/static/nxdn.csv"
|
"nxdn": "https://radioid.net/static/nxdn.csv"
|
||||||
},
|
},
|
||||||
"log_max_mb": 50,
|
"log_max_mb": 50,
|
||||||
"log_backup_count": 10
|
"log_backup_count": 10,
|
||||||
|
"last_heard_limit": 60
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 34 KiB |
+11
-1
@@ -47,10 +47,20 @@ def get_clients():
|
|||||||
|
|
||||||
@api_bp.route('/api/logs')
|
@api_bp.route('/api/logs')
|
||||||
def get_logs():
|
def get_logs():
|
||||||
|
# 1. Recupera il valore da config.json (default: 60)
|
||||||
|
cfg_limit = config.get("last_heard_limit", 60)
|
||||||
|
|
||||||
|
# 2. Se il client passa ?limit=, usa quello (validato tra 10 e 300 righe)
|
||||||
|
try:
|
||||||
|
limit = int(request.args.get('limit', cfg_limit))
|
||||||
|
limit = max(10, min(limit, 300))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
limit = cfg_limit
|
||||||
|
|
||||||
conn = sqlite3.connect(DB_PATH, timeout=10)
|
conn = sqlite3.connect(DB_PATH, timeout=10)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute("""SELECT timestamp, client_id, protocol, source_id, target, slot, duration, ber, source_ext, rssi, source_conn, ysf_mode
|
c.execute("""SELECT timestamp, client_id, protocol, source_id, target, slot, duration, ber, source_ext, rssi, source_conn, ysf_mode
|
||||||
FROM radio_logs ORDER BY id DESC LIMIT 60""")
|
FROM radio_logs ORDER BY id DESC LIMIT ?""", (limit,))
|
||||||
logs = c.fetchall()
|
logs = c.fetchall()
|
||||||
conn.close()
|
conn.close()
|
||||||
return jsonify(logs)
|
return jsonify(logs)
|
||||||
|
|||||||
+69
-32
@@ -182,17 +182,11 @@ def on_message(client, userdata, msg):
|
|||||||
logger.error(f"Errore parsing telemetria agent: {e}")
|
logger.error(f"Errore parsing telemetria agent: {e}")
|
||||||
|
|
||||||
# --- 5. INFO FREQUENZE E GEOLOCALIZZAZIONE ---
|
# --- 5. INFO FREQUENZE E GEOLOCALIZZAZIONE ---
|
||||||
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost') and parts[3].lower() == 'info':
|
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost', 'dmrgateway') and parts[3].lower() == 'info':
|
||||||
try:
|
try:
|
||||||
cid = parts[1].lower()
|
cid = parts[1].lower()
|
||||||
data = json.loads(payload)
|
data = json.loads(payload)
|
||||||
|
|
||||||
tx = data.get("TXFrequency", "0")
|
|
||||||
rx = data.get("RXFrequency", "0")
|
|
||||||
lat = data.get("Latitude", "0.0")
|
|
||||||
lon = data.get("Longitude", "0.0")
|
|
||||||
loc = data.get("Location", "Sconosciuta")
|
|
||||||
|
|
||||||
def format_freq(f):
|
def format_freq(f):
|
||||||
if str(f).isdigit() and int(f) > 0:
|
if str(f).isdigit() and int(f) > 0:
|
||||||
hz = int(f)
|
hz = int(f)
|
||||||
@@ -203,16 +197,25 @@ def on_message(client, userdata, msg):
|
|||||||
return f"{mhz}.{dec} MHz"
|
return f"{mhz}.{dec} MHz"
|
||||||
return str(f)
|
return str(f)
|
||||||
|
|
||||||
state.node_info[cid] = {
|
# Inizializza il dizionario se il nodo è nuovo
|
||||||
"tx": format_freq(tx),
|
if cid not in state.node_info:
|
||||||
"rx": format_freq(rx),
|
state.node_info[cid] = {"tx": "0", "rx": "0", "lat": "0.0", "lon": "0.0", "loc": "Sconosciuta"}
|
||||||
"lat": lat,
|
|
||||||
"lon": lon,
|
# Aggiorna solo i campi effettivamente presenti nel payload per fondere i dati di MMDVM e DMRGateway
|
||||||
"loc": loc
|
if "TXFrequency" in data:
|
||||||
}
|
state.node_info[cid]["tx"] = format_freq(data["TXFrequency"])
|
||||||
|
if "RXFrequency" in data:
|
||||||
|
state.node_info[cid]["rx"] = format_freq(data["RXFrequency"])
|
||||||
|
if "Latitude" in data:
|
||||||
|
state.node_info[cid]["lat"] = data["Latitude"]
|
||||||
|
if "Longitude" in data:
|
||||||
|
state.node_info[cid]["lon"] = data["Longitude"]
|
||||||
|
if "Location" in data:
|
||||||
|
state.node_info[cid]["loc"] = data["Location"]
|
||||||
|
|
||||||
state.notify_update()
|
state.notify_update()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Errore parsing MMDVMHost info per {cid}: {e}")
|
logger.error(f"Errore parsing info (MMDVM/DMRGateway) per {cid}: {e}")
|
||||||
|
|
||||||
# --- 6. INFO GENERALI (CALLSIGN & RADIO ID) ---
|
# --- 6. INFO GENERALI (CALLSIGN & RADIO ID) ---
|
||||||
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost') and parts[3].lower() == 'general':
|
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost') and parts[3].lower() == 'general':
|
||||||
@@ -241,31 +244,65 @@ def on_message(client, userdata, msg):
|
|||||||
if cid not in state.gateway_states:
|
if cid not in state.gateway_states:
|
||||||
state.gateway_states[cid] = {}
|
state.gateway_states[cid] = {}
|
||||||
|
|
||||||
if 'status' in data:
|
m = "" # Variabile per il log di sistema
|
||||||
state.gateway_states[cid][proto] = {"action": "status", "dest": data['status'].get('message', 'IDLE')}
|
|
||||||
state.notify_update()
|
# 1. Parsing strutturato (usato per il messaggio "Link IT-YSF-FVG")
|
||||||
elif 'link' in data:
|
if 'link' in data:
|
||||||
l = data['link']
|
l = data['link']
|
||||||
g_dest = str(l.get('reflector') or l.get('talkgroup') or '---').strip()
|
g_dest = str(l.get('reflector') or l.get('talkgroup') or '---').strip()
|
||||||
g_action = l.get('action', '')
|
g_action = l.get('action', '')
|
||||||
state.gateway_states[cid][proto] = {"action": g_action, "dest": g_dest}
|
state.gateway_states[cid][proto] = {"action": g_action, "dest": g_dest}
|
||||||
state.notify_update()
|
state.notify_update()
|
||||||
|
|
||||||
m = ""
|
if g_action == 'linking':
|
||||||
if 'status' in data:
|
state.last_seen_reflector[f"{cid}_{proto}"] = g_dest
|
||||||
m = data['status'].get('message', '')
|
elif g_action == 'unlinking':
|
||||||
elif 'link' in data:
|
|
||||||
l = data['link']
|
|
||||||
dest = str(l.get('reflector') or l.get('talkgroup') or '---').strip()
|
|
||||||
action = l.get('action')
|
|
||||||
if action == 'linking':
|
|
||||||
state.last_seen_reflector[f"{cid}_{proto}"] = dest
|
|
||||||
elif action == 'unlinking':
|
|
||||||
state.last_seen_reflector[f"{cid}_{proto}"] = "---"
|
state.last_seen_reflector[f"{cid}_{proto}"] = "---"
|
||||||
m = f"{'Link' if action=='linking' else 'Unlinked'} {dest}"
|
m = f"{'Link' if g_action=='linking' else 'Unlinked'} {g_dest}"
|
||||||
|
|
||||||
if m:
|
# 2. Parsing testuale (usato per gli status testuali)
|
||||||
save_to_sqlite(cid, {'src_id': "🌐 " + m, 'dst_id': 'NET'}, protocol=proto)
|
elif 'status' in data:
|
||||||
|
raw_msg = str(data['status'].get('message', 'IDLE'))
|
||||||
|
msg_lower = raw_msg.lower()
|
||||||
|
m = raw_msg
|
||||||
|
|
||||||
|
# A. NXDN: Connessione tramite RF
|
||||||
|
if "switched to reflector" in msg_lower:
|
||||||
|
match = re.search(r'switched to reflector (\w+)', msg_lower)
|
||||||
|
if match:
|
||||||
|
state.gateway_states[cid][proto] = {"action": "linked", "dest": match.group(1).upper()}
|
||||||
|
state.notify_update()
|
||||||
|
|
||||||
|
# B. YSF/NXDN: Connessione standard
|
||||||
|
elif "linked to" in msg_lower:
|
||||||
|
idx = msg_lower.find("linked to")
|
||||||
|
dest = raw_msg[idx + 9:].strip()
|
||||||
|
state.gateway_states[cid][proto] = {"action": "linked", "dest": dest}
|
||||||
|
state.notify_update()
|
||||||
|
|
||||||
|
# C. Connessione in corso
|
||||||
|
elif "linking to" in msg_lower:
|
||||||
|
idx = msg_lower.find("linking to")
|
||||||
|
dest = raw_msg[idx + 10:].strip()
|
||||||
|
state.gateway_states[cid][proto] = {"action": "linking", "dest": dest}
|
||||||
|
state.notify_update()
|
||||||
|
|
||||||
|
# D. Disconnessione o arresto del demone (Azzera la memoria)
|
||||||
|
elif "unlinked" in msg_lower or "disconnected" in msg_lower or "not linked" in msg_lower or "failed" in msg_lower or "stopping" in msg_lower:
|
||||||
|
state.gateway_states[cid][proto] = {"action": "unlinked", "dest": ""}
|
||||||
|
state.notify_update()
|
||||||
|
|
||||||
|
# E. Avvio del demone
|
||||||
|
elif "starting" in msg_lower or "opening" in msg_lower or "idle" in msg_lower:
|
||||||
|
# Azzera il badge SOLO se non è appena stato registrato un "Link" fulmineo
|
||||||
|
current_act = state.gateway_states.get(cid, {}).get(proto, {}).get("action")
|
||||||
|
if current_act not in ["linked", "linking"]:
|
||||||
|
state.gateway_states[cid][proto] = {"action": "idle", "dest": ""}
|
||||||
|
state.notify_update()
|
||||||
|
|
||||||
|
# Salvataggio nel DB per la console log
|
||||||
|
if m and "running" not in m.lower():
|
||||||
|
save_to_sqlite(cid, {'src_id': f"🌐 {m}", 'dst_id': 'NET'}, protocol=proto)
|
||||||
|
|
||||||
# --- 8. TRAFFICO VOCE MMDVM (DMR & MODI DIGITALI) ---
|
# --- 8. TRAFFICO VOCE MMDVM (DMR & MODI DIGITALI) ---
|
||||||
elif parts[0] == 'mmdvm':
|
elif parts[0] == 'mmdvm':
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ def run_diagnostics():
|
|||||||
cur.execute("""
|
cur.execute("""
|
||||||
SELECT LOWER(client_id), AVG(ber), COUNT(*)
|
SELECT LOWER(client_id), AVG(ber), COUNT(*)
|
||||||
FROM radio_logs
|
FROM radio_logs
|
||||||
WHERE timestamp >= datetime('now', 'localtime', '-2 hours')
|
WHERE timestamp >= datetime('now', 'localtime', '-5 minutes')
|
||||||
AND source_id NOT LIKE '🌐%'
|
AND source_id NOT LIKE '🌐%'
|
||||||
AND (source_conn IS NULL OR LOWER(source_conn) != 'network')
|
AND (source_conn IS NULL OR LOWER(source_conn) != 'network')
|
||||||
GROUP BY LOWER(client_id)
|
GROUP BY LOWER(client_id)
|
||||||
@@ -60,7 +60,7 @@ def run_diagnostics():
|
|||||||
|
|
||||||
for cid, avg_ber, cnt in rows:
|
for cid, avg_ber, cnt in rows:
|
||||||
key_ber = f"{cid}_BER"
|
key_ber = f"{cid}_BER"
|
||||||
if cnt >= 5 and avg_ber is not None and avg_ber >= 5.0:
|
if cnt >= 2 and avg_ber is not None and avg_ber >= 5.0:
|
||||||
new_warnings.setdefault(cid, []).append(f"⚠️ Alto BER RF ({avg_ber:.1f}%)")
|
new_warnings.setdefault(cid, []).append(f"⚠️ Alto BER RF ({avg_ber:.1f}%)")
|
||||||
if not watchdog_notified.get(key_ber):
|
if not watchdog_notified.get(key_ber):
|
||||||
broadcast_push_notification(f"⚠️ ANOMALIA RF: {cid.upper()}", f"Rilevato BER medio del {avg_ber:.1f}% negli ultimi {cnt} passaggi RF.", cid=cid)
|
broadcast_push_notification(f"⚠️ ANOMALIA RF: {cid.upper()}", f"Rilevato BER medio del {avg_ber:.1f}% negli ultimi {cnt} passaggi RF.", cid=cid)
|
||||||
|
|||||||
+72
-16
@@ -1,4 +1,5 @@
|
|||||||
// --- VARIABILI GLOBALI E UI VIEW ---
|
// --- VARIABILI GLOBALI E UI VIEW ---
|
||||||
|
const HANG_TIME_MS = 3000;
|
||||||
let clients = [];
|
let clients = [];
|
||||||
let me = { logged_in: false, user: '', role: '', allowed_nodes: '' };
|
let me = { logged_in: false, user: '', role: '', allowed_nodes: '' };
|
||||||
let isAuthenticated = false;
|
let isAuthenticated = false;
|
||||||
@@ -27,6 +28,9 @@ function switchView(viewName) {
|
|||||||
document.getElementById(`tab-${viewName}`).classList.add('active');
|
document.getElementById(`tab-${viewName}`).classList.add('active');
|
||||||
localStorage.setItem('fleetDefaultView', viewName);
|
localStorage.setItem('fleetDefaultView', viewName);
|
||||||
|
|
||||||
|
// Riporta la pagina in cima con un'animazione fluida
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
|
||||||
if (viewName === 'nodes') { applyViewMode(); }
|
if (viewName === 'nodes') { applyViewMode(); }
|
||||||
else if (viewName === 'map') {
|
else if (viewName === 'map') {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -205,6 +209,11 @@ async function initUI() {
|
|||||||
statSelect.innerHTML = opts;
|
statSelect.innerHTML = opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const limitSel = document.getElementById('log-limit-select');
|
||||||
|
if (limitSel) {
|
||||||
|
limitSel.value = localStorage.getItem('fleetLogLimit') || '60';
|
||||||
|
|
||||||
|
}
|
||||||
const grid = document.getElementById('client-grid');
|
const grid = document.getElementById('client-grid');
|
||||||
const authContainer = document.getElementById('auth-container');
|
const authContainer = document.getElementById('auth-container');
|
||||||
const role = me.role || '';
|
const role = me.role || '';
|
||||||
@@ -544,19 +553,23 @@ async function refreshStates() {
|
|||||||
activeGatewaysStr += gw.proto.toLowerCase() + ",";
|
activeGatewaysStr += gw.proto.toLowerCase() + ",";
|
||||||
let stateInfo = gwData[gw.proto] || { action: 'IDLE', dest: '---' };
|
let stateInfo = gwData[gw.proto] || { action: 'IDLE', dest: '---' };
|
||||||
let action = (stateInfo.action || 'IDLE').toLowerCase();
|
let action = (stateInfo.action || 'IDLE').toLowerCase();
|
||||||
let dest = stateInfo.dest && stateInfo.dest !== '---' ? stateInfo.dest : '';
|
let dest = stateInfo.dest && stateInfo.dest !== '---' && stateInfo.dest.toUpperCase() !== 'IDLE' ? stateInfo.dest : '';
|
||||||
|
|
||||||
let badgeBg, badgeColor, badgeBorder, suffix = '', extraClass = '';
|
let badgeBg, badgeColor, badgeBorder, suffix = '', extraClass = '';
|
||||||
|
|
||||||
if (action === 'linking' || action === 'linked' || (dest !== '' && action !== 'unlinked' && action !== 'failed')) {
|
if (action === 'linking') {
|
||||||
|
badgeBg = gw.color;
|
||||||
|
badgeColor = 'white';
|
||||||
|
badgeBorder = gw.color;
|
||||||
|
suffix = dest ? `: ${dest} [LINKING]` : ` [LINKING]`;
|
||||||
|
} else if (action === 'linked' || (dest !== '' && action !== 'unlinked' && action !== 'failed' && action !== 'status')) {
|
||||||
badgeBg = gw.color;
|
badgeBg = gw.color;
|
||||||
badgeColor = 'white';
|
badgeColor = 'white';
|
||||||
badgeBorder = gw.color;
|
badgeBorder = gw.color;
|
||||||
if (dest) suffix = `: ${dest}`;
|
if (dest) suffix = `: ${dest}`;
|
||||||
else suffix = ` [LINKING]`;
|
|
||||||
} else if (action === 'failed') {
|
} else if (action === 'failed') {
|
||||||
badgeBg = 'var(--danger)';
|
badgeBg = 'rgba(239, 68, 68, 0.25)';
|
||||||
badgeColor = 'white';
|
badgeColor = '#fca5a5';
|
||||||
badgeBorder = 'var(--danger)';
|
badgeBorder = 'var(--danger)';
|
||||||
suffix = ' [FAILED]';
|
suffix = ' [FAILED]';
|
||||||
extraClass = 'blink';
|
extraClass = 'blink';
|
||||||
@@ -573,12 +586,13 @@ async function refreshStates() {
|
|||||||
|
|
||||||
if (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) {
|
if (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) {
|
||||||
gwData['DMR_NETS'].forEach(netName => {
|
gwData['DMR_NETS'].forEach(netName => {
|
||||||
let netText = `DMR: ${esc(netName)}${esc(suffix)}`;
|
let netSuffix = (action === 'linking') ? ' [LINKING]' : (action === 'failed' ? ' [FAILED]' : (dest && action !== 'status' ? `: ${dest}` : ''));
|
||||||
gwHtml += `<span class="${extraClass}" style="font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; font-weight: 800; padding: 3px 6px; border-radius: 4px; border: 1px solid ${badgeBorder}; background: ${badgeBg}; color: ${badgeColor}; transition: all 0.3s ease;" title="Stato: ${action.toUpperCase()}">${netText}</span>`;
|
let netText = `DMR: ${esc(netName)}${esc(netSuffix)}`;
|
||||||
|
gwHtml += `<span class="${extraClass}" style="font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; font-weight: 800; padding: 3px 6px; border-radius: 4px; border: 1px solid ${badgeBorder}; background: ${badgeBg}; color: ${badgeColor} !important; transition: all 0.3s ease;" title="Stato: ${action.toUpperCase()}">${netText}</span>`;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let text = `${gw.label}${esc(suffix)}`;
|
let text = `${gw.label}${esc(suffix)}`;
|
||||||
gwHtml += `<span class="${extraClass}" style="font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; font-weight: 800; padding: 3px 6px; border-radius: 4px; border: 1px solid ${badgeBorder}; background: ${badgeBg}; color: ${badgeColor}; transition: all 0.3s ease;" title="Stato: ${action.toUpperCase()}">${text}</span>`;
|
gwHtml += `<span class="${extraClass}" style="font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; font-weight: 800; padding: 3px 6px; border-radius: 4px; border: 1px solid ${badgeBorder}; background: ${badgeBg}; color: ${badgeColor} !important; transition: all 0.3s ease;" title="Stato: ${action.toUpperCase()}">${text}</span>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -699,18 +713,49 @@ async function refreshStates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isOnline) {
|
if (isOnline) {
|
||||||
miniCard.style.borderColor = (warns.length > 0) ? "#f59e0b" : "var(--success)";
|
let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0);
|
||||||
|
let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS);
|
||||||
|
|
||||||
miniCard.style.opacity = "1";
|
miniCard.style.opacity = "1";
|
||||||
miniCard.style.filter = "none";
|
miniCard.style.filter = "none";
|
||||||
miniStatus.innerText = (warns.length > 0) ? "⚠️ ALERT" : stateValue;
|
|
||||||
miniStatus.title = (warns.length > 0) ? warns.join(" | ") : stateValue;
|
if (showActiveColor) {
|
||||||
miniStatus.style.color = (warns.length > 0) ? "#f59e0b" : "var(--success)";
|
let shadowRGB = '59, 130, 246';
|
||||||
miniStatus.style.background = (warns.length > 0) ? "rgba(245, 158, 11, 0.15)" : "rgba(16, 185, 129, 0.1)";
|
if (activeModeColor === '#10b981') shadowRGB = '16, 185, 129';
|
||||||
miniStatus.style.borderColor = (warns.length > 0) ? "rgba(245, 158, 11, 0.4)" : "rgba(16, 185, 129, 0.2)";
|
else if (activeModeColor === '#8b5cf6') shadowRGB = '139, 92, 246';
|
||||||
|
else if (activeModeColor === '#06b6d4') shadowRGB = '6, 182, 212';
|
||||||
|
else if (activeModeColor === '#f59e0b') shadowRGB = '245, 158, 11';
|
||||||
|
|
||||||
|
miniCard.style.borderColor = activeModeColor;
|
||||||
|
miniCard.style.boxShadow = `0 0 15px rgba(${shadowRGB}, 0.5)`;
|
||||||
|
miniStatus.innerText = "🎙️ TX";
|
||||||
|
miniStatus.title = "Transmitting...";
|
||||||
|
miniStatus.style.color = "#ffffff";
|
||||||
|
miniStatus.style.background = activeModeColor;
|
||||||
|
miniStatus.style.borderColor = activeModeColor;
|
||||||
|
}
|
||||||
|
else if (warns.length > 0) {
|
||||||
|
miniCard.style.borderColor = "#f59e0b";
|
||||||
|
miniCard.style.boxShadow = "none";
|
||||||
|
miniStatus.innerText = "⚠️ ALERT";
|
||||||
|
miniStatus.title = warns.join(" | ");
|
||||||
|
miniStatus.style.color = "#f59e0b";
|
||||||
|
miniStatus.style.background = "rgba(245, 158, 11, 0.15)";
|
||||||
|
miniStatus.style.borderColor = "rgba(245, 158, 11, 0.4)";
|
||||||
|
} else {
|
||||||
|
miniCard.style.borderColor = "var(--success)";
|
||||||
|
miniCard.style.boxShadow = "none";
|
||||||
|
miniStatus.innerText = stateValue;
|
||||||
|
miniStatus.title = stateValue;
|
||||||
|
miniStatus.style.color = "var(--success)";
|
||||||
|
miniStatus.style.background = "rgba(16, 185, 129, 0.1)";
|
||||||
|
miniStatus.style.borderColor = "rgba(16, 185, 129, 0.2)";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
miniCard.style.borderColor = "var(--border-color)";
|
miniCard.style.borderColor = "var(--border-color)";
|
||||||
miniCard.style.opacity = "0.6";
|
miniCard.style.opacity = "0.6";
|
||||||
miniCard.style.filter = "grayscale(80%)";
|
miniCard.style.filter = "grayscale(80%)";
|
||||||
|
miniCard.style.boxShadow = "none";
|
||||||
miniStatus.innerText = "OFFLINE";
|
miniStatus.innerText = "OFFLINE";
|
||||||
miniStatus.title = "OFFLINE";
|
miniStatus.title = "OFFLINE";
|
||||||
miniStatus.style.color = "var(--danger)";
|
miniStatus.style.color = "var(--danger)";
|
||||||
@@ -728,16 +773,27 @@ async function refreshStates() {
|
|||||||
} catch (e) { console.error(e); }
|
} catch (e) { console.error(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeLogLimit(val) {
|
||||||
|
localStorage.setItem('fleetLogLimit', val);
|
||||||
|
refreshLogs();
|
||||||
|
}
|
||||||
|
|
||||||
async function refreshLogs() {
|
async function refreshLogs() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/logs'); const logs = await res.json();
|
const savedLimit = localStorage.getItem('fleetLogLimit') || '';
|
||||||
|
const url = savedLimit ? `/api/logs?limit=${encodeURIComponent(savedLimit)}` : '/api/logs';
|
||||||
|
const res = await fetch(url); const logs = await res.json();
|
||||||
const tbody = document.getElementById('log-body'); let tableHTML = ""; let networkLogs = {};
|
const tbody = document.getElementById('log-body'); let tableHTML = ""; let networkLogs = {};
|
||||||
logs.forEach(row => {
|
logs.forEach(row => {
|
||||||
const time = row[0] ? row[0].split(' ')[1] : "--:--";
|
const time = row[0] ? row[0].split(' ')[1] : "--:--";
|
||||||
const clientId = row[1]; const protocol = row[2] || "DMR"; let source = row[3] || "---"; const target = row[4] || "---";
|
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];
|
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);
|
let sourceHtml = esc(source);
|
||||||
|
if (!source.includes("🌐") && /[a-zA-Z]/.test(source)) {
|
||||||
|
let cleanCall = source.split(' ')[0].trim();
|
||||||
|
sourceHtml = `<a href="https://www.qrz.com/db/${encodeURIComponent(cleanCall)}" target="_blank" rel="noopener noreferrer" style="color: inherit; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); text-underline-offset: 3px; font-weight: inherit;">${esc(source)}</a>`;
|
||||||
|
}
|
||||||
if (source_ext && source_ext.trim() !== "") { sourceHtml += ` <span style="font-size:0.8em; color:var(--text-muted); font-family:'JetBrains Mono', monospace;">/${esc(source_ext)}</span>`; }
|
if (source_ext && source_ext.trim() !== "") { sourceHtml += ` <span style="font-size:0.8em; color:var(--text-muted); font-family:'JetBrains Mono', monospace;">/${esc(source_ext)}</span>`; }
|
||||||
|
|
||||||
let slotDisplay = rawSlot && String(rawSlot).trim() !== "" && rawSlot !== "undefined" ? (protocol === "DMR" && !String(rawSlot).toUpperCase().startsWith("TS") ? `TS${rawSlot}` : rawSlot) : "---";
|
let slotDisplay = rawSlot && String(rawSlot).trim() !== "" && rawSlot !== "undefined" ? (protocol === "DMR" && !String(rawSlot).toUpperCase().startsWith("TS") ? `TS${rawSlot}` : rawSlot) : "---";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// --- SISTEMA TRADUZIONI (i18n) & HELPERS ---
|
// --- SISTEMA TRADUZIONI (i18n) & HELPERS ---
|
||||||
const i18n = {
|
const i18n = {
|
||||||
en: {
|
en: {
|
||||||
|
lblLogLimit: "Rows:",
|
||||||
lastTransits: "Lastheard", loginTitle: "🔒 System Login",
|
lastTransits: "Lastheard", loginTitle: "🔒 System Login",
|
||||||
thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration",
|
thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration",
|
||||||
thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions",
|
thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions",
|
||||||
@@ -31,6 +32,7 @@ const i18n = {
|
|||||||
filtAll: "All Nodes", filtOnline: "Online", filtOffline: "Offline", filtAlerts: "⚠️ Alerts"
|
filtAll: "All Nodes", filtOnline: "Online", filtOffline: "Offline", filtAlerts: "⚠️ Alerts"
|
||||||
},
|
},
|
||||||
it: {
|
it: {
|
||||||
|
lblLogLimit: "Righe:",
|
||||||
lastTransits: "Ultimi ascolti", loginTitle: "🔒 Login di Sistema",
|
lastTransits: "Ultimi ascolti", loginTitle: "🔒 Login di 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",
|
||||||
|
|||||||
+14
-3
@@ -84,9 +84,20 @@
|
|||||||
<h3 style="margin: 0; font-weight: 800; display: flex; align-items: center; gap: 10px; color: var(--text-main);">
|
<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="lastTransits">Lastheard</span>
|
<span style="font-size: 1.5rem;">📡</span> <span data-i18n="lastTransits">Lastheard</span>
|
||||||
</h3>
|
</h3>
|
||||||
<select id="stat-node-filter" onchange="refreshStats(); refreshLogs();" style="font-weight: bold; cursor: pointer;">
|
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
|
||||||
<option value="all">🌐 ALL NODES</option>
|
<div style="display: flex; align-items: center; gap: 6px;">
|
||||||
</select>
|
<label for="log-limit-select" data-i18n="lblLogLimit" style="font-size: 0.8rem; color: var(--text-muted); font-weight: 600;">Righe:</label>
|
||||||
|
<select id="log-limit-select" onchange="changeLogLimit(this.value)" style="font-weight: bold; cursor: pointer; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-color); background: rgba(0,0,0,0.2); color: var(--text-main);">
|
||||||
|
<option value="30">30</option>
|
||||||
|
<option value="60">60</option>
|
||||||
|
<option value="100">100</option>
|
||||||
|
<option value="200">200</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<select id="stat-node-filter" onchange="refreshStats(); refreshLogs();" style="font-weight: bold; cursor: pointer;">
|
||||||
|
<option value="all">🌐 ALL NODES</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-container" style="margin-bottom: 0;">
|
<div class="table-container" style="margin-bottom: 0;">
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
Reference in New Issue
Block a user