Compare commits

..
38 Commits
Author SHA1 Message Date
iv3jdv 8fc08f1c23 reaorganize home header 2026-11-03 15:04:19 +01:00
iv3jdv 66cd63a181 feat(ui,api): layout mini-card fisso, nominativo tx pulito, cache-busting index e check Gitea asincrono 2026-11-03 13:03:55 +01:00
iv3jdv 36def1e201 fix mini-card width v2 2026-11-02 22:52:27 +01:00
iv3jdv a6c24244bd fix mini-card width 2026-11-02 22:43:47 +01:00
iv3jdv 502dcc2f65 Restyling badge 2026-11-02 22:31:44 +01:00
iv3jdv d4e83364e2 add time/date 2026-11-02 22:01:51 +01:00
iv3jdv fa4b3d8df2 fix mode spacing 2026-11-01 20:09:40 +01:00
iv3jdv a67ddd582c feat(ui): aggiunto supporto per i modi FM e M17 nei toggle operativi 2026-11-01 18:57:06 +01:00
iv3jdv 7ee7b00b37 fix(ui): restyling chip gateway ad alto contrasto e parsing aprs raw 2026-11-01 14:28:25 +01:00
iv3jdv ebaefeeedf fix(aprs): parsing stringhe raw ax25 e mapping colonna path 2026-11-01 11:41:45 +01:00
iv3jdv 2e8b75c384 feat(ui): implementazione multi-layout (Blueprint, Tactical, Light, Glass) e fix visivi 2026-11-01 10:52:20 +01:00
iv3jdv a56da30330 restored interactive map 2026-11-01 09:42:44 +01:00
iv3jdv 9b7c76c801 fix(telemetry): allineamento stati hangtime e risoluzione falsi positivi sui beacon
- Backend (mqtt_service.py): Aggiunta logica per intercettare i pacchetti beacon in assenza di traffico voce. Il sistema ora pulisce la memoria dei modi alternativi (es. D-Star/YSF) se il beacon è DMR, prevenendo il blocco dell'interfaccia su un vecchio protocollo.
- Frontend (app.js): La memorizzazione del colore e del modo per la gestione dell'hangtime (Hold) ora scatta con la condizione `!isIdle` anziché solo con il PTT voce (`isTx`).
- I badge della dashboard Home ora mostrano coerentemente il protocollo corretto per tutta la durata dell'hangtime, sia dopo un passaggio voce che dopo un beacon di rete.
2026-11-01 09:31:40 +01:00
iv3jdv bf4a669446 fix badge color 2026-10-31 21:42:26 +01:00
iv3jdv e92a37f02a fix(modes): visibilità pannello admin e sincronizzazione hangtime MQTT
- Nascosto il pannello "Operating Modes" per gli utenti non autenticati o senza permessi admin, risolvendo l'errore 403 e il falso allarme "CFG MEMORY EMPTY".
- Risolto il bug dell'hangtime RF (Hold) a fine trasmissione: rimosso il timer asincrono locale lato frontend.
- La UI ora legge lo stato di hold sincronizzandosi esclusivamente col flag "idle" in arrivo dal broker MQTT (MMDVMHost).
- Mantenimento corretto a schermo dell'ultimo modo operativo utilizzato (es. [ DMR ] o [ NXDN ]) durante l'intera durata della coda del ponte.
2026-10-31 21:18:33 +01:00
iv3jdv 2456f462fe fix secure mode change 2026-10-31 20:49:05 +01:00
iv3jdv 34180df506 feat(modes): controllo interattivo modi operativi MMDVM e sync gateway
- Aggiunti pulsanti toggle interattivi per DMR, YSF, D-Star, NXDN e P25 nella vista Focus
- Aggiornamento automatico e persistenza del file di configurazione MMDVMHost
- Sincronizzazione automatica start/stop dei relativi demoni Gateway al cambio modo
- Aggiornamento ottimistico dell'interfaccia utente con feedback visivo immediato
- Allineamento immediato della cache backend in memoria al salvataggio config
2026-10-31 20:27:16 +01:00
iv3jdv 99c5d4f431 fix enable/disable mode 2026-10-31 16:45:20 +01:00
iv3jdv c47377a22c add enable/disable mode 2026-10-31 16:32:31 +01:00
iv3jdv b684976665 fix get data 2026-10-31 15:50:40 +01:00
iv3jdv 77edeef8ac fix dstar mode tx 2026-10-31 15:20:08 +01:00
iv3jdv 68fe4f9d61 fix header badge align 2026-10-31 15:03:23 +01:00
iv3jdv eea2fae2d4 remove backdrop-filter: blur() 2026-10-31 14:50:27 +01:00
iv3jdv ea505f22aa restore hangtime/idle 2026-10-31 14:40:36 +01:00
iv3jdv 5a21cf8eb9 add color tx mode badge 2026-10-31 14:31:17 +01:00
iv3jdv 793b06b4e3 feat: aggiunta Focus Mode e tab decodifica traffico APRS 2026-10-31 13:58:04 +01:00
iv3jdv 2ed2ea58ea feat: implementato nuovo layout Blueprint CAD 2026-10-31 12:32:59 +01:00
iv3jdv 35f1598393 feat(ui): feedback visivo TX sui mini-badge della home
Implementato il riconoscimento dello stato di trasmissione nei mini-badge della schermata principale. I badge ora si illuminano mostrando '🎙️ TX' con bordo e ombreggiatura dinamica abbinata al colore del modo digitale attivo (DMR, YSF, NXDN, ecc.), prioritizzando la visibilità del transito.
2026-10-25 15:52:10 +01:00
iv3jdv 9a4dc1eea7 feat(mqtt): supporto coordinate e info da DMRGateway
Aggiunto 'dmrgateway' ai topic validi per il recupero dei dati di geolocalizzazione (Lat, Lon, Loc). Implementato il merge incrementale dei parametri per permettere a MMDVMHost e DMRGateway di popolare le info del nodo senza sovrascriversi a vicenda, in previsione della deprecazione della sezione [Info] su MMDVM.
2026-10-25 15:22:51 +01:00
iv3jdv be0cbbb64b fix scroll home 2026-10-25 12:42:55 +01:00
iv3jdv 6d11c355df fix(watchdog): ridotta finestra temporale alert BER a 5 minuti
Aggiornata la query di analisi diagnostica nel watchdog per calcolare la media del BER sugli ultimi 5 minuti (invece di 2 ore). Ridotto il numero minimo di transiti necessari per l'innesco, garantendo un feedback immediato nella dashboard e la scomparsa rapida dell'allarme in assenza di traffico degradato.
2026-10-25 12:28:20 +01:00
iv3jdv efca23c64f feat(logs): limite configurabile e selettore righe Last Heard con i18n
Aggiunto il supporto per definire il numero di righe del Last Heard tramite configurazione (config.json) e query string (?limit=). Inserito nel frontend un selettore a tendina con persistenza in localStorage ed etichetta bilingue (IT/EN).
2026-10-25 11:54:20 +01:00
iv3jdv 69308c4580 fix(mqtt): parsing intelligente stati gateway YSF e NXDN" -m "Risolto il problema di visualizzazione dei badge YSF e NXDN nella dashboard. Aggiunto il parsing testuale dei messaggi MQTT per intercettare correttamente le connessioni ('Linked to', 'Switched to reflector') e le disconnessioni ('stopping'), ignorando i messaggi di heartbeat ed evitando che la fase di avvio cancelli lo stato del reflector appena agganciato 2026-10-25 11:14:09 +01:00
iv3jdv a39389fe1a docs: aggiornamento finale README dopo sincronizzazione 2026-10-25 09:14:27 +01:00
iv3jdv a934a53898 feat(ui): aggiunti link a qrz.com per i nominativi nel last heard
Resi cliccabili i nominativi radio nella tabella dei log. Cliccando su un callsign si apre automaticamente la relativa pagina di ricerca su QRZ.com in una nuova scheda, filtrando in automatico gli ID di rete o puramente numerici.
2026-10-25 09:13:03 +01:00
iv3jdv 81eff4300d Update README.md 2026-10-24 19:26:58 +02:00
iv3jdv b6f1993e26 update CSS 2026-10-24 18:55:05 +02:00
iv3jdv 164525e035 add HANG_TIME 2026-10-24 18:16:46 +02:00
13 changed files with 2063 additions and 897 deletions
+62 -49
View File
@@ -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.
### 🏗️ Architecture & Technology Stack
The server acts as the brain of the network:
* **Backend:** Flask (Python) with `gevent` for high-concurrency handling.
The server acts as the brain of the network, built on a highly scalable foundation (v5.0+):
* **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.
* **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
#### 🛡️ 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
* **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.
* **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
* Get instant, native alerts directly on your desktop or mobile device when:
* A node goes offline or comes back online.
* 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.
#### 🛠️ 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
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:
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:
```bash
sudo a2enmod proxy_wstunnel rewrite headers
```
@@ -58,26 +80,10 @@ 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.
* **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
#### 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
apt update
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
Clone the repository into the /opt directory to ensure all systemd paths work correctly:
```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
```
#### 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.
### 🏗️ Architettura e Tecnologie
Il server agisce da cervello della rete:
* **Backend:** Flask (Python) con `gevent` per la gestione ad alta concorrenza.
Il server agisce da cervello della rete, basato su fondamenta altamente scalabili (v5.0+):
* **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.
* **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
#### 🛡️ 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
* **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.
* **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
* Ricevi avvisi nativi e immediati su PC o smartphone quando:
* Un nodo va offline o torna operativo.
* 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.
#### 🛠️ 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
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.
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:
```bash
sudo a2enmod proxy_wstunnel rewrite headers
@@ -169,26 +198,10 @@ 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.
* **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
#### 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
apt update
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
Clona il repository nella cartella /opt per assicurarti che tutti i percorsi dei servizi systemd siano corretti:
```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
```
#### 2. Setup Ambiente Virtuale (Consigliato)
+4 -2
View File
@@ -15,7 +15,8 @@
"dstar-gateway/+/json",
"mmdvm/+/json",
"devices/#",
"data/#"
"data/#",
"aprs-gateway/aprs"
]
},
"web_admin": {
@@ -39,5 +40,6 @@
"nxdn": "https://radioid.net/static/nxdn.csv"
},
"log_max_mb": 50,
"log_backup_count": 10
"log_backup_count": 10,
"last_heard_limit": 60
}
+1
View File
@@ -47,6 +47,7 @@ node_versions = {}
gateway_states = {}
active_warnings = {}
active_calls = {}
operating_modes = {}
# Caricamento iniziale cache telemetria
if os.path.exists(CACHE_FILE):
Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 34 KiB

+44 -15
View File
@@ -15,6 +15,10 @@ from services.mqtt_service import mqtt_publish
from services.push_service import node_allowed
from routes.auth_routes import get_auth, json_body, err
# --- AGGIUNTE PER GITEA BACKGROUND CHECK ---
GLOBAL_SERVER_UPDATE_AVAILABLE = False
LAST_GITEA_CHECK_TIME = 0
api_bp = Blueprint('api', __name__)
# --- REGEX & COSTANTI COMANDI ---
@@ -47,10 +51,20 @@ def get_clients():
@api_bp.route('/api/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)
c = conn.cursor()
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()
conn.close()
return jsonify(logs)
@@ -94,7 +108,8 @@ def get_states():
"uptime": int(time.time() - state.START_TIME),
"versions": clean_versions,
"gateway_states": enriched_gateway_states,
"warnings": state.active_warnings
"warnings": state.active_warnings,
"modes": getattr(state, "operating_modes", {})
})
@api_bp.route('/api/stats')
@@ -117,7 +132,7 @@ def get_stats():
top_tgs = [{"target": row[0], "count": row[1]} for row in c.fetchall()]
c.execute(f"""SELECT source_id, COUNT(*) as cnt FROM radio_logs
WHERE source_id NOT LIKE '🌐%'
WHERE source_id NOT LIKE '倹%'
AND timestamp >= date('now', 'localtime') AND timestamp < date('now', 'localtime', '+1 day'){node_filter}
GROUP BY source_id ORDER BY cnt DESC LIMIT 5""", params)
top_calls = [{"call": row[0], "count": row[1]} for row in c.fetchall()]
@@ -171,7 +186,7 @@ def cmd():
return err("Broker MQTT non raggiungibile - comando non inviato", 503)
audit(auth['username'], cid, cmd_type)
state.client_telemetry[cid] = {"ts1": "🔄 Inviato...", "ts2": "🔄 Inviato...", "alt": ""}
state.client_telemetry[cid] = {"ts1": "売 Inviato...", "ts2": "売 Inviato...", "alt": ""}
return jsonify({"success": True})
@api_bp.route('/api/global_command', methods=['POST'])
@@ -232,7 +247,7 @@ def update_nodes():
return err("Non autorizzato", 403)
if not mqtt_publish("devices/control/request", "update"):
return err("Broker MQTT non raggiungibile", 503)
logger.info(f"📢 REQ CONFIG inviata a tutta la flotta da {auth['username']}")
logger.info(f"討 REQ CONFIG inviata a tutta la flotta da {auth['username']}")
audit(auth['username'], '*', 'REQ_CONFIG_ALL')
return jsonify({"success": True})
@@ -336,25 +351,39 @@ def save_config_file():
if not mqtt_publish(f"devices/{cid}/config_set/{service}", json.dumps(new_config)):
return err("Broker MQTT non raggiungibile", 503)
audit(auth['username'], cid, f"EDIT_CONFIG_{service.upper()}")
if cid not in state.device_configs:
state.device_configs[cid] = {}
state.device_configs[cid][service] = new_config
return jsonify({"success": True})
# --- AGGIORNAMENTO SERVER OTA ---
@api_bp.route('/api/server_update/check', methods=['GET'])
def check_server_update():
auth = get_auth()
if not auth or auth['role'] != 'admin':
return err("Non autorizzato", 403)
def background_gitea_check():
global GLOBAL_SERVER_UPDATE_AVAILABLE, LAST_GITEA_CHECK_TIME
try:
subprocess.run(['git', 'fetch'], timeout=10, cwd=BASE_DIR)
local_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=BASE_DIR).decode('utf-8').strip()
remote_hash = subprocess.check_output(['git', 'rev-parse', '@{u}'], cwd=BASE_DIR).decode('utf-8').strip()
update_available = local_hash != remote_hash
return jsonify({"success": True, "update_available": update_available})
GLOBAL_SERVER_UPDATE_AVAILABLE = (local_hash != remote_hash)
LAST_GITEA_CHECK_TIME = time.time()
except Exception as e:
logger.error(f"Errore controllo aggiornamenti server: {e}")
return jsonify({"success": False, "error": "Impossibile verificare aggiornamenti"})
logger.error(f"Errore controllo Gitea in background: {e}")
@api_bp.route('/api/server_update/status', methods=['GET'])
def get_server_update_status():
global LAST_GITEA_CHECK_TIME
auth = get_auth()
if not auth or auth['role'] != 'admin':
return err("Non autorizzato", 403)
# Se è passata più di un'ora (3600 secondi) dall'ultimo controllo, avvia il thread
if time.time() - LAST_GITEA_CHECK_TIME > 3600:
import threading
threading.Thread(target=background_gitea_check, daemon=True).start()
return jsonify({"success": True, "update_available": GLOBAL_SERVER_UPDATE_AVAILABLE})
@api_bp.route('/api/server_update/apply', methods=['POST'])
def apply_server_update():
+119 -32
View File
@@ -182,17 +182,11 @@ def on_message(client, userdata, msg):
logger.error(f"Errore parsing telemetria agent: {e}")
# --- 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:
cid = parts[1].lower()
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):
if str(f).isdigit() and int(f) > 0:
hz = int(f)
@@ -203,16 +197,25 @@ def on_message(client, userdata, msg):
return f"{mhz}.{dec} MHz"
return str(f)
state.node_info[cid] = {
"tx": format_freq(tx),
"rx": format_freq(rx),
"lat": lat,
"lon": lon,
"loc": loc
}
# Inizializza il dizionario se il nodo è nuovo
if cid not in state.node_info:
state.node_info[cid] = {"tx": "0", "rx": "0", "lat": "0.0", "lon": "0.0", "loc": "Sconosciuta"}
# Aggiorna solo i campi effettivamente presenti nel payload per fondere i dati di MMDVM e DMRGateway
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()
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) ---
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost') and parts[3].lower() == 'general':
@@ -241,31 +244,105 @@ def on_message(client, userdata, msg):
if cid not in state.gateway_states:
state.gateway_states[cid] = {}
if 'status' in data:
state.gateway_states[cid][proto] = {"action": "status", "dest": data['status'].get('message', 'IDLE')}
state.notify_update()
elif 'link' in data:
m = "" # Variabile per il log di sistema
# 1. Parsing strutturato (usato per il messaggio "Link IT-YSF-FVG")
if 'link' in data:
l = data['link']
g_dest = str(l.get('reflector') or l.get('talkgroup') or '---').strip()
g_action = l.get('action', '')
state.gateway_states[cid][proto] = {"action": g_action, "dest": g_dest}
state.notify_update()
m = ""
if 'status' in data:
m = data['status'].get('message', '')
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':
if g_action == 'linking':
state.last_seen_reflector[f"{cid}_{proto}"] = g_dest
elif g_action == 'unlinking':
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:
save_to_sqlite(cid, {'src_id': "🌐 " + m, 'dst_id': 'NET'}, protocol=proto)
# 2. Parsing testuale (usato per gli status testuali)
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)
# --- 7.5 EVENTI APRS ---
elif p0 == 'aprsgateway' and len(parts) >= 2 and parts[1].lower() == 'aprs':
try:
if not payload:
return
# Payload RAW APRS: CALLSIGN>DEST,PATH:PAYLOAD
data = {"source": "---", "dest": "---", "path": "", "payload": payload, "time": ""}
if ">" in payload and ":" in payload:
src_part, rest = payload.split(">", 1)
header_part, pld_part = rest.split(":", 1)
header_tokens = header_part.split(",")
dest_part = header_tokens[0]
path_str = ",".join(header_tokens[1:]) if len(header_tokens) > 1 else ""
data["source"] = src_part.strip()
data["dest"] = dest_part.strip()
data["path"] = path_str.strip()
data["payload"] = pld_part.strip()
else:
logger.warning(f"Formato APRS non decodificato: {payload}")
logger.info(f"📍 Inoltro pacchetto APRS al frontend: {data['source']} -> {data['dest']} via [{data['path']}]")
state.socketio.emit('aprs_msg', data)
except Exception as e:
logger.error(f"Errore parsing APRS: {e}")
# --- MODI OPERATIVI MMDVM ---
elif len(parts) == 3 and p0 == 'data' and p2 == 'mmdvm':
try:
cid = parts[1].lower()
state.operating_modes[cid] = json.loads(payload)
state.notify_update()
except Exception as e:
logger.error(f"Errore parsing MMDVM modes per {cid}: {e}")
# --- 8. TRAFFICO VOCE MMDVM (DMR & MODI DIGITALI) ---
elif parts[0] == 'mmdvm':
@@ -282,6 +359,16 @@ def on_message(client, userdata, msg):
state.client_telemetry[cid]["idle"] = False
# --- ALLINEAMENTO MODI PER BEACON ---
curr_mode = data.get('MMDVM', {}).get('mode', '')
if curr_mode:
if curr_mode.upper() == 'DMR':
state.client_telemetry[cid]["alt"] = ""
else:
old_alt = state.client_telemetry[cid].get("alt", "")
if not any(i in old_alt for i in ['🟢','🟣','🔵','🟠']):
state.client_telemetry[cid]["alt"] = f"📡 {curr_mode.upper()} BEACON"
if 'DMR' in data:
d = data['DMR']
act = d.get('action')
+2 -2
View File
@@ -51,7 +51,7 @@ def run_diagnostics():
cur.execute("""
SELECT LOWER(client_id), AVG(ber), COUNT(*)
FROM radio_logs
WHERE timestamp >= datetime('now', 'localtime', '-2 hours')
WHERE timestamp >= datetime('now', 'localtime', '-5 minutes')
AND source_id NOT LIKE '🌐%'
AND (source_conn IS NULL OR LOWER(source_conn) != 'network')
GROUP BY LOWER(client_id)
@@ -60,7 +60,7 @@ def run_diagnostics():
for cid, avg_ber, cnt in rows:
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}%)")
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)
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

+279
View File
@@ -0,0 +1,279 @@
/* =========================================
LAYOUT 2: TACTICAL (Ispirato alla versione dark/ambra)
========================================= */
body.layout-tactical {
--bg-main: #111318;
--card-bg: #1c2128;
--primary: #f5b041; /* Giallo/Ambra */
--accent: #c0392b; /* Rosso scuro */
--success: #2ecc71; /* Verde */
--danger: #e74c3c;
--text-main: #e6edf3;
--text-muted: #7d8590;
--border-main: #444c56;
--border-light: #30363d;
background-color: var(--bg-main);
}
body.layout-tactical .card, body.layout-tactical .modal-content {
background: var(--card-bg) !important;
border: 1px solid var(--border-light) !important;
border-radius: 4px !important;
box-shadow: 0 4px 10px rgba(0,0,0,0.4) !important;
}
body.layout-tactical .title-brand {
color: var(--primary);
}
body.layout-tactical .tactical-led {
border-radius: 2px !important; /* LED quadrati e rigidi */
}
body.layout-tactical .terminal-log {
background: #0d1117;
border-color: var(--border-light);
}
/* =========================================
LAYOUT 3: LIGHT (Clean & Bright - Modalità diurna)
========================================= */
body.layout-light {
--bg-main: #f8fafc;
--card-bg: #ffffff;
--primary: #0ea5e9; /* Azzurro pulito */
--accent: #8b5cf6;
--success: #10b981;
--danger: #ef4444;
--text-main: #1e293b;
--text-muted: #64748b;
--border-main: #cbd5e1;
--border-light: #e2e8f0;
background-color: var(--bg-main) !important;
background-image: none !important; /* Rimozione della griglia blueprint! */
color: var(--text-main);
}
/* --- Override for the main layout grid from original style.css --- */
body.layout-light div.card,
body.layout-light div.modal-content,
body.layout-light div.mini-card {
background: #ffffff !important;
border: 1px solid var(--border-main) !important;
border-radius: 8px !important;
box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
}
body.layout-light .filter-bar {
background: #ffffff !important;
border: 1px solid var(--border-main) !important;
}
body.layout-light .filter-pill {
color: var(--text-muted) !important;
border-color: var(--border-main) !important;
}
body.layout-light .filter-pill.active {
color: var(--primary) !important;
border-color: var(--primary) !important;
background: #f0f9ff !important;
}
body.layout-light .filter-pill:hover {
background: #f8fafc !important;
}
/* Fix per la mappa */
body.layout-light .dark-tiles {
filter: none !important;
-webkit-filter: none !important;
}
body.layout-light .custom-map-pin.pin-online {
background: var(--success);
border-color: #059669;
box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
color: white;
}
body.layout-light .custom-map-pin.pin-offline {
background: var(--danger);
border-color: #b91c1c;
box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
color: white;
}
/* --- Top Bar --- */
body.layout-light #top-bar-container,
body.layout-light #top-bar {
background: #ffffff !important;
border-bottom: 1px solid var(--border-main) !important;
box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}
body.layout-light .title-brand {
color: var(--primary) !important;
text-shadow: none !important;
}
/* Testi scuri sulle mini card */
body.layout-light .mini-card-name {
color: var(--text-main) !important;
font-weight: 600;
}
body.layout-light .mini-card[style*="grayscale"] {
opacity: 0.5 !important;
background: #f1f5f9 !important;
}
/* Bottoni, Tab e Navigazione */
body.layout-light .nav-tab { color: var(--text-muted); }
body.layout-light .nav-tab.active {
color: var(--primary) !important;
border-bottom: 2px solid var(--primary) !important;
background: transparent !important;
}
body.layout-light .theme-switch {
border: 1px solid var(--border-main) !important;
color: var(--text-muted) !important;
background: transparent !important;
}
body.layout-light .btn-cmd {
color: var(--text-main) !important;
border-color: var(--border-main) !important;
background: #ffffff;
}
body.layout-light .btn-cmd:hover {
background: #f1f5f9;
}
/* Fix per i pannelli informativi a bordo */
body.layout-light .freq-bar,
body.layout-light .node-meta,
body.layout-light .health-bar {
border-color: var(--border-light) !important;
color: var(--text-muted) !important;
}
body.layout-light .health-bar span {
border-right-color: var(--border-light) !important;
}
body.layout-light .seen-bar {
border-color: var(--border-light) !important;
}
/* Testo interno delle Card dei Nodi */
body.layout-light .client-name {
color: var(--text-main) !important;
}
body.layout-light .badge-id {
color: var(--text-muted) !important;
}
body.layout-light .type-badge.type-repeater {
color: var(--primary) !important;
border-color: var(--primary) !important;
background: transparent;
}
body.layout-light .status-display {
color: var(--text-main) !important;
border-color: var(--border-light) !important;
}
/* Fix tabelle */
body.layout-light table { background: transparent; }
body.layout-light thead th, body.layout-light thead tr {
background: #f1f5f9 !important;
color: var(--text-muted) !important;
border-bottom: 2px solid var(--border-main) !important;
font-weight: 600;
}
body.layout-light tbody tr, body.layout-light td {
background: #ffffff !important;
border-bottom: 1px solid var(--border-light) !important;
color: var(--text-main) !important;
}
body.layout-light tbody tr:nth-child(even), body.layout-light tbody tr:nth-child(even) td {
background: #f8fafc !important;
}
body.layout-light tbody tr:hover, body.layout-light tbody tr:hover td {
background: #f1f5f9 !important;
}
/* Input */
body.layout-light select, body.layout-light input, body.layout-light textarea {
background: #ffffff !important;
color: var(--text-main) !important;
border: 1px solid var(--border-main) !important;
}
body.layout-light .terminal-log {
background: #f1f5f9 !important;
color: #334155 !important;
border-color: var(--border-main) !important;
}
/* Fix visibilità dei pin mappa nel tema chiaro */
body.layout-light .custom-map-pin {
color: #ffffff !important;
font-weight: bold !important;
font-size: 16px !important;
line-height: 24px !important;
}
body.layout-light .custom-map-pin.pin-online {
background-color: var(--success) !important;
border: 2px solid #059669 !important;
box-shadow: 0 0 12px rgba(16, 185, 129, 0.6) !important;
}
body.layout-light .custom-map-pin.pin-offline {
background-color: var(--danger) !important;
border: 2px solid #b91c1c !important;
box-shadow: 0 0 12px rgba(239, 68, 68, 0.6) !important;
}
body.layout-light .custom-map-pin.pin-tx {
background-color: var(--primary) !important;
border: 2px solid #0284c7 !important;
box-shadow: 0 0 15px rgba(2, 132, 199, 0.8) !important;
}
body.layout-light .custom-map-pin.pin-warn {
background-color: var(--accent) !important;
border: 2px solid #7c3aed !important;
}
/* Fix per i container delle popup di Leaflet */
body.layout-light .leaflet-popup-content-wrapper,
body.layout-light .leaflet-popup-tip {
background: #ffffff !important;
color: var(--text-main) !important;
box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}
body.layout-light .leaflet-popup-content div {
color: var(--text-main);
}
/* =========================================
LAYOUT 4: GLASSMORPHISM & NEON
Layout moderno, traslucido con sfocature
========================================= */
body.layout-glass {
--bg-main: #0f172a;
--primary: #38bdf8;
--accent: #c084fc;
--success: #34d399;
--danger: #fb7185;
--card-bg: rgba(255, 255, 255, 0.03);
--border-light: rgba(255,255,255,0.1);
background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
background-attachment: fixed;
}
body.layout-glass .card, body.layout-glass .modal-content {
background: var(--card-bg) !important;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255,255,255,0.08) !important;
border-radius: 24px !important;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}
body.layout-glass .btn-cmd, body.layout-glass .filter-pill {
border-radius: 12px;
}
body.layout-glass .card-header {
border-bottom: 1px solid rgba(255,255,255,0.05);
padding-bottom: 15px;
}
body.layout-glass input, body.layout-glass select, body.layout-glass textarea {
background: rgba(0,0,0,0.3);
border-radius: 8px;
border: 1px solid rgba(255,255,255,0.1);
}
+126 -90
View File
@@ -1,36 +1,54 @@
/* --- TEMA MODERNO (Soft UI / Tailwind inspired) --- */
/* --- TEMA SCHEMATIC / BLUEPRINT (Disegno Tecnico CAD) --- */
:root {
--primary: #3b82f6; --success: #10b981; --danger: #ef4444; --accent: #8b5cf6;
--bg-gradient: #0f172a;
--card-bg: #1e293b;
--border-color: rgba(255, 255, 255, 0.1);
--text-main: #f8fafc;
--text-muted: #94a3b8;
--topbar-bg: #1e293b;
--bg-base: #06246f;
--grid-color: rgba(123, 198, 255, 0.15);
--border-main: #7bc6ff;
--border-light: rgba(123, 198, 255, 0.4);
--primary: #7bc6ff;
--success: #00ffcc;
--danger: #ff3366;
--accent: #ffcc00;
--text-main: #ffffff;
--text-muted: rgba(255, 255, 255, 0.6);
}
* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg-gradient); margin: 0; padding: 0; color: var(--text-main); min-height: 100vh; }
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-base);
background-image:
linear-gradient(var(--grid-color) 1px, transparent 1px),
linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
background-size: 20px 20px;
margin: 0; padding: 0; color: var(--text-main); min-height: 100vh;
}
#top-bar-container { position: sticky; top: 0; z-index: 100; padding: 15px 20px; display: flex; justify-content: center; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(10px); margin-bottom: 30px; }
#top-bar { background: var(--topbar-bg); padding: 12px 30px; display: flex; justify-content: space-between; align-items: center; border-radius: 12px; border: 1px solid var(--border-color); width: 100%; max-width: 1400px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.title-brand { font-size: 1.2rem; font-weight: 800; letter-spacing: 2px; color: var(--text-main); font-family: 'JetBrains Mono', monospace; }
/* TOP BAR - OTTIMIZZATA RIMUOVENDO BACKDROP-FILTER E RISOLVENDO WRAP */
#top-bar-container { position: sticky; top: 0; z-index: 100; padding: 15px 20px; display: flex; justify-content: center; background: rgba(6, 36, 111, 0.95); border-bottom: 1px solid var(--border-main); margin-bottom: 30px; }
#top-bar { padding: 12px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; border: 1px solid var(--border-main); width: 100%; max-width: 1400px; background: rgba(6, 36, 111, 0.5); }
.title-brand { font-size: 1.2rem; font-weight: 300; letter-spacing: 4px; color: var(--text-main); text-transform: uppercase; white-space: nowrap; flex-shrink: 0; margin-right: 10px;}
.nav-tabs { display: flex; gap: 15px; margin-left: 30px; flex: 1; }
.nav-tab { background: transparent; border: none; color: var(--text-muted); font-size: 0.95rem; font-weight: 800; cursor: pointer; padding: 8px 16px; border-radius: 8px; transition: all 0.2s ease; font-family: 'Inter', sans-serif; letter-spacing: 1px; }
.nav-tab:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.nav-tab.active { color: var(--primary); background: rgba(59, 130, 246, 0.1); }
.nav-tabs { display: flex; gap: 10px; flex: 1 1 auto; min-width: 250px; flex-wrap: wrap; justify-content: flex-start; margin-left: 0;}
.nav-tab { background: transparent; border: 1px solid transparent; color: var(--text-muted); font-size: 0.85rem; font-weight: 300; letter-spacing: 2px; cursor: pointer; padding: 6px 16px; transition: all 0.2s ease; text-transform: uppercase; white-space: nowrap;}
.nav-tab:hover { color: var(--text-main); border: 1px solid var(--border-light); }
.nav-tab.active { color: var(--text-main); border: 1px solid var(--border-main); }
.theme-switch { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.theme-switch:hover { color: var(--text-main); border-color: var(--text-main); }
.theme-switch { background: transparent; border: 1px dashed var(--border-main); color: var(--text-main); padding: 6px 14px; cursor: pointer; font-weight: 300; font-size: 0.75rem; letter-spacing: 1px; transition: all 0.2s ease; text-transform: uppercase; white-space: nowrap;}
.theme-switch:hover { background: rgba(255,255,255,0.1); }
/* Container for right side items (auth and other buttons) */
.top-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; flex: 1 1 auto; }
/* FILTRI E CONTROLLI VIEW */
.filter-bar { background: var(--topbar-bg); border-radius: 12px; border: 1px solid var(--border-color); padding: 10px 20px; display: flex; gap: 15px; flex-wrap: wrap; align-items: center; justify-content: space-between; box-shadow: 0 4px 12px rgba(0,0,0,0.2); margin-bottom: 20px; }
.filter-pill { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.filter-pill:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.filter-pill.active { background: rgba(59, 130, 246, 0.15); color: var(--primary); border-color: var(--primary); }
.filter-pill.pill-warn { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }
.filter-pill.pill-warn.active { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; color: #f59e0b; }
.filter-bar { background: rgba(6, 36, 111, 0.90); border: 1px solid var(--border-main); padding: 10px 20px; display: flex; gap: 15px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.filter-pill { background: transparent; border: 1px dashed var(--border-light); color: var(--text-muted); padding: 6px 14px; font-size: 0.75rem; font-weight: 300; letter-spacing: 1px; cursor: pointer; transition: all 0.2s ease; text-transform: uppercase; font-family: 'JetBrains Mono', monospace; }
.filter-pill:hover { border-style: solid; border-color: var(--border-main); color: var(--text-main); }
.filter-pill.active { background: rgba(123, 198, 255, 0.15); color: var(--text-main); border: 1px solid var(--text-main); }
.filter-pill.pill-warn { color: var(--accent); border-color: rgba(255, 204, 0, 0.4); }
.filter-pill.pill-warn.active { background: rgba(255, 204, 0, 0.15); border: 1px solid var(--accent); color: var(--accent); }
/* GRIGLIA E LISTA */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; max-width: 1400px; margin: 0 auto; padding: 0 20px; }
@@ -45,108 +63,126 @@ body { font-family: 'Inter', sans-serif; background: var(--bg-gradient); margin:
.list-view .node-meta { margin-bottom: 0; text-align: left; }
.list-view .admin-dropdown { width: auto; flex: 0 0 auto; }
.card { background: var(--card-bg) !important; border-radius: 12px; padding: 20px; border: 1px solid var(--border-color); border-top: 3px solid var(--border-color) !important; display: flex; flex-direction: column; box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important; filter: none !important; opacity: 1 !important; transition: all 0.3s ease; }
/* CARDS - OTTIMIZZATE RIMUOVENDO BACKDROP-FILTER */
.card { background: rgba(6, 36, 111, 0.90) !important; padding: 20px; border: 1px solid var(--border-main) !important; display: flex; flex-direction: column; transition: all 0.3s ease; box-shadow: none !important; border-radius: 0; }
.card:hover { border-color: #fff !important; }
/* HEADER FISSO SU 2 RIGHE ALLINEATO A SINISTRA */
.card-header { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }
.client-name { font-size: 1.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; line-height: 1.2; padding-top: 2px; }
.card-header { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 8px; margin-bottom: 15px; border-bottom: 1px dashed var(--border-main); padding-bottom: 12px; }
.client-name { font-size: 1.6rem; font-weight: 300; letter-spacing: -1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; line-height: 1.2; padding-top: 2px; }
.header-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-start; width: 100%; }
.badge-id { font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; background: rgba(0,0,0,0.3); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border-color); color: var(--text-muted); }
.badge-id { font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; background: transparent; padding: 0; border: none; color: var(--border-main); }
.type-badge { font-size: 0.65rem; padding: 2px 6px; border: 1px solid var(--primary); background: transparent; color: var(--primary); font-weight: 400; text-transform: uppercase; display: inline-block; vertical-align: middle; }
.health-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.75rem; font-weight: 600; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 8px; margin-bottom: 15px; border: 1px solid var(--border-color); font-family: 'JetBrains Mono', monospace; text-align: center; }
.health-bar > span { background: rgba(255,255,255,0.03); padding: 6px; border-radius: 6px; }
/* DATI STRUTTURALI */
.health-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.75rem; font-weight: 300; background: transparent; padding: 10px; margin-bottom: 15px; border: 1px solid var(--border-light); font-family: 'JetBrains Mono', monospace; text-align: left; }
.health-bar > span { background: transparent; padding: 4px; border: 1px dashed rgba(255,255,255,0.1); }
.freq-bar { display: flex; justify-content: space-around; font-size: 0.8rem; font-weight: 800; background: rgba(0,0,0,0.2); padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; border: 1px dashed var(--border-color); font-family: 'JetBrains Mono', monospace; }
.freq-tx { color: #f87171; } .freq-rx { color: #4ade80; }
.freq-bar { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 400; background: transparent; padding: 8px 10px; margin-bottom: 10px; border: 1px dashed var(--border-light); font-family: 'JetBrains Mono', monospace; }
.freq-tx { color: var(--danger); } .freq-rx { color: var(--success); }
.seen-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 0.7rem; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); margin: -6px 0 12px 0; }
.seen-item b { font-weight: 700; }
.seen-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 0.7rem; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); margin: -6px 0 12px 0; text-transform: uppercase; }
.seen-item b { font-weight: 400; }
.seen-item.ok b { color: var(--success); }
.seen-item.warn, .seen-item.warn b { color: #f59e0b; font-weight: 700; }
.seen-item.warn, .seen-item.warn b { color: var(--accent); font-weight: 400; }
.node-meta { font-size: 0.75rem; color: #8b949e; text-align: center; margin-bottom: 10px; line-height: 1.4; }
.node-meta { font-size: 0.75rem; color: var(--border-main); text-align: left; margin-bottom: 10px; line-height: 1.4; font-family: 'JetBrains Mono', monospace; }
.node-meta-item { display: block; }
.type-badge { font-size: 0.65rem; padding: 4px 8px; border-radius: 6px; font-weight: 700; text-transform: uppercase; display: inline-block; margin-left: 0; vertical-align: middle; }
.type-repeater { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid var(--primary); }
.type-hotspot { background: rgba(139, 92, 246, 0.15); color: var(--accent); border: 1px solid var(--accent); }
.status-display { text-align: center; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 300; letter-spacing: 2px; padding: 8px; background: transparent; border: 1px solid var(--border-light); margin-bottom: 10px; color: var(--text-muted); text-transform: uppercase; transition: all 0.3s ease;}
.card.online .status-display { color: var(--success); border-color: var(--success); }
.status-offline { color: var(--danger) !important; border-color: var(--danger) !important; }
.status-display { text-align: center; font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 700; padding: 8px; border-radius: 6px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); margin-bottom: 10px; color: var(--text-muted); }
.card.online .status-display { color: var(--success); border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.1); }
.status-offline { color: var(--danger) !important; border-color: rgba(239, 68, 68, 0.4) !important; }
.gateway-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; justify-content: center; }
.gateway-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; justify-content: flex-start; min-height: 20px;}
.ts-container { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.dmr-info { font-size: 0.85rem; font-weight: 600; font-family: 'JetBrains Mono', monospace; padding: 8px 12px; border-radius: 6px; background: rgba(0,0,0,0.2) !important; border: 1px solid var(--border-color); border-left: 4px solid var(--border-color) !important; color: var(--text-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all 0.3s; }
.dmr-info { font-size: 0.85rem; font-weight: 400; font-family: 'JetBrains Mono', monospace; padding: 8px 12px; background: transparent !important; border: 1px solid var(--border-light); color: var(--text-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all 0.3s; text-align: left; }
.terminal-log { background: #010409; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; border-radius: 6px; padding: 10px; max-height: 90px; overflow-y: auto; border: 1px solid var(--border-color); line-height: 1.4; margin-bottom: 15px; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.terminal-log { background: rgba(0,0,0,0.3); color: var(--border-main); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; padding: 10px; max-height: 90px; overflow-y: auto; border: 1px dashed var(--border-light); line-height: 1.4; margin-bottom: 15px; scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }
.actions { display: none; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.btn-cmd { flex: 1; padding: 8px 10px; border: 1px solid transparent; background: rgba(255,255,255,0.05) !important; border-radius: 6px; font-weight: 600; font-size: 0.75rem; cursor: pointer; color: var(--text-main) !important; font-family: 'Inter', sans-serif; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; gap: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important; }
.btn-cmd:hover { filter: brightness(1.2); }
.btn-cmd { flex: 1; padding: 8px 10px; background: transparent !important; border: 1px solid var(--border-main); color: var(--text-main) !important; font-weight: 300; font-size: 0.75rem; cursor: pointer; font-family: 'Inter', sans-serif; letter-spacing: 1px; transition: all 0.2s ease; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;}
.btn-cmd:hover { background: rgba(255,255,255,0.1) !important; border-color: #fff; }
details.admin-dropdown summary { list-style: none; display: flex; justify-content: center; align-items: center; }
details.admin-dropdown summary { list-style: none; display: flex; justify-content: center; align-items: center; border: 1px dashed var(--border-main) !important; }
details.admin-dropdown summary::-webkit-details-marker { display: none; }
.mqtt-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; transition: all 0.3s ease; border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; height: 30px;}
.mqtt-online { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: var(--success); }
.mqtt-offline { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: var(--danger); animation: danger-glow 2s infinite; }
.mqtt-badge { padding: 4px 10px; font-size: 0.75rem; font-weight: 400; font-family: 'JetBrains Mono', monospace; transition: all 0.3s ease; border: 1px solid var(--border-main); display: flex; align-items: center; justify-content: center; height: 30px; white-space: nowrap;}
.mqtt-online { background: transparent; color: var(--success); border-color: var(--success); }
.mqtt-offline { background: transparent; color: var(--danger); border-color: var(--danger); animation: danger-glow 2s infinite; }
.table-container { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border-color); overflow-x: auto; overflow-y: auto; max-height: 500px; margin: 0 20px 40px 20px; -webkit-overflow-scrolling: touch; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
thead th { position: sticky; top: 0; z-index: 10; background: #0f172a; border-bottom: 2px solid var(--primary); }
.table-container { background: rgba(6, 36, 111, 0.90); border: 1px solid var(--border-main); overflow-x: auto; overflow-y: auto; max-height: 500px; margin: 0 20px 40px 20px; -webkit-overflow-scrolling: touch; }
thead th { position: sticky; top: 0; z-index: 10; background: var(--bg-base); border-bottom: 1px dashed var(--border-main); font-weight: 400; letter-spacing: 1px; color: var(--border-main); }
table { width: 100%; min-width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; font-family: 'Inter', sans-serif; white-space: nowrap; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); line-height: 1.6; vertical-align: middle; }
th { background-color: rgba(255, 255, 255, 0.02); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.75rem; color: var(--text-muted); }
tbody tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.015); }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); line-height: 1.6; vertical-align: middle; }
th { text-transform: uppercase; font-size: 0.75rem; }
tbody tr:hover { background-color: rgba(123, 198, 255, 0.1); }
@keyframes soft-glow { 0% { box-shadow: 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } 50% { box-shadow: 0 0 15px var(--pulse-color, var(--primary)); border-color: var(--pulse-color, var(--primary)); } 100% { box-shadow: 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } }
.tx-active-unified { animation: soft-glow 2s infinite !important; color: var(--text-main) !important; background: rgba(0,0,0,0.3) !important; border-left: 4px solid var(--pulse-color, var(--primary)) !important; }
@keyframes soft-glow { 0% { box-shadow: inset 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } 50% { box-shadow: inset 0 0 15px var(--pulse-color, var(--primary)); border-color: var(--pulse-color, var(--primary)); } 100% { box-shadow: inset 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } }
.tx-active-unified { animation: soft-glow 2s infinite !important; color: var(--text-main) !important; background: rgba(0,0,0,0.3) !important; border: 1px solid var(--pulse-color, var(--primary)) !important; }
@keyframes danger-glow { 0% { box-shadow: 0 0 5px var(--danger); border-color: var(--border-color); } 50% { box-shadow: 0 0 15px var(--danger); border-color: var(--danger); } 100% { box-shadow: 0 0 5px var(--danger); border-color: var(--border-color); } }
@keyframes danger-glow { 0% { box-shadow: inset 0 0 5px var(--danger); border-color: var(--border-light); } 50% { box-shadow: inset 0 0 15px var(--danger); border-color: var(--danger); } 100% { box-shadow: inset 0 0 5px var(--danger); border-color: var(--border-light); } }
.blink { animation: danger-glow 1.5s infinite; color: var(--danger) !important; border: 1px solid var(--danger) !important; }
.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(15, 23, 42, 0.9); z-index:1000; align-items:center; justify-content:center; backdrop-filter: blur(5px); }
/* MODALS - OTTIMIZZATE */
.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(6, 36, 111, 0.85); z-index:1000; align-items:center; justify-content:center; backdrop-filter: blur(8px); }
.modal-top { z-index: 5000 !important; }
.modal-content { background:var(--card-bg); border:1px solid var(--border-color); padding:25px; border-radius:12px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.modal-content { background: var(--bg-base); border: 1px solid var(--border-main); padding: 25px; max-height: 90vh; overflow-y: auto; width: 90%; }
.auth-btn { background: rgba(255,255,255,0.05); color: var(--text-main); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.8rem; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.auth-btn:hover { border-color: var(--text-main); background: rgba(255,255,255,0.1); }
input, select { background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 12px; border-radius: 6px; font-family: 'Inter', sans-serif; outline: none; }
input:focus, select:focus { border-color: var(--primary); }
.auth-btn { background: transparent; color: var(--text-main); border: 1px solid var(--border-main); padding: 6px 12px; font-weight: 300; cursor: pointer; font-size: 0.8rem; font-family: 'Inter', sans-serif; transition: all 0.2s; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap;}
.auth-btn:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
input, select { background: transparent; border: 1px dashed var(--border-main); color: var(--text-main); padding: 8px 12px; font-family: 'JetBrains Mono', monospace; outline: none; }
input:focus, select:focus { border-color: #fff; border-style: solid; }
input:disabled { opacity: 0.5; cursor: not-allowed; }
option { background: var(--card-bg); color: var(--text-main); }
option { background: var(--bg-base); color: var(--text-main); }
.mini-card { background: var(--card-bg); border-radius: 10px; border: 1px solid var(--border-color); padding: 15px 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.1); height: 105px; width: 160px; overflow: hidden; }
.mini-card:hover { transform: translateY(-4px); box-shadow: 0 8px 15px rgba(0,0,0,0.3); }
/* MINI CARD - OTTIMIZZATA */
.mini-card { background: rgba(6, 36, 111, 0.90); border: 1px solid var(--border-main); padding: 15px 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; transition: all 0.2s ease; cursor: pointer; height: 105px; width: 160px; overflow: hidden; }
.mini-card:hover { background: rgba(123, 198, 255, 0.15); border-color: #fff; }
.mini-card-content { width: 100%; overflow: hidden; }
.mini-card-name { font-weight: 800; font-size: 0.95rem; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card-status { font-size: 0.65rem; font-weight: 800; padding: 4px 6px; border-radius: 6px; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card-name { font-weight: 300; font-size: 1.1rem; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.5px; }
.mini-card-status { font-size: 0.65rem; font-weight: 400; padding: 4px; border: 1px dashed var(--border-light); width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 1px; margin-top: 5px; transition: all 0.3s ease;}
/* --- STILI FLEET MAP & DIAGNOSTICA --- */
#map-container { max-width: 1400px; height: calc(100vh - 200px); min-height: 550px; margin: 0 auto; border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 8px 25px rgba(0,0,0,0.4); }
.dark-tiles { filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7); }
.custom-map-pin { display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid white; font-size: 1rem; color: white; box-shadow: 0 0 10px rgba(0,0,0,0.5); transition: all 0.3s ease; }
.pin-online { background: var(--success); border-color: rgba(255,255,255,0.8); }
.pin-offline { background: #64748b; border-color: rgba(255,255,255,0.3); opacity: 0.7; }
.pin-warn { background: #f59e0b !important; border-color: #fbbf24 !important; animation: danger-glow 2s infinite !important; }
.pin-tx { background: var(--primary) !important; animation: soft-glow 1.5s infinite !important; transform: scale(1.15); }
.leaflet-popup-content-wrapper { background: var(--card-bg) !important; color: var(--text-main) !important; border-radius: 10px !important; border: 1px solid var(--border-color) !important; box-shadow: 0 6px 20px rgba(0,0,0,0.6) !important; }
.leaflet-popup-tip { background: var(--card-bg) !important; }
#map-container { max-width: 1400px; height: calc(100vh - 200px); min-height: 550px; margin: 0 auto; border: 1px solid var(--border-main); overflow: hidden; }
/* Filtro CAD per la mappa */
.dark-tiles { filter: invert(1) sepia(1) hue-rotate(180deg) saturate(3) brightness(0.8) contrast(1.2); }
.custom-map-pin { display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid white; font-size: 0.9rem; background: transparent; font-family: 'JetBrains Mono', monospace; font-weight: normal; transition: all 0.3s ease;}
.pin-online { border-color: var(--success); color: var(--success); }
.pin-offline { border-color: var(--text-muted); color: var(--text-muted); border-style: dashed; }
.pin-warn { border-color: var(--accent) !important; color: var(--accent) !important; }
.pin-tx { border-color: var(--primary) !important; color: var(--primary) !important; box-shadow: inset 0 0 8px var(--primary); border-width: 2px; }
.leaflet-popup-content-wrapper { background: var(--bg-base) !important; color: var(--text-main) !important; border-radius: 0 !important; border: 1px solid var(--border-main) !important; box-shadow: none !important; }
.leaflet-popup-tip { background: var(--border-main) !important; }
/* Responsive rules */
@media (max-width: 1200px) {
#top-bar { flex-direction: column; align-items: stretch;}
.title-brand { text-align: center; margin-bottom: 10px; margin-right: 0;}
.nav-tabs { justify-content: center; margin-left: 0; margin-bottom: 10px;}
.top-bar-right { justify-content: center;}
}
@media (max-width: 768px) {
#top-bar-container { top: 0; padding: 10px; margin-bottom: 15px; }
#top-bar { flex-direction: column; padding: 15px; gap: 12px; border-radius: 12px; }
.title-brand { font-size: 1.1rem; text-align: center; width: 100%; }
#top-bar > div { width: 100%; flex-wrap: wrap; justify-content: center; gap: 8px !important; }
#auth-container { width: 100%; justify-content: center; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border-color); }
#top-bar-container { top: 0; padding: 10px; margin-bottom: 15px; border-bottom: 1px solid var(--border-main); }
#top-bar { padding: 15px; gap: 12px; }
.title-brand { font-size: 1.1rem; text-align: center; width: 100%; margin-right: 0;}
.top-bar-right { width: 100%; flex-wrap: wrap; justify-content: center; gap: 8px !important; }
#auth-container { width: 100%; justify-content: center; flex-wrap: wrap; padding-top: 12px; border-top: 1px dashed var(--border-main); margin-top: 5px;}
#auth-container > span { width: 100%; text-align: center; margin-bottom: 8px; font-family: 'Inter', sans-serif; }
.auth-btn, .theme-switch { flex: 1 1 auto; text-align: center; }
.nav-tabs { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--topbar-bg); border-top: 1px solid var(--border-color); margin: 0; padding: 10px 0; justify-content: space-around; z-index: 1000; flex-direction: row; gap: 0; padding-bottom: env(safe-area-inset-bottom, 10px); box-shadow: 0 -4px 15px rgba(0,0,0,0.3); }
.nav-tab { font-size: 0.95rem; padding: 10px; flex: 1; text-align: center; border-radius: 0; }
.nav-tabs { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-base); border-top: 1px solid var(--border-main); margin: 0; padding: 10px 0; justify-content: space-around; z-index: 1000; flex-direction: row; gap: 0; padding-bottom: env(safe-area-bottom, 10px); }
.nav-tab { font-size: 0.85rem; padding: 10px; flex: 1; text-align: center; }
body { padding-bottom: 70px; }
.filter-bar { flex-direction: column; }
.list-view .card { flex-direction: column; align-items: stretch; }
#map-container { height: calc(100vh - 220px); min-height: 400px; margin: 0 10px; }
.filter-bar { flex-direction: column; clip-path: none; border: 1px solid var(--border-light); margin-bottom: 10px;}
.list-view .card { flex-direction: column; align-items: stretch; clip-path: none;}
#map-container { height: calc(100vh - 220px); min-height: 400px; margin: 0 10px; clip-path: none;}
.table-container { clip-path: none; border: 1px solid var(--border-light); margin: 0 10px 20px 10px; }
.table-container table, .table-container thead, .table-container tbody, .table-container th, .table-container td, .table-container tr { display: block; width: 100%; }
.table-container thead tr { position: absolute; top: -9999px; left: -9999px; }
.table-container tr { border-bottom: 2px dashed var(--border-light); margin-bottom: 15px; background: var(--bg-base); padding: 10px; }
.table-container td { border: none; position: relative; padding-left: 40%; text-align: left; min-height: 30px; display: flex; align-items: center; }
.table-container td:before { position: absolute; top: 50%; transform: translateY(-50%); left: 10px; width: 35%; padding-right: 10px; font-weight: 800; color: var(--accent); content: attr(data-label); font-size: 0.75rem; }
}
+831 -284
View File
File diff suppressed because it is too large Load Diff
+116 -85
View File
@@ -1,64 +1,68 @@
// --- SISTEMA TRADUZIONI (i18n) & HELPERS ---
const i18n = {
en: {
lastTransits: "Lastheard", loginTitle: "🔒 System Login",
lblLogLimit: "Rows:",
lastTransits: "Lastheard", loginTitle: "SYSTEM_LOGIN",
thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration",
thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions",
btnReqCfg: "🔄 REQ CONFIG", btnGlobal: "🚨 GLOBAL OVERRIDE", btnAdmin: "🛠️ ADMIN", btnPass: "🔑 PASS", btnLogout: "LOGOUT",
btnSvc: "⚙️ SVC", btnFile: "📂 FILE", btnBoot: "🔄 BOOT", btnAdd: "+ ADD",
waitNet: "> Waiting network...", waitData: "Waiting for node data...", forceUpdate: "🔄 FORCE UPDATE",
adminTitle: "🛠️ User & System Management", adminDBSync: "⚙️ Database Sync Config", adminTime: "Daily Update Time:", adminSave: "SAVE CONFIG", roleOp: "Operator",
modSvcTitle: "⚙️ System Daemons:", modFileTitle: "📂 Config Files", modEditTitle: "📝 INI Editor:",
warnEdit: "⚠️ WARNING: This editor directly manipulates remote node parameters.",
btnEdit: "📝 EDIT", btnStart: "▶ START", btnRestart: "🔄 RESTART", btnStop: "🛑 STOP", btnSave: "💾 SAVE & SEND",
btnHat: "🔌 RESET HAT", confHat: "Are you sure you want to physically reset the MMDVM board on node ",
btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT",
btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD",
waitNet: "> Waiting network...", waitData: "Waiting for node data...", forceUpdate: "FORCE_UPD",
adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Daily Update Time:", adminSave: "SAVE_CFG", roleOp: "Operator",
modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:",
warnEdit: "[WARN] DIRECT EDIT ACTIVE",
btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE",
btnHat: "RST_HAT", confHat: "PHYSICAL RESET MMDVM ON: ",
confOta: "EXECUTE GIT PULL ON NODE ",
confOp: "Confirm operation on ", confTgOn: "ENABLE Telegram notifications for ", confTgOff: "MUTE Telegram notifications for ", confOvr: "Are you sure you want to overwrite file on ",
warnDaemon: "⚠️ SVC KO - CHECK DAEMONS ⚠️",
warnDaemon: "[WARN] DAEMON OFFLINE",
promptOvr: "GLOBAL OVERRIDE", promptOvrConfirm: "Confirm sending to ENTIRE network?",
modUpdateTitle: "🔄 GLOBAL UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "Request sent successfully!",
btnConfReset: "⚠️ CONFIRM RESET", btnCancel: "CANCEL", promptPass: "Enter the new password:",
titleError: "❌ ERROR", titleSuccess: "✅ SUCCESS", titleAction: "⚙️ CONFIRM ACTION", titleDelete: "🗑️ DELETE USER", titleSave: "💾 SAVE", titleGlobal: "🚨 GLOBAL OVERRIDE",
btnYes: "YES, PROCEED", msgDelUser: "Confirm user deletion?", msgPassOk: "Password updated successfully!", msgPassErr: "Failed to update password.", msgLoginFail: "Login Failed",
msgConfigSaved: "Configuration saved!", msgConfigErr: "Error saving configuration", msgNetErr: "Network Error", msgOvrSel: "Select the profile to send to the ENTIRE network:",
msgOvrOk: "Command successfully sent to the network!", msgMissUser: "Missing Username", msgMissPass: "Password required for new user", btnSvcKo: "⚠️ DAEMON KO",
phNewPass: "New pass (empty to keep)", phPass: "Password",
titleSwitch: "SWITCH PROFILE", confSwitch: "Are you sure you want to switch to", titleBoot: "SYSTEM REBOOT", confBoot: "Are you sure you want to REBOOT node ",
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", modVersions: "Software & Firmware",
filtAll: "All Nodes", filtOnline: "Online", filtOffline: "Offline", filtAlerts: "⚠️ Alerts"
modUpdateTitle: "GBL_UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "ACK",
btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:",
titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR",
btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL",
msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:",
msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR",
phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD",
titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "REBOOT NODE ",
ttReqCfg: "REQ_DATA", ttGlobal: "GBL_OVR", ttAdmin: "ADMIN", ttPass: "CHG_PWD", ttLogout: "LOGOUT",
ttProfA: "PROF_A", ttProfB: "PROF_B", ttTgOn: "TG_ON", ttTgOff: "TG_OFF", ttSvc: "DAEMONS", ttFile: "FILES", ttHat: "RST_HAT", ttBoot: "REBOOT",
ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG",
statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA",
statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS",
filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS"
},
it: {
lastTransits: "Ultimi ascolti", loginTitle: "🔒 Login di Sistema",
lblLogLimit: "Righe:",
lastTransits: "Ultimi ascolti", loginTitle: "SYSTEM_LOGIN",
thTime: "Ora", thRep: "Ripetitore", thMode: "Modo", thCall: "Nominativo", thDur: "Durata",
thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni",
btnReqCfg: "🔄 RICHIEDI CONFIG", btnGlobal: "🚨 OVERRIDE GLOBALE", btnAdmin: "🛠️ ADMIN", btnPass: "🔑 PASS", btnLogout: "LOGOUT",
btnSvc: "⚙️ SVC", btnFile: "📂 FILE", btnBoot: "🔄 BOOT", btnAdd: "+ AGGIUNGI",
waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "🔄 FORZA AGGIORNAMENTO",
adminTitle: "🛠️ Gestione Utenti e Sistema", adminDBSync: "⚙️ Sincronizzazione Database", adminTime: "Orario Aggiornamento:", adminSave: "SALVA CONFIG", roleOp: "Operatore",
modSvcTitle: "⚙️ Demoni Sistema:", modFileTitle: "📂 File di Configurazione", modEditTitle: "📝 Editor INI:",
warnEdit: "⚠️ ATTENZIONE: Questo editor manipola direttamente i parametri del nodo remoto.",
btnEdit: "📝 MODIFICA", btnStart: "▶ START", btnRestart: "🔄 RESTART", btnStop: "🛑 STOP", btnSave: "💾 SALVA ED INVIA",
btnHat: "🔌 RESET HAT", confHat: "Sei sicuro di voler resettare fisicamente la scheda MMDVM sul nodo ",
btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT",
btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD",
waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "FORCE_UPD",
adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Orario Aggiornamento:", adminSave: "SAVE_CFG", roleOp: "Operatore",
modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:",
warnEdit: "[WARN] DIRECT EDIT ACTIVE",
btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE",
btnHat: "RST_HAT", confHat: "PHYSICAL RESET MMDVM ON: ",
confOta: "ESEGUIRE GIT PULL SUL NODO ",
confOp: "Confermi l'operazione su ", confTgOn: "Vuoi ATTIVARE le notifiche Telegram per il nodo ", confTgOff: "Vuoi SILENZIARE le notifiche Telegram per il nodo ", confOvr: "Sei sicuro di voler sovrascrivere il file su ",
warnDaemon: "⚠️ SVC KO - CONTROLLA DEMONI ⚠️",
promptOvr: "OVERRIDE GLOBALE", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?",
modUpdateTitle: "🔄 AGGIORNAMENTO GLOBALE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "Richiesta inviata con successo!",
btnConfReset: "⚠️ CONFERMA RESET", btnCancel: "ANNULLA", promptPass: "Inserisci la nuova password:",
titleError: "❌ ERRORE", titleSuccess: "✅ OK", titleAction: "⚙️ CONFERMA AZIONE", titleDelete: "🗑️ ELIMINA UTENTE", titleSave: "💾 SALVATAGGIO", titleGlobal: "🚨 OVERRIDE GLOBALE",
btnYes: "SI, PROCEDI", msgDelUser: "Confermi l'eliminazione dell'utente?", msgPassOk: "Password aggiornata con successo!", msgPassErr: "Errore durante l'aggiornamento della password.", msgLoginFail: "Login Fallito",
msgConfigSaved: "Configurazione salvata!", msgConfigErr: "Errore durante il salvataggio", msgNetErr: "Errore di rete", msgOvrSel: "Seleziona il profilo da inviare a TUTTA la rete:",
msgOvrOk: "Comando inviato con successo a tutta la rete!", msgMissUser: "Username mancante", msgMissPass: "Password obbligatoria per il nuovo utente", btnSvcKo: "⚠️ DEMONE KO",
phNewPass: "Nuova pass (vuota per non cambiare)", phPass: "Password",
titleSwitch: "CAMBIO PROFILO", confSwitch: "Sei sicuro di voler passare al", titleBoot: "RIAVVIO SISTEMA", confBoot: "Sei sicuro di voler RIAVVIARE il nodo ",
ttReqCfg: "Richiedi aggiornamento dati", ttGlobal: "Forza cambio profilo globale", ttAdmin: "Gestione utenti e sistema", ttPass: "Cambia la tua password", ttLogout: "Disconnetti",
warnDaemon: "[WARN] DAEMON OFFLINE",
promptOvr: "GBL_OVR", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?",
modUpdateTitle: "GBL_UPDATE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "ACK",
btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:",
titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR",
btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL",
msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:",
msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR",
phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD",
titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "REBOOT NODE ",
ttReqCfg: "REQ_DATA", ttGlobal: "GBL_OVR", ttAdmin: "ADMIN", ttPass: "CHG_PWD", ttLogout: "LOGOUT",
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", modVersions: "Software & Firmware",
filtAll: "Tutti i nodi", filtOnline: "Attivi", filtOffline: "Offline", filtAlerts: "⚠️ Allarmi"
ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG",
statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA",
statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS",
filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS"
}
};
@@ -68,7 +72,7 @@ function toggleLang() { currentLang = currentLang === 'it' ? 'en' : 'it'; localS
function applyTranslations() {
const langBtn = document.getElementById('lang-btn');
if (langBtn) langBtn.innerText = currentLang === 'it' ? "🇬🇧 ENG" : "🇮🇹 ITA";
if (langBtn) langBtn.innerText = currentLang === 'it' ? "ENG" : "ITA";
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
if (i18n[currentLang][key]) el.innerHTML = i18n[currentLang][key];
@@ -88,19 +92,20 @@ function q(s) { return esc(JSON.stringify(String(s ?? ''))); }
// --- DIALOGHI ALERT & CONFIRM ---
function customAlert(title, desc, isError = false) {
const color = isError ? 'var(--danger)' : 'var(--success)';
document.getElementById('alert-title').innerHTML = title;
document.getElementById('alert-title').innerHTML = '> ' + title;
document.getElementById('alert-title').style.color = color;
document.getElementById('alert-box').style.borderColor = color;
document.getElementById('alert-box').style.borderTopColor = color;
document.getElementById('alert-desc').innerHTML = desc;
document.getElementById('alert-modal').style.display = 'flex';
}
function customConfirm(title, desc, color, callback) {
document.getElementById('confirm-title').innerHTML = title;
document.getElementById('confirm-title').innerHTML = '> ' + title;
document.getElementById('confirm-title').style.color = color;
document.getElementById('confirm-box').style.borderColor = color;
document.getElementById('confirm-box').style.borderTopColor = color;
document.getElementById('confirm-desc').innerHTML = desc;
document.getElementById('confirm-yes-btn').style.background = color;
document.getElementById('confirm-yes-btn').style.borderColor = color;
document.getElementById('confirm-yes-btn').style.color = color;
document.getElementById('confirm-yes-btn').innerText = t('btnYes');
document.getElementById('confirm-cancel-btn').innerText = t('btnCancel');
confirmActionCallback = callback;
@@ -154,10 +159,10 @@ async function loadUsers() {
const res = await fetch('/api/users'); if (!res.ok) return; const users = await res.json(); usersCache = {}; users.forEach(u => { usersCache[u.id] = u; });
document.getElementById('users-table-body').innerHTML = users.map(u => `
<tr>
<td>${u.id}</td><td style="font-weight:bold;">${esc(u.username)}</td><td><span style="background:rgba(255,255,255,0.1); padding:2px 8px; border-radius:6px; font-size:0.8rem;">${esc(String(u.role).toUpperCase())}</span></td><td>${esc(u.allowed_nodes)}</td>
<td style="text-align:center;">
<button onclick="startEditUser(${Number(u.id)})" class="btn-cmd" style="background:var(--accent); padding:6px; width:auto; display:inline-block; margin-right:5px; border:none; color:white !important;">✏️</button>
<button onclick="deleteUser(${u.id})" class="btn-cmd" style="background:var(--danger); padding:6px; width:auto; display:inline-block; border:none; color:white !important;">🗑️</button>
<td>${u.id}</td><td style="font-weight:bold;">${esc(u.username)}</td><td>[ ${esc(String(u.role).toUpperCase())} ]</td><td>${esc(u.allowed_nodes)}</td>
<td style="text-align:right; min-width: 130px; white-space: nowrap;">
<button onclick="startEditUser(${Number(u.id)})" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; display:inline-block; width: 60px; flex: 0 0 60px; margin-right:5px; padding: 6px;">EDIT</button>
<button onclick="deleteUser(${u.id})" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; display:inline-block; width: 60px; flex: 0 0 60px; padding: 6px;">DEL</button>
</td>
</tr>`).join('');
}
@@ -165,12 +170,12 @@ async function loadUsers() {
function startEditUser(id) {
const u = usersCache[id]; if (!u) return;
editingUserId = id; document.getElementById('new-user').value = u.username; document.getElementById('new-user').disabled = true; document.getElementById('new-pass').value = ""; document.getElementById('new-pass').placeholder = t('phNewPass'); document.getElementById('new-role').value = u.role; document.getElementById('new-nodes').value = u.allowed_nodes;
const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = t('titleSave'); btnSubmit.style.background = "var(--accent)"; document.getElementById('btn-user-cancel').style.display = "block";
const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = "UPDATE"; btnSubmit.style.borderColor = "var(--accent)"; btnSubmit.style.color = "var(--accent) !important"; document.getElementById('btn-user-cancel').style.display = "block";
}
function cancelEdit() {
editingUserId = null; document.getElementById('new-user').value = ""; document.getElementById('new-user').disabled = false; document.getElementById('new-pass').value = ""; document.getElementById('new-pass').placeholder = t('phPass'); document.getElementById('new-role').value = "operator"; document.getElementById('new-nodes').value = "";
const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = t('btnAdd'); btnSubmit.style.background = "var(--success)"; document.getElementById('btn-user-cancel').style.display = "none";
const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = "ADD"; btnSubmit.style.borderColor = "var(--success)"; btnSubmit.style.color = "var(--success) !important"; document.getElementById('btn-user-cancel').style.display = "none";
}
async function submitUser() {
@@ -206,13 +211,13 @@ function triggerGlobalEmergency() {
for (const [k, v] of Object.entries(globalHealthData[id].profiles)) { uniqueProfiles[k] = v; }
}
}
const container = document.getElementById('global-btn-container'); let html = ''; const colors = ["var(--accent)", "#eab308", "var(--success)", "var(--primary)"]; let idx = 0;
const container = document.getElementById('global-btn-container'); let html = ''; const colors = ["var(--accent)", "#00ffcc", "var(--primary)"]; let idx = 0;
for (const [k, v] of Object.entries(uniqueProfiles)) {
let col = colors[idx % colors.length];
html += `<button onclick="sendGlobalAction(${q(k)})" class="btn-cmd" style="background:${col}; padding:15px; font-size:1.1rem; font-weight:bold; border:none; color:white !important;">${esc(v)}</button>`;
html += `<button onclick="sendGlobalAction(${q(k)})" class="btn-cmd" style="border-color:${col}; color:${col} !important;">${esc(v)}</button>`;
idx++;
}
if (Object.keys(uniqueProfiles).length === 0) { html = `<p style="color:var(--danger); font-weight:bold;">No profiles configured on the network.</p>`; }
if (Object.keys(uniqueProfiles).length === 0) { html = `<p style="color:var(--danger); font-weight:400; font-family:'JetBrains Mono',monospace;">NO_PROFS_FOUND</p>`; }
container.innerHTML = html; document.getElementById('override-desc').innerText = t('msgOvrSel'); document.getElementById('override-modal').style.display = 'flex';
}
@@ -239,34 +244,50 @@ async function executePasswordChange() {
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';
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 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(255,255,255,0.05); 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; border:none; color:white !important;">${t('btnEdit')}</button></div>`).join('');
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 = `<p>${t('waitData')}</p><button onclick="sendGlobalUpdate(); closeConfigsModal();" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important;">${t('forceUpdate')}</button>`;
} else {
listDiv.innerHTML = listaFile.map(f => `<div style="display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px dashed var(--border-light); width:100%;">
<span style="font-weight:400; font-family:'JetBrains Mono',monospace; flex: 1; text-align: left; overflow:hidden; text-overflow:ellipsis; padding-right:20px;">${esc(fileLabel(f, fileNames))}</span>
<button onclick="closeConfigsModal(); openEditorModal(${q(clientId)}, ${q(f)})" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; width: 80px; flex: 0 0 80px; padding: 6px;">${t('btnEdit')}</button>
</div>`).join('');
}
document.getElementById('configs-modal').style.display = 'flex';
}
function closeConfigsModal() { document.getElementById('configs-modal').style.display = 'none'; }
// --- MODALE GESTIONE DEMONI/SERVIZI ---
function openServicesModal(clientId) { document.getElementById('svc-modal-title').innerText = clientId.toUpperCase(); document.getElementById('services-modal').style.display = 'flex'; renderServicesList(clientId); }
function openServicesModal(clientId) {
document.getElementById('svc-modal-title').innerText = clientId.toUpperCase();
document.getElementById('services-modal').style.display = 'flex';
renderServicesList(clientId);
}
function closeServicesModal() { document.getElementById('services-modal').style.display = 'none'; }
function renderServicesList(clientId) {
const data = globalHealthData[clientId.toLowerCase()]; const listDiv = document.getElementById('services-list');
if (!data || !data.processes || Object.keys(data.processes).length === 0) { listDiv.innerHTML = "<p style='text-align:center; color:var(--text-muted);'>No service data available.</p>"; return; }
const data = globalHealthData[clientId.toLowerCase()];
const listDiv = document.getElementById('services-list');
if (!data || !data.processes || Object.keys(data.processes).length === 0) { listDiv.innerHTML = "<p>NO_DATA</p>"; return; }
let html = "";
for (const [name, status] of Object.entries(data.processes)) {
const isOnline = status.toLowerCase() === 'online'; const statusColor = isOnline ? 'var(--success)' : 'var(--danger)';
html += `<div style="display:flex; justify-content:space-between; align-items:center; padding:15px; border-bottom:1px solid var(--border-color); background:rgba(255,255,255,0.02); border-radius:12px; margin-bottom:8px; border-left: 5px solid ${statusColor};">
<div><strong style="font-size:1.1rem; display:block; font-family:'JetBrains Mono',monospace;">${esc(name)}</strong><span class="${isOnline?'':'blink'}" style="color:${statusColor}; font-size:0.8rem; font-weight:800;">${esc(String(status).toUpperCase())}</span></div>
<div style="display:flex; gap:8px;">
${!isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'start')" class="btn-cmd" style="background:var(--success); border:none; color:white !important;">▶</button>` : ''}
<button onclick="controlService(${q(clientId)}, ${q(name)}, 'restart')" class="btn-cmd" style="background:#f59e0b; border:none; color:white !important;">🔄</button>
<button onclick="openEditorModal(${q(clientId)}, ${q(name)})" class="btn-cmd" style="background:#8e44ad; border:none; color:white !important;">📝</button>
${isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'stop')" class="btn-cmd" style="background:var(--danger); border:none; color:white !important;">🛑</button>` : ''}
html += `<div style="display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px dashed var(--border-light); width: 100%;">
<div style="font-weight:400; color:${statusColor}; font-family:'JetBrains Mono',monospace; flex: 1; text-align: left; overflow:hidden; text-overflow:ellipsis; padding-right:20px;">${esc(name)} [${esc(String(status).toUpperCase())}]</div>
<div style="display:flex; gap:8px; flex: 0 0 auto; justify-content: flex-end;">
${!isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'start')" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important; width: 70px; flex: 0 0 70px; padding: 6px 0;">START</button>` : ''}
<button onclick="controlService(${q(clientId)}, ${q(name)}, 'restart')" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; width: 70px; flex: 0 0 70px; padding: 6px 0;">RST</button>
<button onclick="openEditorModal(${q(clientId)}, ${q(name)})" class="btn-cmd" style="width: 70px; flex: 0 0 70px; padding: 6px 0;">EDIT</button>
${isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'stop')" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 70px; flex: 0 0 70px; padding: 6px 0;">STOP</button>` : ''}
</div>
</div>`;
}
@@ -276,7 +297,7 @@ function renderServicesList(clientId) {
function controlService(clientId, service, action) {
customConfirm(t('titleAction'), `${t('confOp')}<b>${esc(service)}</b>?`, "var(--accent)", async () => {
try { const res = await fetch('/api/service_control', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId, service, action }) }); const data = await res.json();
if(!data.success) customAlert(t('titleError'), "Error: " + esc(data.error), true);
if(!data.success) customAlert(t('titleError'), "ERR: " + esc(data.error), true);
} catch(e) { console.error(e); }
});
}
@@ -285,28 +306,38 @@ function controlService(clientId, service, action) {
let currentEditClient = ""; let currentEditService = "";
async function openEditorModal(clientId, service) {
currentEditClient = clientId; currentEditService = service; document.getElementById('editor-title').innerText = `${service.toUpperCase()} @ ${clientId.toUpperCase()}`;
document.getElementById('config-textarea').value = "Connecting to server..."; document.getElementById('editor-status').innerText = ""; document.getElementById('editor-modal').style.display = 'flex';
try { const res = await fetch(`/api/config_file/${encodeURIComponent(clientId)}/${encodeURIComponent(service)}`); const data = await res.json(); if (data.success) document.getElementById('config-textarea').value = data.data.raw_text || "Empty file"; else document.getElementById('config-textarea').value = "ERROR:\n" + data.error; } catch(e) { document.getElementById('config-textarea').value = "Connection error."; }
document.getElementById('config-textarea').value = "AWAITING_STREAM..."; document.getElementById('editor-status').innerText = ""; document.getElementById('editor-modal').style.display = 'flex';
try {
const res = await fetch(`/api/config_file/${encodeURIComponent(clientId)}/${encodeURIComponent(service)}`);
const data = await res.json();
if (data.success) {
document.getElementById('config-textarea').value = data.data.raw_text || "EMPTY";
} else {
document.getElementById('config-textarea').value = "ERR:\n" + data.error;
}
} catch(e) {
document.getElementById('config-textarea').value = "NET_ERR";
}
}
function closeEditorModal() { document.getElementById('editor-modal').style.display = 'none'; }
function saveConfig() {
const textValue = document.getElementById('config-textarea').value; const statusSpan = document.getElementById('editor-status');
customConfirm(t('titleSave'), `${t('confOvr')}<b>${currentEditClient.toUpperCase()}</b>?`, "var(--danger)", async () => {
statusSpan.innerText = "Sending..."; statusSpan.style.color = "var(--success)";
statusSpan.innerText = "WRITING..."; statusSpan.style.color = "var(--success)";
try {
const res = await fetch('/api/config_file', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId: currentEditClient, service: currentEditService, config_data: { "raw_text": textValue } }) });
const data = await res.json();
if (data.success) { customAlert(t('titleSuccess'), "File updated!"); closeEditorModal(); } else { customAlert(t('titleError'), "Server error: " + esc(data.error), true); statusSpan.innerText = "❌ Error"; }
} catch(e) { customAlert(t('titleError'), t('msgNetErr'), true); statusSpan.innerText = "❌ Network Error"; }
if (data.success) { customAlert(t('titleSuccess'), "FILE_WRITTEN"); closeEditorModal(); } else { customAlert(t('titleError'), "ERR: " + esc(data.error), true); statusSpan.innerText = "ERR"; }
} catch(e) { customAlert(t('titleError'), t('msgNetErr'), true); statusSpan.innerText = "NET_ERR"; }
});
}
// --- MODALE VERSIONI SOFTWARE ---
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; }
if (!versions || Object.keys(versions).length === 0) { listDiv.innerHTML = "<p style='font-family:\"JetBrains Mono\",monospace;'>NO_DATA. RESTART SVCS TO PUSH LOGS.</p>"; }
else { let html = ""; for (const [software, version] of Object.entries(versions)) { html += `<div style="border-bottom:1px dashed var(--border-light); padding:5px 0;"><strong style="color: var(--primary); display: inline-block; width: 140px;">${esc(software)}:</strong> <span style="color: var(--success); font-weight: 400;">${esc(version)}</span></div>`; } listDiv.innerHTML = html; }
document.getElementById('versions-modal').style.display = 'flex';
}
function closeVersionsModal() { document.getElementById('versions-modal').style.display = 'none'; }
+308 -167
View File
@@ -6,63 +6,204 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fleet Control Console</title>
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#0d1117">
<meta name="theme-color" content="#06246f">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" href="/icon-512.png">
<meta name="apple-mobile-web-app-title" content="Fleet C2">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<!-- Font Blueprint -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<!-- Libreria Mappa Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<!-- Foglio di Stile Esterno Modularizzato -->
<link rel="stylesheet" href="/static/css/style.css">
<!-- Foglio di Stile Esterno Modularizzato (Cache Buster) -->
<link rel="stylesheet" href="/static/css/style.css?v=blueprint-header-fix">
<!-- Foglio Stili Layout Alternativi -->
<link rel="stylesheet" href="/static/css/layouts.css?v=6">
</head>
<body>
<div id="top-bar-container">
<div id="top-bar">
<div class="title-brand">FLEET CONTROL CONSOLE</div>
<div id="top-bar-container" style="border-bottom: 2px solid var(--border-main); background: var(--bg-main, #04102e);">
<div id="top-bar" style="display: flex; justify-content: space-between; align-items: stretch; padding: 0; min-height: 90px; flex-wrap: wrap;">
<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>
<button class="nav-tab" onclick="switchView('map')" id="tab-map">MAP</button>
<!-- HEADER SX: BANNER CON RIEMPIMENTO ASSOLUTO A FILO -->
<div id="master-banner-container" style="display: none; flex: 0 0 45%; max-width: 45%; border-right: 2px solid var(--border-main); background: #020b1e; align-items: stretch; justify-content: stretch; padding: 0; box-sizing: border-box; overflow: hidden;">
<img src="/static/banners/banner.png" style="width: 100%; height: 100%; object-fit: cover; object-position: center; display: block;"
onload="this.parentElement.style.display='flex';"
onerror="this.parentElement.style.display='none';">
</div>
<div style="display: flex; align-items: center; gap: 12px;">
<span id="mqtt-badge" class="mqtt-badge mqtt-offline">MQTT: CHECKING...</span>
<button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang">🇮🇹 ITA</button>
<button class="theme-switch" id="push-btn" onclick="subscribeToPush()">🔔 PUSH</button>
<div id="auth-container" style="display:flex; align-items:center; gap:8px;"></div>
</div>
</div>
</div>
<!-- HEADER DX: STRUTTURA FLUIDA A 3 RIGHE -->
<div id="header-right-controls" style="flex: 1; display: flex; flex-direction: column; gap: 10px; justify-content: center; padding: 12px 20px; box-sizing: border-box; background: rgba(0, 15, 45, 0.25); min-width: 350px;">
<!-- VISTA FLEET MAP -->
<!-- RIGA 1: BRAND E OROLOGIO -->
<div style="display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; border-bottom: 1px dashed var(--border-light, rgba(255,255,255,0.15)); padding-bottom: 4px;">
<span class="title-brand" style="font-size: 1.15rem; font-weight: 700; letter-spacing: 2px; color: var(--text-main);">SCHEMATIC // FLEET C2</span>
<span id="live-clock" style="font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--primary); letter-spacing: 1px;">SYS_TIME: --:--:--</span>
</div>
<!-- RIGA 2: TASTI DI NAVIGAZIONE -->
<div class="nav-tabs" style="display: flex; flex-wrap: wrap; gap: 8px; border: none; margin: 0; padding: 0; width: 100%;">
<button class="nav-tab active" onclick="switchView('home')" id="tab-home" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">HOME</button>
<button class="nav-tab" onclick="switchView('nodes')" id="tab-nodes" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">NODES</button>
<button class="nav-tab" onclick="switchView('map')" id="tab-map" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">MAP</button>
<button class="nav-tab" onclick="switchView('aprs')" id="tab-aprs" style="flex: 1; min-width: 80px; padding: 6px 0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1.5px; text-align: center; border-radius: 4px;">APRS</button>
</div>
<!-- RIGA 3: BADGES E TASTI ADMIN -->
<div class="top-bar-right" style="display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; border: none; margin: 0; padding: 0; width: 100%;">
<span id="mqtt-badge" class="mqtt-badge mqtt-offline" style="padding: 4px 10px; font-size: 0.75rem; font-weight: bold; letter-spacing: 1px;">MQTT: CHK</span>
<button class="theme-switch" id="layout-btn" onclick="cycleLayout()" title="Cambia Layout" style="padding: 4px 10px; font-size: 0.75rem;">[ L: BLU ]</button>
<button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang" style="padding: 4px 10px; font-size: 0.75rem;">ITA</button>
<button class="theme-switch" id="push-btn" onclick="subscribeToPush()" style="padding: 4px 10px; font-size: 0.75rem;">PUSH</button>
<div id="auth-container" style="display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end;"></div>
</div>
</div>
</div>
</div><!-- VISTA FLEET MAP -->
<div id="view-map" style="display: none; padding: 0 20px;">
<div id="map-container"></div>
</div>
<!-- VISTA NODI -->
<!-- VISTA APRS LOGS -->
<div id="view-aprs" style="display: none;">
<div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;">
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--border-main); padding-bottom: 5px; margin-bottom: 15px;">
<h3 style="margin: 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main);">[ APRS_TRAFFIC ]</h3>
<button class="btn-cmd" onclick="document.getElementById('aprs-body').innerHTML='';" style="width: auto; padding: 4px 12px; flex: none;">[ CLEAR ]</button>
</div>
<div class="table-container" style="max-height: calc(100vh - 200px);">
<table>
<thead>
<tr>
<th style="width: 100px;">TIME</th>
<th style="width: 120px;">SOURCE</th>
<th style="width: 120px;">DEST</th>
<th style="width: 200px;">PATH</th>
<th>PAYLOAD</th>
</tr>
</thead>
<tbody id="aprs-body"></tbody>
</table>
</div>
</div>
</div>
<!-- VISTA FOCUS NODO SINGOLO (FULL SCREEN) -->
<div id="view-focus" style="display: none;">
<div style="max-width: 1400px; margin: 0 auto; padding: 0 20px;">
<!-- Header Ritorno e Titolo -->
<div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 2px dashed var(--border-main); padding-bottom: 15px; margin-bottom: 25px; flex-wrap: wrap; gap: 15px;">
<button class="btn-cmd" style="width: auto; padding: 12px 25px; font-size: 1.1rem; border-color: var(--accent); color: var(--accent) !important;" onclick="closeNodeFocus()">[ < RETURN TO OVERVIEW ]</button>
<div style="text-align: right; flex-grow: 1;">
<h2 id="focus-name" style="margin: 0; color: var(--text-main); font-weight: 300; font-size: 2.5rem; letter-spacing: 2px; display: flex; align-items: center; justify-content: flex-end; gap: 15px;">--</h2>
<div id="focus-id" style="color: var(--primary); font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; margin-top: 5px;">--</div>
<div id="focus-status" style="font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; margin-top: 5px; font-weight: bold;">--</div>
</div>
</div>
<!-- BANNER PERSONALIZZATO -->
<div class="grid" style="grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));">
<!-- COLONNA SX: HARDWARE E RF -->
<div style="display: flex; flex-direction: column; gap: 20px;">
<div class="card" style="border-width: 1px !important;">
<h3 style="margin: 0 0 20px 0; color: var(--accent); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ HARDWARE_TELEMETRY ]</h3>
<div style="font-size: 1.2rem; font-family: 'JetBrains Mono', monospace; display: flex; flex-direction: column; gap: 15px;">
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>CPU_LOAD:</span> <span id="focus-cpu">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>SYS_TEMP:</span> <span id="focus-temp">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>RAM_USAGE:</span> <span id="focus-ram">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>DISK_SPACE:</span> <span id="focus-disk">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>UPTIME:</span> <span id="focus-up">--</span></div>
</div>
</div>
<div class="card" style="border-width: 1px !important;">
<h3 style="margin: 0 0 20px 0; color: var(--primary); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ RF_CONFIGURATION ]</h3>
<div style="font-size: 1.2rem; font-family: 'JetBrains Mono', monospace; display: flex; flex-direction: column; gap: 15px;">
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>TX_FREQ:</span> <span id="focus-tx" style="color: var(--danger);">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>RX_FREQ:</span> <span id="focus-rx" style="color: var(--success);">--</span></div>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>LOCATION:</span> <span id="focus-loc" style="color: var(--text-main);">--</span></div>
</div>
</div>
<div class="card" id="focus-modes-card" style="border-width: 1px !important; display: none;">
<h3 style="margin: 0 0 15px 0; color: #fff; font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ OPERATING_MODES ]</h3>
<div id="focus-modes-toggles" style="display: flex; flex-wrap: wrap; gap: 10px; font-family: 'JetBrains Mono', monospace;">
<span style="color:var(--text-muted); font-size: 0.9rem;">WAITING FOR CONFIG...</span>
</div>
</div>
</div>
<!-- COLONNA DX: SOFTWARE E LOG -->
<div style="display: flex; flex-direction: column; gap: 20px;">
<div class="card" style="border-width: 1px !important; flex: 1;">
<h3 style="margin: 0 0 20px 0; color: var(--success); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ ACTIVE_GATEWAYS ]</h3>
<div id="focus-gw" style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; min-height: 40px; font-size: 0.9rem;"></div>
<h3 style="margin: 0 0 20px 0; color: var(--primary); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ TIMESLOTS_MODES ]</h3>
<div id="focus-ts" style="display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px; font-family: 'JetBrains Mono', monospace; font-size: 1.2rem;"></div>
<h3 style="margin: 0 0 15px 0; color: var(--border-main); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ LIVE_TERMINAL ]</h3>
<div id="focus-log" class="terminal-log" style="height: 320px; max-height: 320px; font-size: 0.95rem; border-color: var(--border-main);">> AWAITING_STREAM...</div>
</div>
</div>
</div>
<!-- FOCUS LASTHEARD -->
<div style="margin-top: 30px; border-top: 1px dashed var(--border-light); padding-top: 20px;">
<h3 style="margin: 0 0 15px 0; color: var(--text-main); font-weight: 300; font-size: 1.3rem; letter-spacing: 2px;">[ NODE_LASTHEARD ]</h3>
<div class="table-container" style="margin: 0; max-height: 400px;">
<table>
<thead>
<tr>
<th data-i18n="thTime">TIME</th>
<th data-i18n="thRep">REPEATER</th>
<th data-i18n="thMode">MODE</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</th>
<th data-i18n="thDur">DUR</th>
<th>BER</th>
<th>RSSI</th>
</tr>
</thead>
<tbody id="focus-lastheard-body"></tbody>
</table>
</div>
</div>
<!-- CONTROLLI ADMIN DEL NODO -->
<div id="focus-controls" style="display: none; margin-top: 30px; border: 1px dashed var(--danger); padding: 30px; background: rgba(6, 36, 111, 0.6); backdrop-filter: blur(2px);">
<h3 style="margin: 0 0 20px 0; color: var(--danger); font-weight: 300; font-size: 1.5rem; text-align: center; letter-spacing: 2px;">[ ADMIN_CONTROLS ]</h3>
<div id="focus-admin-btns" style="display: flex; gap: 15px; flex-wrap: wrap; justify-content: center;">
</div>
</div>
</div>
</div>
<!-- VISTA NODI IN GRIGLIA -->
<div id="view-nodes" style="display: none;">
<div style="max-width: 1400px; margin: 0 auto; padding: 0 20px;">
<div class="filter-bar">
<div style="display: flex; gap: 8px; flex-wrap: wrap;" id="node-filters">
<button class="filter-pill active" onclick="setFilter('all')" data-i18n="filtAll">All Nodes</button>
<button class="filter-pill" onclick="setFilter('online')" data-i18n="filtOnline">Online</button>
<button class="filter-pill" onclick="setFilter('offline')" data-i18n="filtOffline">Offline</button>
<button class="filter-pill pill-warn" onclick="setFilter('alerts')" data-i18n="filtAlerts">⚠️ Alerts</button>
<div style="width: 1px; background: var(--border-color); margin: 0 5px;"></div>
<button class="filter-pill" onclick="setFilter('dmr')" style="color: #3b82f6; border-color: rgba(59,130,246,0.3);">DMR</button>
<button class="filter-pill" onclick="setFilter('ysf')" style="color: #8b5cf6; border-color: rgba(139,92,246,0.3);">YSF</button>
<button class="filter-pill" onclick="setFilter('d-star')" style="color: #06b6d4; border-color: rgba(6,182,212,0.3);">D-STAR</button>
<button class="filter-pill" onclick="setFilter('nxdn')" style="color: #10b981; border-color: rgba(16,185,129,0.3);">NXDN</button>
<button class="filter-pill active" onclick="setFilter('all')" data-i18n="filtAll">ALL_NODES</button>
<button class="filter-pill" onclick="setFilter('online')" data-i18n="filtOnline">ONLINE</button>
<button class="filter-pill" onclick="setFilter('offline')" data-i18n="filtOffline">OFFLINE</button>
<button class="filter-pill pill-warn" onclick="setFilter('alerts')" data-i18n="filtAlerts">ALERTS</button>
<div style="width: 1px; background: var(--border-light); margin: 0 5px;"></div>
<button class="filter-pill" onclick="setFilter('dmr')">DMR</button>
<button class="filter-pill" onclick="setFilter('ysf')">YSF</button>
<button class="filter-pill" onclick="setFilter('d-star')">D-STAR</button>
<button class="filter-pill" onclick="setFilter('nxdn')">NXDN</button>
</div>
<div style="display: flex; gap: 10px; align-items: center; width: auto; flex-grow: 1; justify-content: flex-end;">
<input type="text" id="node-search" placeholder="Search ID / Callsign..." onkeyup="applyFilters()" style="padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color); background: rgba(0,0,0,0.2); color: white; flex-grow: 1; max-width: 200px;">
<button id="view-toggle-btn" class="btn-cmd" style="background: rgba(255,255,255,0.1); padding: 8px 12px; flex: 0 0 auto; width: auto;" onclick="toggleViewMode()" title="Toggle Grid/List View">🔲 GRID</button>
<input type="text" id="node-search" placeholder="SEARCH ID/CALL..." onkeyup="applyFilters()" style="flex-grow: 1; max-width: 200px;">
<button id="view-toggle-btn" class="btn-cmd" style="flex: 0 0 auto; width: auto;" onclick="toggleViewMode()" title="Toggle Grid/List View">[ GRID ]</button>
</div>
</div>
</div>
@@ -73,34 +214,45 @@
<!-- VISTA HOME -->
<div id="view-home">
<div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;">
<h3 style="margin: 0 0 15px 0; font-weight: 800; display: flex; align-items: center; gap: 10px; color: var(--text-main);">
<span style="font-size: 1.2rem;">🟢</span> <span>FLEET STATUS</span>
<h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
[ FLEET_STATUS ]
</h3>
<div id="home-mini-nodes" style="display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;"></div>
</div>
<div style="max-width: 1400px; margin: 0 auto 30px auto;">
<div style="padding: 0 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 15px;">
<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>
</h3>
<select id="stat-node-filter" onchange="refreshStats(); refreshLogs();" style="font-weight: bold; cursor: pointer;">
<option value="all">🌐 ALL NODES</option>
<div style="padding: 0 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
<h3 style="margin: 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main);" data-i18n="lastTransits">[ LASTHEARD ]</h3>
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
<div style="display: flex; align-items: center; gap: 6px;">
<label for="log-limit-select" data-i18n="lblLogLimit" style="font-size: 0.8rem; color: var(--text-muted); font-weight: 300;">ROWS:</label>
<select id="log-limit-select" onchange="changeLogLimit(this.value)" style="font-weight: 400; cursor: pointer;">
<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: 400; cursor: pointer;">
<option value="all">ALL_NODES</option>
</select>
</div>
</div>
<div class="table-container" style="margin-bottom: 0;">
<table>
<thead>
<tr>
<th data-i18n="thTime">Time</th>
<th data-i18n="thRep">Repeater</th>
<th data-i18n="thMode">Mode</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 data-i18n="thTime">TIME</th>
<th data-i18n="thRep">REPEATER</th>
<th data-i18n="thMode">MODE</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</th>
<th data-i18n="thDur">DUR</th>
<th>BER</th>
<th>RSSI</th>
</tr>
@@ -111,29 +263,27 @@
</div>
<div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;">
<h3 style="margin: 0 0 15px 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>
<h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;" data-i18n="statTitle">[ DAILY_STATISTICS ]</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;">
<div class="card" style="padding: 15px; border-top-color: var(--accent) !important;">
<h4 style="margin: 0 0 10px 0; color: var(--accent);" data-i18n="statTopTG">🎯 TOP TALKGROUPS</h4>
<div id="stat-tgs" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">Loading...</div>
<div class="card" style="border-left: 1px solid var(--accent) !important; padding: 15px;">
<h4 style="margin: 0 0 10px 0; color: var(--accent); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopTG">TOP_TALKGROUPS</h4>
<div id="stat-tgs" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">LOADING...</div>
</div>
<div class="card" style="padding: 15px; border-top-color: var(--success) !important;">
<h4 style="margin: 0 0 10px 0; color: var(--success);" data-i18n="statTopCall">🗣️ TOP CALLSIGNS</h4>
<div id="stat-calls" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">Loading...</div>
<div class="card" style="border-left: 1px solid var(--success) !important; padding: 15px;">
<h4 style="margin: 0 0 10px 0; color: var(--success); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopCall">TOP_CALLSIGNS</h4>
<div id="stat-calls" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">LOADING...</div>
</div>
<div class="card" style="padding: 15px; border-top-color: var(--primary) !important; display: flex; justify-content: space-around; align-items: center; text-align: center; flex-direction: row;">
<div class="card" style="border-left: 1px solid var(--primary) !important; padding: 15px; display: flex; justify-content: space-around; align-items: center; text-align: center; flex-direction: row;">
<div>
<div style="font-size: 1.8rem; font-weight: 800; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-avg">--</span>s</div>
<div style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold;" data-i18n="statAvgDur">⏱️ AVERAGE DURATION</div>
<div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-avg">--</span>s</div>
<div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statAvgDur">AVG_DURATION</div>
</div>
<div style="width: 1px; height: 50px; background: var(--border-color);"></div>
<div style="width: 1px; height: 50px; border-left: 1px dashed var(--border-light);"></div>
<div>
<div style="font-size: 1.8rem; font-weight: 800; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-today">--</span></div>
<div style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold;" data-i18n="statTodayTx">📡 TRANSITS TODAY</div>
<div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-today">--</span></div>
<div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statTodayTx">TRANSITS_TODAY</div>
</div>
</div>
</div>
@@ -141,65 +291,60 @@
</div>
<footer>
<div style="text-align: center; padding: 25px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap;">
<span>&copy; 2026 <strong>IV3JDV @ ARIFVG</strong></span>
<span style="opacity: 0.5;">|</span>
<a href="https://git.arifvg.it/iv3jdv/fleet-control-server" target="_blank" style="color: inherit; text-decoration: none; display: flex; align-items: center; gap: 6px; transition: color 0.2s;">
<span>Gitea Home</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 style="text-align: center; padding: 25px; color: var(--text-muted); font-size: 0.85rem; font-weight: 300; display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap;">
<span>SYS_OP: IV3JDV @ ARIFVG</span>
<span>|</span>
<a href="https://git.arifvg.it/iv3jdv/fleet-control-server" target="_blank" style="color: inherit; text-decoration: none;">GITEA_REPO</a>
<span>|</span>
<span style="color: var(--accent);">REV: {{ git_commit }}</span>
<span>|</span>
<span id="last-update">SYNC: --:--</span>
</div>
</footer>
<!-- MODALI -->
<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;">
<h2 style="margin:0; color:var(--primary);" data-i18n="loginTitle">🔒 System Login</h2>
<button onclick="closeLoginModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button>
<div class="modal-content" style="max-width:400px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--primary); font-weight:300;" data-i18n="loginTitle">[ SYSTEM_LOGIN ]</h2>
<button onclick="closeLoginModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div style="display:flex; flex-direction:column; gap:15px;">
<input type="text" id="modal-username" placeholder="Username" style="width:100%; padding:12px; font-size:1rem;" onkeypress="handleLoginEnter(event)">
<input type="password" id="modal-password" placeholder="Password" style="width:100%; padding:12px; font-size:1rem;" onkeypress="handleLoginEnter(event)">
<button onclick="performLogin()" class="btn-cmd" style="background:var(--success); width:100%; padding:12px; margin-top:10px; font-size:1rem;">LOGIN</button>
<div style="display:flex; flex-direction:column; gap:15px; margin-top: 20px;">
<input type="text" id="modal-username" placeholder="USR" onkeypress="handleLoginEnter(event)">
<input type="password" id="modal-password" placeholder="PWD" onkeypress="handleLoginEnter(event)">
<button onclick="performLogin()" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important;">EXECUTE_LOGIN</button>
</div>
</div>
</div>
<div id="admin-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:900px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:20px;">
<h2 style="margin:0;" data-i18n="adminTitle">🛠️ User & System Management</h2>
<button onclick="closeAdmin()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button>
<div class="modal-content" style="max-width:900px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:20px;">
<h2 style="margin:0; color:var(--text-main); font-weight:300;" data-i18n="adminTitle">[ SYS_ADMIN ]</h2>
<button onclick="closeAdmin()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div style="display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; background:rgba(0,0,0,0.2); padding:15px; border-radius:16px; align-items:center;">
<input type="text" id="new-user" placeholder="Username" style="flex:1; min-width:120px;">
<input type="password" id="new-pass" placeholder="Password" style="flex:1; min-width:120px;">
<select id="new-role" style="flex:0.5; min-width:100px;">
<option value="operator" data-i18n="roleOp">Operator</option>
<option value="admin">Admin</option>
</select>
<input type="text" id="new-nodes" placeholder="Nodes (eg: ir3uic,ir3q)" style="flex:2; min-width:150px;">
<button id="btn-user-submit" onclick="submitUser()" class="btn-cmd" style="background:var(--success); flex:0.5;" data-i18n="btnAdd">+ ADD</button>
<button id="btn-user-cancel" onclick="cancelEdit()" class="btn-cmd" style="background:var(--text-muted); flex:0.2; display:none;">✖</button>
<div style="display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; background:rgba(0,0,0,0.2); padding:15px; align-items:center; border: 1px solid var(--border-light);">
<input type="text" id="new-user" placeholder="USR" style="flex:1; min-width:120px;">
<input type="password" id="new-pass" placeholder="PWD" style="flex:1; min-width:120px;">
<select id="new-role" style="flex:none; width: 80px;"><option value="operator" data-i18n="roleOp">OP</option><option value="admin">ADM</option></select>
<input type="text" id="new-nodes" placeholder="NODES (IR3UIC,IR3Q)" style="flex:2; min-width:150px;">
<button id="btn-user-submit" onclick="submitUser()" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important; flex:none; width: 80px;" data-i18n="btnAdd">ADD</button>
<button id="btn-user-cancel" onclick="cancelEdit()" class="btn-cmd" style="display:none; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div style="margin-bottom:20px; background:rgba(59, 130, 246, 0.05); padding:20px; border-radius:16px; border: 1px solid var(--primary);">
<h4 style="margin:0 0 15px 0; color:var(--primary);" data-i18n="adminDBSync">⚙️ Database Sync Configuration</h4>
<div style="margin-bottom:20px; background:rgba(0,0,0,0.2); padding:20px; border: 1px solid var(--border-light);">
<h4 style="margin:0 0 15px 0; color:var(--primary); font-weight:300;" data-i18n="adminDBSync">[ DB_SYNC_CFG ]</h4>
<div style="display:grid; grid-template-columns: 1fr 1fr; gap:15px; margin-bottom:15px;">
<div><label style="font-size:0.8rem; font-weight:bold; display:block; margin-bottom:5px;">URL DB DMR (.dat):</label><input type="text" id="url-dmr-input" style="width:100%;"></div>
<div><label style="font-size:0.8rem; font-weight:bold; display:block; margin-bottom:5px;">URL DB NXDN (.csv):</label><input type="text" id="url-nxdn-input" style="width:100%;"></div>
<div><label style="font-size:0.8rem; font-weight:300; display:block; margin-bottom:5px; color:var(--text-muted);">URL_DMR (.dat):</label><input type="text" id="url-dmr-input" style="width:100%;"></div>
<div><label style="font-size:0.8rem; font-weight:300; display:block; margin-bottom:5px; color:var(--text-muted);">URL_NXDN (.csv):</label><input type="text" id="url-nxdn-input" style="width:100%;"></div>
</div>
<div style="display:flex; justify-content:space-between; align-items:center; border-top:1px solid var(--border-color); padding-top:15px;">
<div style="display:flex; align-items:center; gap:10px;"><label style="font-size:0.8rem; font-weight:bold;" data-i18n="adminTime">Daily Update Time:</label><input type="time" id="update-time-input"></div>
<button onclick="saveSettings()" class="btn-cmd" style="background:var(--accent); max-width: 250px;" data-i18n="adminSave">SAVE CONFIGURATION</button>
<div style="display:flex; justify-content:space-between; align-items:center; border-top:1px dashed var(--border-light); padding-top:15px;">
<div style="display:flex; align-items:center; gap:10px;"><label style="font-size:0.8rem; font-weight:300;" data-i18n="adminTime">CRON_TIME:</label><input type="time" id="update-time-input"></div>
<button onclick="saveSettings()" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; max-width: 250px; flex: none;" data-i18n="adminSave">SAVE_CFG</button>
</div>
</div>
<div style="overflow-x:auto;">
<table style="width:100%; border-collapse:collapse; text-align:left;">
<thead><tr><th>ID</th><th data-i18n="thUser">User</th><th data-i18n="thRole">Role</th><th data-i18n="thNodes">Nodes</th><th style="text-align:center;" data-i18n="thActs">Actions</th></tr></thead>
<thead style="background: transparent;"><tr><th>ID</th><th data-i18n="thUser">USR</th><th data-i18n="thRole">ROLE</th><th data-i18n="thNodes">NODES</th><th style="text-align:center;" data-i18n="thActs">CMD</th></tr></thead>
<tbody id="users-table-body"></tbody>
</table>
</div>
@@ -207,112 +352,108 @@
</div>
<div id="services-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:550px;">
<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(--accent);"><span data-i18n="modSvcTitle">⚙️ System Daemons:</span> <span id="svc-modal-title" style="color:var(--text-main);"></span></h2>
<button onclick="closeServicesModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button>
<div class="modal-content" style="max-width:550px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--accent); font-weight:300;">[ <span data-i18n="modSvcTitle">DAEMONS:</span> <span id="svc-modal-title" style="color:var(--text-main);"></span> ]</h2>
<button onclick="closeServicesModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div id="services-list" style="max-height: 400px; overflow-y: auto; padding-right:10px;"></div>
<div id="services-list" style="max-height: 400px; overflow-y: auto;"></div>
</div>
</div>
<div id="configs-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:500px;">
<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:#8e44ad;" data-i18n="modFileTitle">📂 Configuration Files</h2>
<button onclick="closeConfigsModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button>
<div class="modal-content" style="max-width:500px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--primary); font-weight:300;" data-i18n="modFileTitle">[ CFG_FILES ]</h2>
<button onclick="closeConfigsModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div id="configs-list" style="display:flex; flex-direction:column; gap:10px;"></div>
<div id="configs-list" style="display:flex; flex-direction:column; gap:0;"></div>
</div>
</div>
<div id="editor-modal" class="modal-overlay">
<div class="modal-content" style="width:95%; max-width:900px; border: 1px solid var(--accent);">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
<h3 style="margin:0; color:var(--accent);"><span data-i18n="modEditTitle">📝 INI File Editor:</span> <span id="editor-title" style="color:var(--text-main);"></span></h3>
<button onclick="closeEditorModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button>
<div class="modal-content" style="max-width:900px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; border-bottom: 1px dashed var(--border-main); padding-bottom: 10px;">
<h3 style="margin:0; color:var(--accent); font-weight:300;">[ <span data-i18n="modEditTitle">EDIT:</span> <span id="editor-title" style="color:var(--text-main);"></span> ]</h3>
<button onclick="closeEditorModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div style="background:rgba(239, 68, 68, 0.1); border-left:4px solid var(--danger); padding:10px; margin-bottom:15px; font-size:0.85rem; font-weight:bold; border-radius: 8px;" data-i18n="warnEdit">
⚠️ WARNING: This editor directly manipulates remote node parameters.
</div>
<textarea id="config-textarea" spellcheck="false" style="width:100%; height:55vh; background:#0f172a; color:#10b981; font-family:'JetBrains Mono', monospace; font-size:0.95rem; padding:15px; border-radius:12px; border:1px solid #334155; resize:none; box-sizing:border-box; outline:none;"></textarea>
<textarea id="config-textarea" spellcheck="false" style="width:100%; height:55vh; background:rgba(0,0,0,0.3); color:var(--text-main); font-family:'JetBrains Mono', monospace; font-size:0.85rem; padding:15px; border:1px solid var(--border-light); resize:none; outline:none; margin-top: 15px;"></textarea>
<div style="display:flex; justify-content:space-between; margin-top:20px; align-items:center;">
<span id="editor-status" style="font-size:0.9rem; font-weight:bold;"></span>
<button onclick="saveConfig()" class="btn-cmd" style="background:var(--danger); max-width: 250px;" data-i18n="btnSave">💾 SAVE & SEND</button>
<span id="editor-status" style="font-size:0.9rem; font-weight:300; font-family:'JetBrains Mono',monospace;"></span>
<button onclick="saveConfig()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; max-width: 250px; flex: none;" data-i18n="btnSave">WRITE_FILE</button>
</div>
</div>
</div>
<div id="alert-modal" class="modal-overlay modal-top">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 2px solid var(--primary);" id="alert-box">
<h2 style="margin-top:0;" id="alert-title">ℹ️ INFO</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" id="alert-desc">Message</p>
<button onclick="document.getElementById('alert-modal').style.display='none'" class="btn-cmd" style="background:var(--primary); padding:12px; width:100%;">OK</button>
<div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--primary);" id="alert-box">
<h2 style="margin-top:0; font-weight:300;" id="alert-title">[ INFO ]</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 300;" id="alert-desc">MSG</p>
<button onclick="document.getElementById('alert-modal').style.display='none'" class="btn-cmd" style="border-color:var(--primary); color:var(--primary) !important; width:100%;">ACK</button>
</div>
</div>
<div id="confirm-modal" class="modal-overlay modal-top">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 2px solid var(--danger);" id="confirm-box">
<h2 style="margin-top:0;" id="confirm-title">⚠️ WARNING</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" id="confirm-desc">Are you sure?</p>
<div style="display:flex; flex-direction:column; gap:15px;">
<button id="confirm-yes-btn" onclick="executeConfirmAction()" class="btn-cmd" style="background:var(--danger); padding:15px; font-size:1.1rem; font-weight:800;">YES, PROCEED</button>
<button id="confirm-cancel-btn" onclick="document.getElementById('confirm-modal').style.display='none'" class="btn-cmd" style="background:var(--text-muted); padding:12px; margin-top:10px;">CANCEL</button>
<div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--danger);" id="confirm-box">
<h2 style="margin-top:0; font-weight:300;" id="confirm-title">[ WARN ]</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 300;" id="confirm-desc">SURE?</p>
<div style="display:flex; flex-direction:column; gap:10px;">
<button id="confirm-yes-btn" onclick="executeConfirmAction()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important;">EXECUTE</button>
<button id="confirm-cancel-btn" onclick="document.getElementById('confirm-modal').style.display='none'" class="btn-cmd">ABORT</button>
</div>
</div>
</div>
<div id="password-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 1px solid var(--accent);">
<h2 style="margin-top:0; color:var(--accent);">🔑 <span data-i18n="btnPass">PASSWORD CHANGE</span></h2>
<p style="margin-bottom:20px; color:var(--text-main); font-weight: 600;" data-i18n="promptPass">Enter the new password:</p>
<input type="password" id="new-password-input" style="width:100%; padding:12px; font-size:1rem; margin-bottom:20px; text-align:center;" placeholder="***">
<div class="modal-content" style="max-width:400px; text-align:center;">
<h2 style="margin-top:0; color:var(--accent); border-bottom: 1px dashed var(--border-main); padding-bottom: 10px; font-weight:300;" data-i18n="btnPass">[ CHG_PWD ]</h2>
<p style="margin-bottom:20px; font-weight: 300;" data-i18n="promptPass">NEW PWD:</p>
<input type="password" id="new-password-input" style="width:100%; text-align:center; margin-bottom: 20px;">
<div style="display:flex; flex-direction:column; gap:10px;">
<button onclick="executePasswordChange()" class="btn-cmd" style="background:var(--success); padding:15px; font-size:1.1rem; font-weight:800;" data-i18n="titleSave">💾 SAVE</button>
<button onclick="closePasswordModal()" class="btn-cmd" style="background:var(--text-muted); padding:12px;" data-i18n="btnCancel">CANCEL</button>
<button onclick="executePasswordChange()" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important;" data-i18n="titleSave">SAVE</button>
<button onclick="closePasswordModal()" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div>
</div>
</div>
<div id="override-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center;">
<h2 style="margin-top:0; color:var(--danger);">🚨 <span data-i18n="titleGlobal">GLOBAL OVERRIDE</span> 🚨</h2>
<p style="margin-bottom:25px; color:var(--text-muted); font-weight: 600;" id="override-desc">Select the profile to send to the ENTIRE network:</p>
<div id="global-btn-container" style="display:flex; flex-direction:column; gap:15px; margin-bottom: 15px;"></div>
<button onclick="document.getElementById('override-modal').style.display='none'" class="btn-cmd" style="background:var(--text-muted); padding:12px; width:100%;" data-i18n="btnCancel">CANCEL</button>
<div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--danger);">
<h2 style="margin-top:0; color:var(--danger); font-weight:300;" data-i18n="titleGlobal">[ GBL_OVR ]</h2>
<p style="margin-bottom:25px; font-weight: 300; color:var(--text-muted);" id="override-desc">SELECT PROF:</p>
<div id="global-btn-container" style="display:flex; flex-direction:column; gap:10px; margin-bottom: 15px;"></div>
<button onclick="document.getElementById('override-modal').style.display='none'" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div>
</div>
<div id="reset-hat-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 1px solid var(--danger);">
<h2 style="margin-top:0; color:var(--danger);">🔌 <span data-i18n="btnHat">RESET HAT</span> 🔌</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" id="reset-hat-desc">Do you want to send a PHYSICAL RESET to the radio board?</p>
<div style="display:flex; flex-direction:column; gap:15px;">
<button onclick="executeHatReset()" class="btn-cmd blink" style="background:var(--danger); padding:15px; font-size:1.1rem; font-weight:800;" data-i18n="btnConfReset">⚠️ CONFIRM RESET</button>
<button onclick="closeHatResetModal()" class="btn-cmd" style="background:var(--text-muted); padding:12px; margin-top:10px;" data-i18n="btnCancel">CANCEL</button>
<div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--danger);">
<h2 style="margin-top:0; color:var(--danger); font-weight:300;" data-i18n="btnHat">[ RST_HAT ]</h2>
<p style="margin-bottom:25px; font-weight: 300;" id="reset-hat-desc">PHYSICAL RESET?</p>
<div style="display:flex; flex-direction:column; gap:10px;">
<button onclick="executeHatReset()" class="btn-cmd blink" style="border-color:var(--danger); color:var(--danger) !important;" data-i18n="btnConfReset">CONFIRM</button>
<button onclick="closeHatResetModal()" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div>
</div>
</div>
<div id="update-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 1px solid var(--accent);">
<h2 style="margin-top:0; color:var(--accent);">🔄 <span data-i18n="modUpdateTitle">GLOBAL UPDATE</span> 🔄</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" data-i18n="confUpdate">Do you want to request updated data from all nodes in the fleet?</p>
<div style="display:flex; flex-direction:column; gap:15px;">
<button onclick="executeUpdateRequest()" class="btn-cmd" style="background:var(--accent); padding:15px; font-size:1.1rem; font-weight:800;" data-i18n="btnReqCfg">🔄 REQ CONFIG</button>
<button onclick="closeUpdateModal()" class="btn-cmd" style="background:var(--text-muted); padding:12px; margin-top:10px;" data-i18n="btnCancel">CANCEL</button>
<div class="modal-content" style="max-width:400px; text-align:center;">
<h2 style="margin-top:0; color:var(--primary); border-bottom: 1px dashed var(--border-main); padding-bottom: 10px; font-weight:300;" data-i18n="modUpdateTitle">[ GBL_UPDATE ]</h2>
<p style="margin-bottom:25px; font-weight: 300;" data-i18n="confUpdate">REQ DATA?</p>
<div style="display:flex; flex-direction:column; gap:10px;">
<button onclick="executeUpdateRequest()" class="btn-cmd" style="border-color:var(--primary); color:var(--primary) !important;" data-i18n="btnReqCfg">EXECUTE</button>
<button onclick="closeUpdateModal()" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div>
</div>
</div>
<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);">
<div class="modal-content" style="max-width:450px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--primary); font-weight:300;" data-i18n="modVersions">[ SW_VERSIONS ]</h2>
<button onclick="closeVersionsModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div id="versions-list" style="background: transparent; padding: 15px; border: 1px solid var(--border-light); font-size: 0.85rem; line-height: 1.8;"></div>
</div>
</div>
@@ -320,16 +461,16 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.2/socket.io.min.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<!-- MOTORE MODULARIZZATO JS -->
<script src="/static/js/modals.js"></script>
<script src="/static/js/app.js"></script>
<!-- MOTORE MODULARIZZATO JS (Cache Buster aggiunto per forzare il refresh) -->
<script src="/static/js/modals.js?v=blueprint4"></script>
<script src="/static/js/app.js?v=1793656210"></script>
<!-- SERVICE WORKER -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').catch(err => {
console.log('ServiceWorker fallita: ', err);
console.log('SW_ERR: ', err);
});
});
}