Compare commits
19
Commits
b684976665
..
v5.2.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fc08f1c23 | ||
|
|
66cd63a181 | ||
|
|
36def1e201 | ||
|
|
a6c24244bd | ||
|
|
502dcc2f65 | ||
|
|
d4e83364e2 | ||
|
|
fa4b3d8df2 | ||
|
|
a67ddd582c | ||
|
|
7ee7b00b37 | ||
|
|
ebaefeeedf | ||
|
|
2e8b75c384 | ||
|
|
a56da30330 | ||
|
|
9b7c76c801 | ||
|
|
bf4a669446 | ||
|
|
e92a37f02a | ||
|
|
2456f462fe | ||
|
|
34180df506 | ||
|
|
99c5d4f431 | ||
|
|
c47377a22c |
@@ -47,6 +47,7 @@ node_versions = {}
|
|||||||
gateway_states = {}
|
gateway_states = {}
|
||||||
active_warnings = {}
|
active_warnings = {}
|
||||||
active_calls = {}
|
active_calls = {}
|
||||||
|
operating_modes = {}
|
||||||
|
|
||||||
# Caricamento iniziale cache telemetria
|
# Caricamento iniziale cache telemetria
|
||||||
if os.path.exists(CACHE_FILE):
|
if os.path.exists(CACHE_FILE):
|
||||||
|
|||||||
+33
-14
@@ -15,6 +15,10 @@ from services.mqtt_service import mqtt_publish
|
|||||||
from services.push_service import node_allowed
|
from services.push_service import node_allowed
|
||||||
from routes.auth_routes import get_auth, json_body, err
|
from routes.auth_routes import get_auth, json_body, err
|
||||||
|
|
||||||
|
# --- AGGIUNTE PER GITEA BACKGROUND CHECK ---
|
||||||
|
GLOBAL_SERVER_UPDATE_AVAILABLE = False
|
||||||
|
LAST_GITEA_CHECK_TIME = 0
|
||||||
|
|
||||||
api_bp = Blueprint('api', __name__)
|
api_bp = Blueprint('api', __name__)
|
||||||
|
|
||||||
# --- REGEX & COSTANTI COMANDI ---
|
# --- REGEX & COSTANTI COMANDI ---
|
||||||
@@ -104,7 +108,8 @@ def get_states():
|
|||||||
"uptime": int(time.time() - state.START_TIME),
|
"uptime": int(time.time() - state.START_TIME),
|
||||||
"versions": clean_versions,
|
"versions": clean_versions,
|
||||||
"gateway_states": enriched_gateway_states,
|
"gateway_states": enriched_gateway_states,
|
||||||
"warnings": state.active_warnings
|
"warnings": state.active_warnings,
|
||||||
|
"modes": getattr(state, "operating_modes", {})
|
||||||
})
|
})
|
||||||
|
|
||||||
@api_bp.route('/api/stats')
|
@api_bp.route('/api/stats')
|
||||||
@@ -127,7 +132,7 @@ def get_stats():
|
|||||||
top_tgs = [{"target": row[0], "count": row[1]} for row in c.fetchall()]
|
top_tgs = [{"target": row[0], "count": row[1]} for row in c.fetchall()]
|
||||||
|
|
||||||
c.execute(f"""SELECT source_id, COUNT(*) as cnt FROM radio_logs
|
c.execute(f"""SELECT source_id, COUNT(*) as cnt FROM radio_logs
|
||||||
WHERE source_id NOT LIKE '🌐%'
|
WHERE source_id NOT LIKE '倹%'
|
||||||
AND timestamp >= date('now', 'localtime') AND timestamp < date('now', 'localtime', '+1 day'){node_filter}
|
AND timestamp >= date('now', 'localtime') AND timestamp < date('now', 'localtime', '+1 day'){node_filter}
|
||||||
GROUP BY source_id ORDER BY cnt DESC LIMIT 5""", params)
|
GROUP BY source_id ORDER BY cnt DESC LIMIT 5""", params)
|
||||||
top_calls = [{"call": row[0], "count": row[1]} for row in c.fetchall()]
|
top_calls = [{"call": row[0], "count": row[1]} for row in c.fetchall()]
|
||||||
@@ -181,7 +186,7 @@ def cmd():
|
|||||||
return err("Broker MQTT non raggiungibile - comando non inviato", 503)
|
return err("Broker MQTT non raggiungibile - comando non inviato", 503)
|
||||||
|
|
||||||
audit(auth['username'], cid, cmd_type)
|
audit(auth['username'], cid, cmd_type)
|
||||||
state.client_telemetry[cid] = {"ts1": "🔄 Inviato...", "ts2": "🔄 Inviato...", "alt": ""}
|
state.client_telemetry[cid] = {"ts1": "売 Inviato...", "ts2": "売 Inviato...", "alt": ""}
|
||||||
return jsonify({"success": True})
|
return jsonify({"success": True})
|
||||||
|
|
||||||
@api_bp.route('/api/global_command', methods=['POST'])
|
@api_bp.route('/api/global_command', methods=['POST'])
|
||||||
@@ -242,7 +247,7 @@ def update_nodes():
|
|||||||
return err("Non autorizzato", 403)
|
return err("Non autorizzato", 403)
|
||||||
if not mqtt_publish("devices/control/request", "update"):
|
if not mqtt_publish("devices/control/request", "update"):
|
||||||
return err("Broker MQTT non raggiungibile", 503)
|
return err("Broker MQTT non raggiungibile", 503)
|
||||||
logger.info(f"📢 REQ CONFIG inviata a tutta la flotta da {auth['username']}")
|
logger.info(f"討 REQ CONFIG inviata a tutta la flotta da {auth['username']}")
|
||||||
audit(auth['username'], '*', 'REQ_CONFIG_ALL')
|
audit(auth['username'], '*', 'REQ_CONFIG_ALL')
|
||||||
return jsonify({"success": True})
|
return jsonify({"success": True})
|
||||||
|
|
||||||
@@ -346,25 +351,39 @@ def save_config_file():
|
|||||||
if not mqtt_publish(f"devices/{cid}/config_set/{service}", json.dumps(new_config)):
|
if not mqtt_publish(f"devices/{cid}/config_set/{service}", json.dumps(new_config)):
|
||||||
return err("Broker MQTT non raggiungibile", 503)
|
return err("Broker MQTT non raggiungibile", 503)
|
||||||
audit(auth['username'], cid, f"EDIT_CONFIG_{service.upper()}")
|
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})
|
return jsonify({"success": True})
|
||||||
|
|
||||||
# --- AGGIORNAMENTO SERVER OTA ---
|
# --- AGGIORNAMENTO SERVER OTA ---
|
||||||
|
|
||||||
@api_bp.route('/api/server_update/check', methods=['GET'])
|
def background_gitea_check():
|
||||||
def check_server_update():
|
global GLOBAL_SERVER_UPDATE_AVAILABLE, LAST_GITEA_CHECK_TIME
|
||||||
auth = get_auth()
|
|
||||||
if not auth or auth['role'] != 'admin':
|
|
||||||
return err("Non autorizzato", 403)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.run(['git', 'fetch'], timeout=10, cwd=BASE_DIR)
|
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()
|
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()
|
remote_hash = subprocess.check_output(['git', 'rev-parse', '@{u}'], cwd=BASE_DIR).decode('utf-8').strip()
|
||||||
update_available = local_hash != remote_hash
|
GLOBAL_SERVER_UPDATE_AVAILABLE = (local_hash != remote_hash)
|
||||||
return jsonify({"success": True, "update_available": update_available})
|
LAST_GITEA_CHECK_TIME = time.time()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Errore controllo aggiornamenti server: {e}")
|
logger.error(f"Errore controllo Gitea in background: {e}")
|
||||||
return jsonify({"success": False, "error": "Impossibile verificare aggiornamenti"})
|
|
||||||
|
@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'])
|
@api_bp.route('/api/server_update/apply', methods=['POST'])
|
||||||
def apply_server_update():
|
def apply_server_update():
|
||||||
|
|||||||
+51
-31
@@ -1,6 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import datetime
|
|
||||||
from paho.mqtt import client as mqtt_client
|
from paho.mqtt import client as mqtt_client
|
||||||
from core.config import config, logger
|
from core.config import config, logger
|
||||||
from core.database import save_to_sqlite
|
from core.database import save_to_sqlite
|
||||||
@@ -19,7 +18,7 @@ def on_connect(client, userdata, flags, reason_code, properties=None):
|
|||||||
default_topics = [
|
default_topics = [
|
||||||
"servizi/+/stat", "dmr-gateway/+/json", "devices/+/services",
|
"servizi/+/stat", "dmr-gateway/+/json", "devices/+/services",
|
||||||
"nxdn-gateway/+/json", "ysf-gateway/+/json", "p25-gateway/+/json",
|
"nxdn-gateway/+/json", "ysf-gateway/+/json", "p25-gateway/+/json",
|
||||||
"dstar-gateway/+/json", "mmdvm/+/json", "data/#", "aprs-gateway/aprs"
|
"dstar-gateway/+/json", "mmdvm/+/json", "data/#"
|
||||||
]
|
]
|
||||||
|
|
||||||
topics_list = config.get('mqtt', {}).get('topics', default_topics)
|
topics_list = config.get('mqtt', {}).get('topics', default_topics)
|
||||||
@@ -43,35 +42,6 @@ def on_message(client, userdata, msg):
|
|||||||
try:
|
try:
|
||||||
topic = msg.topic
|
topic = msg.topic
|
||||||
payload = msg.payload.decode('utf-8', errors='replace').strip()
|
payload = msg.payload.decode('utf-8', errors='replace').strip()
|
||||||
|
|
||||||
# NUOVO BLOCCO APRS
|
|
||||||
if topic == "aprs-gateway/aprs":
|
|
||||||
try:
|
|
||||||
raw_aprs = payload
|
|
||||||
# Formato atteso: SOURCE>DEST,PATH:PAYLOAD
|
|
||||||
if ">" in raw_aprs and ":" in raw_aprs:
|
|
||||||
header, aprs_payload = raw_aprs.split(":", 1)
|
|
||||||
source, rest = header.split(">", 1)
|
|
||||||
|
|
||||||
if "," in rest:
|
|
||||||
dest, path = rest.split(",", 1)
|
|
||||||
else:
|
|
||||||
dest = rest
|
|
||||||
path = ""
|
|
||||||
|
|
||||||
aprs_data = {
|
|
||||||
"time": datetime.datetime.now().strftime("%H:%M:%S"),
|
|
||||||
"source": source.strip(),
|
|
||||||
"dest": dest.strip(),
|
|
||||||
"path": path.strip(),
|
|
||||||
"payload": aprs_payload.strip()
|
|
||||||
}
|
|
||||||
|
|
||||||
state.socketio.emit('aprs_msg', aprs_data)
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Errore decodifica APRS: {e}")
|
|
||||||
return # Esci per non processare il resto della logica su questo topic
|
|
||||||
|
|
||||||
parts = topic.split('/')
|
parts = topic.split('/')
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
return
|
return
|
||||||
@@ -334,6 +304,46 @@ def on_message(client, userdata, msg):
|
|||||||
if m and "running" not in m.lower():
|
if m and "running" not in m.lower():
|
||||||
save_to_sqlite(cid, {'src_id': f"🌐 {m}", 'dst_id': 'NET'}, protocol=proto)
|
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) ---
|
# --- 8. TRAFFICO VOCE MMDVM (DMR & MODI DIGITALI) ---
|
||||||
elif parts[0] == 'mmdvm':
|
elif parts[0] == 'mmdvm':
|
||||||
data = json.loads(payload)
|
data = json.loads(payload)
|
||||||
@@ -349,6 +359,16 @@ def on_message(client, userdata, msg):
|
|||||||
|
|
||||||
state.client_telemetry[cid]["idle"] = False
|
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:
|
if 'DMR' in data:
|
||||||
d = data['DMR']
|
d = data['DMR']
|
||||||
act = d.get('action')
|
act = d.get('action')
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
@@ -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);
|
||||||
|
}
|
||||||
+412
-43
@@ -1,5 +1,14 @@
|
|||||||
|
function updateClock() {
|
||||||
|
const clockEl = document.getElementById('live-clock');
|
||||||
|
if (clockEl) {
|
||||||
|
const now = new Date();
|
||||||
|
const dateStr = now.toLocaleDateString('it-IT', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||||
|
const timeStr = now.toLocaleTimeString('it-IT', { hour12: false, hour: '2-digit', minute:'2-digit', second:'2-digit' });
|
||||||
|
clockEl.innerHTML = `<span style="color:var(--primary);">SYS_TIME:</span> ${dateStr} // <b style="color:var(--text-main);">${timeStr}</b> LOC`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- VARIABILI GLOBALI E UI VIEW ---
|
// --- VARIABILI GLOBALI E UI VIEW ---
|
||||||
const HANG_TIME_MS = 3000;
|
|
||||||
let clients = [];
|
let clients = [];
|
||||||
let me = { logged_in: false, user: '', role: '', allowed_nodes: '' };
|
let me = { logged_in: false, user: '', role: '', allowed_nodes: '' };
|
||||||
let isAuthenticated = false;
|
let isAuthenticated = false;
|
||||||
@@ -17,6 +26,46 @@ let fleetMap = null;
|
|||||||
let mapMarkers = {};
|
let mapMarkers = {};
|
||||||
|
|
||||||
let currentFocusedNode = null;
|
let currentFocusedNode = null;
|
||||||
|
let currentMmdvmConfig = "";
|
||||||
|
let currentMmdvmConfigAlias = "";
|
||||||
|
let currentMmdvmServiceName = "";
|
||||||
|
|
||||||
|
// --- LAYOUT SWITCHER ---
|
||||||
|
const layouts = ['layout-blueprint', 'layout-tactical', 'layout-light', 'layout-glass'];
|
||||||
|
const layoutLabels = ['[ L: BLU ]', '[ L: TAC ]', '[ L: LGT ]', '[ L: GLASS ]'];
|
||||||
|
let currentLayoutIdx = 0;
|
||||||
|
|
||||||
|
function initLayout() {
|
||||||
|
const saved = localStorage.getItem('fleetLayout') || 'layout-blueprint';
|
||||||
|
currentLayoutIdx = layouts.indexOf(saved) > -1 ? layouts.indexOf(saved) : 0;
|
||||||
|
applyLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
function cycleLayout() {
|
||||||
|
currentLayoutIdx = (currentLayoutIdx + 1) % layouts.length;
|
||||||
|
localStorage.setItem('fleetLayout', layouts[currentLayoutIdx]);
|
||||||
|
applyLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyLayout() {
|
||||||
|
document.body.classList.remove(...layouts);
|
||||||
|
if (layouts[currentLayoutIdx] !== 'layout-blueprint') {
|
||||||
|
document.body.classList.add(layouts[currentLayoutIdx]);
|
||||||
|
}
|
||||||
|
const btn = document.getElementById('layout-btn');
|
||||||
|
if (btn) btn.innerText = layoutLabels[currentLayoutIdx];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mappatura Modo -> Gateway service name
|
||||||
|
const MODE_GATEWAYS = {
|
||||||
|
'DMR': ['dmrgateway'],
|
||||||
|
'NXDN': ['nxdngateway'],
|
||||||
|
'System Fusion': ['ysfgateway'],
|
||||||
|
'D-Star': ['dstargateway', 'dstar-gateway'],
|
||||||
|
'P25': ['p25gateway'],
|
||||||
|
'M17': ['m17gateway', 'm17-gateway']
|
||||||
|
};
|
||||||
|
|
||||||
function switchView(viewName) {
|
function switchView(viewName) {
|
||||||
currentFocusedNode = null;
|
currentFocusedNode = null;
|
||||||
@@ -56,8 +105,25 @@ function openNodeFocus(clientId) {
|
|||||||
document.getElementById('tab-aprs').classList.remove('active');
|
document.getElementById('tab-aprs').classList.remove('active');
|
||||||
|
|
||||||
document.getElementById('view-focus').style.display = 'block';
|
document.getElementById('view-focus').style.display = 'block';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
|
||||||
|
const role = me.role || '';
|
||||||
|
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
|
||||||
|
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
|
||||||
|
|
||||||
|
const modesCard = document.getElementById('focus-modes-card');
|
||||||
|
if (modesCard) {
|
||||||
|
modesCard.style.display = canControl ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canControl) {
|
||||||
|
document.getElementById('focus-modes-toggles').innerHTML = '<span style="color:var(--text-muted); font-size: 0.9rem;" class="blink">FETCHING CONFIG...</span>';
|
||||||
|
fetchNodeConfigForModes(clientId);
|
||||||
|
}
|
||||||
|
|
||||||
refreshStates();
|
refreshStates();
|
||||||
refreshLogs();
|
refreshLogs();
|
||||||
}
|
}
|
||||||
@@ -65,14 +131,18 @@ function openNodeFocus(clientId) {
|
|||||||
function closeNodeFocus() {
|
function closeNodeFocus() {
|
||||||
currentFocusedNode = null;
|
currentFocusedNode = null;
|
||||||
document.getElementById('view-focus').style.display = 'none';
|
document.getElementById('view-focus').style.display = 'none';
|
||||||
|
const modesCard = document.getElementById('focus-modes-card');
|
||||||
|
if (modesCard) modesCard.style.display = 'none';
|
||||||
switchView(localStorage.getItem('fleetDefaultView') || 'home');
|
switchView(localStorage.getItem('fleetDefaultView') || 'home');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
const savedView = localStorage.getItem('fleetDefaultView') || 'home';
|
const savedView = localStorage.getItem('fleetDefaultView') || 'home';
|
||||||
switchView(savedView);
|
switchView(savedView);
|
||||||
|
initLayout();
|
||||||
initUI();
|
initUI();
|
||||||
checkPushStatus();
|
checkPushStatus();
|
||||||
|
setInterval(updateClock, 1000); updateClock();
|
||||||
setInterval(refreshStates, 15000);
|
setInterval(refreshStates, 15000);
|
||||||
setInterval(() => { refreshLogs(); refreshStats(); }, 60000);
|
setInterval(() => { refreshLogs(); refreshStats(); }, 60000);
|
||||||
checkServerUpdate();
|
checkServerUpdate();
|
||||||
@@ -216,6 +286,223 @@ function sendTgCommand(clientId, comando) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- LOGICA MODI OPERATIVI E GATEWAYS ---
|
||||||
|
async function fetchNodeConfigForModes(clientId) {
|
||||||
|
const role = me.role || '';
|
||||||
|
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
|
||||||
|
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
|
||||||
|
const modesCard = document.getElementById('focus-modes-card');
|
||||||
|
if (!canControl) {
|
||||||
|
if (modesCard) modesCard.style.display = 'none';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (modesCard) modesCard.style.display = 'block';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const healthObj = globalHealthData[clientId.toLowerCase()];
|
||||||
|
if (!healthObj) {
|
||||||
|
document.getElementById('focus-modes-toggles').innerHTML = '<span style="color:var(--danger); font-size: 0.9rem;">NO DAEMON DATA YET. RETRYING...</span>';
|
||||||
|
setTimeout(() => { if (currentFocusedNode === clientId) fetchNodeConfigForModes(clientId); }, 2000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let filesList = healthObj.files || healthObj.config_files || [];
|
||||||
|
let iniFile = filesList.find(f => String(f).toLowerCase().includes('mmdvm') && String(f).toLowerCase().endsWith('.ini'));
|
||||||
|
if(!iniFile) iniFile = "MMDVMHost.ini";
|
||||||
|
|
||||||
|
let svcName = Object.keys(healthObj.processes || {}).find(k => k.toLowerCase().includes('mmdvm')) || "mmdvmhost";
|
||||||
|
currentMmdvmServiceName = svcName;
|
||||||
|
|
||||||
|
let candidates = ["mmdvm", svcName, "mmdvmhost", iniFile, "MMDVMHost.ini"];
|
||||||
|
let foundText = null;
|
||||||
|
|
||||||
|
for (let candidate of candidates) {
|
||||||
|
if(!candidate) continue;
|
||||||
|
try {
|
||||||
|
let res = await fetch(`/api/config_file/${encodeURIComponent(clientId)}/${encodeURIComponent(candidate)}`);
|
||||||
|
let data = await res.json();
|
||||||
|
if (data.success && data.data && data.data.raw_text && data.data.raw_text.length > 100) {
|
||||||
|
foundText = data.data.raw_text;
|
||||||
|
currentMmdvmConfigAlias = candidate; // Alias con cui salvare
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundText) {
|
||||||
|
currentMmdvmConfig = foundText;
|
||||||
|
renderModeToggles(clientId);
|
||||||
|
} else {
|
||||||
|
document.getElementById('focus-modes-toggles').innerHTML = `
|
||||||
|
<div style="display:flex; justify-content:space-between; align-items:center; width: 100%;">
|
||||||
|
<span style="color:var(--accent); font-size: 0.8rem;">[!] CFG MEMORY EMPTY</span>
|
||||||
|
<button class="btn-cmd" style="border-color:var(--accent); color:var(--accent)!important; width:auto; padding:4px 10px; flex:none;" onclick="fetch('/api/update_nodes', {method: 'POST'}); this.innerText='WAIT...'; setTimeout(() => fetchNodeConfigForModes('${clientId}'), 5000);">[ REQ_DATA ]</button>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
document.getElementById('focus-modes-toggles').innerHTML = '<span style="color:var(--danger); font-size: 0.9rem;">NETWORK ERROR</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderModeToggles(clientId, statusMsg = "") {
|
||||||
|
const role = me.role || '';
|
||||||
|
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
|
||||||
|
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
|
||||||
|
|
||||||
|
const modesCard = document.getElementById('focus-modes-card');
|
||||||
|
if (modesCard) {
|
||||||
|
modesCard.style.display = canControl ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
let container = document.getElementById('focus-modes-toggles');
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
if (!canControl) {
|
||||||
|
container.innerHTML = '<span style="color:var(--danger); font-size: 0.9rem;">[ ACCESS DENIED ]</span>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const modes = [
|
||||||
|
{ id: 'DMR', label: 'DMR', color: 'var(--primary)' },
|
||||||
|
{ id: 'D-Star', label: 'D-STAR', color: '#f97316' },
|
||||||
|
{ id: 'System Fusion', label: 'YSF', color: '#8b5cf6' },
|
||||||
|
{ id: 'NXDN', label: 'NXDN', color: 'var(--success)' },
|
||||||
|
{ id: 'P25', label: 'P25', color: 'var(--accent)' },
|
||||||
|
{ id: 'FM', label: 'FM', color: '#14b8a6' },
|
||||||
|
{ id: 'M17', label: 'M17', color: '#ec4899' } // Aggiunto modo M17 (Rosa/Pink)
|
||||||
|
];
|
||||||
|
|
||||||
|
let html = "";
|
||||||
|
let lines = currentMmdvmConfig.split('\n');
|
||||||
|
|
||||||
|
modes.forEach(m => {
|
||||||
|
let enabled = false;
|
||||||
|
let sectionFound = false;
|
||||||
|
let currentSection = "";
|
||||||
|
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let line = lines[i].trim();
|
||||||
|
if (line.startsWith('[') && line.endsWith(']')) {
|
||||||
|
currentSection = line.substring(1, line.length - 1);
|
||||||
|
}
|
||||||
|
if (currentSection.toLowerCase() === m.id.toLowerCase() && line.toLowerCase().startsWith('enable')) {
|
||||||
|
sectionFound = true;
|
||||||
|
let parts = line.split('=');
|
||||||
|
if (parts.length === 2 && parts[1].trim() === '1') {
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sectionFound) {
|
||||||
|
let btnStyle = enabled
|
||||||
|
? `border-color: ${m.color}; color: ${m.color} !important; box-shadow: inset 0 0 8px ${m.color}; font-weight: bold;`
|
||||||
|
: `border-color: var(--border-light); color: var(--text-muted) !important; opacity: 0.4;`;
|
||||||
|
|
||||||
|
// Rimosso flex:1 per evitare che l'ultimo bottone si allarghi al 100% sulla riga vuota
|
||||||
|
html += `<button class="btn-cmd" style="padding: 10px; font-size: 1.1rem; width: 100%; transition: all 0.2s ease; ${btnStyle}" onclick="toggleOperatingMode('${clientId}', '${m.id}', ${!enabled})">${m.label}</button>`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (html === "") {
|
||||||
|
html = '<span style="color:var(--text-muted); font-size: 0.9rem;">NO MODES FOUND IN CONFIG</span>';
|
||||||
|
} else {
|
||||||
|
// Avvolgiamo i bottoni in una CSS Grid per un allineamento perfetto e proporzionato
|
||||||
|
html = `<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(75px, 1fr)); gap: 10px; width: 100%;">${html}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusMsg) {
|
||||||
|
html += `<div style="width: 100%; margin-top: 12px; font-family: 'JetBrains Mono', monospace;">${statusMsg}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
container.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleOperatingMode(clientId, section, enable) {
|
||||||
|
const title = currentLang === 'it' ? "[ CAMBIO_MODO ]" : "[ MODE_TOGGLE ]";
|
||||||
|
const msg = currentLang === 'it'
|
||||||
|
? `Vuoi ${enable ? 'ABILITARE' : 'DISABILITARE'} il modo <b>${section}</b>?<br><br><span style="font-size:0.8rem; color:var(--text-muted);">Verranno aggiornati MMDVMHost e il relativo Gateway.</span>`
|
||||||
|
: `${enable ? 'ENABLE' : 'DISABLE'} mode <b>${section}</b>?<br><br><span style="font-size:0.8rem; color:var(--text-muted);">This will update MMDVMHost and its Gateway.</span>`;
|
||||||
|
|
||||||
|
customConfirm(title, msg, enable ? "var(--success)" : "var(--danger)", async () => {
|
||||||
|
// 1. Aggiorna subito il testo locale del file INI
|
||||||
|
let lines = currentMmdvmConfig.split('\n');
|
||||||
|
let currentSection = "";
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let cleanLine = lines[i].trim();
|
||||||
|
if (cleanLine.startsWith('[') && cleanLine.endsWith(']')) {
|
||||||
|
currentSection = cleanLine.substring(1, cleanLine.length - 1);
|
||||||
|
}
|
||||||
|
if (currentSection.toLowerCase() === section.toLowerCase() && cleanLine.toLowerCase().startsWith('enable')) {
|
||||||
|
lines[i] = lines[i].replace(/Enable\s*=\s*[01]/i, `Enable=${enable ? "1" : "0"}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentMmdvmConfig = lines.join('\n');
|
||||||
|
|
||||||
|
// 2. Ridisegna SUBITO i pulsanti (così il tasto cambia stato all'istante) e mostra la nota di caricamento
|
||||||
|
renderModeToggles(clientId, '<span style="color:var(--accent); font-size:0.8rem;" class="blink">⏳ SALVATAGGIO & RIAVVIO IN CORSO...</span>');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 3. Salva il file INI
|
||||||
|
const resSave = await fetch('/api/config_file', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({
|
||||||
|
clientId: clientId,
|
||||||
|
service: currentMmdvmConfigAlias,
|
||||||
|
config_data: { "raw_text": currentMmdvmConfig }
|
||||||
|
})
|
||||||
|
});
|
||||||
|
const dataSave = await resSave.json();
|
||||||
|
if (!dataSave.success) throw new Error("SAVE ERR: " + dataSave.error);
|
||||||
|
|
||||||
|
// 4. Invia start/stop al Gateway associato
|
||||||
|
const healthObj = globalHealthData[clientId.toLowerCase()] || {};
|
||||||
|
const gwCandidates = MODE_GATEWAYS[section] || [];
|
||||||
|
const runningProcs = Object.keys(healthObj.processes || {});
|
||||||
|
const targetGw = gwCandidates.find(g => runningProcs.some(p => p.toLowerCase() === g.toLowerCase()));
|
||||||
|
|
||||||
|
if (targetGw) {
|
||||||
|
const gwAction = enable ? 'start' : 'stop';
|
||||||
|
await fetch('/api/service_control', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({ clientId: clientId, service: targetGw, action: gwAction })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Riavvia MMDVMHost
|
||||||
|
const resRst = await fetch('/api/service_control', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({ clientId: clientId, service: currentMmdvmServiceName, action: 'restart' })
|
||||||
|
});
|
||||||
|
const dataRst = await resRst.json();
|
||||||
|
if (!dataRst.success) throw new Error("RESTART ERR: " + dataRst.error);
|
||||||
|
|
||||||
|
// 6. Conferma avvenuta applicazione senza ricaricare file vecchi
|
||||||
|
renderModeToggles(clientId, '<span style="color:var(--success); font-size:0.8rem;">✅ STATO AGGIORNATO CON SUCCESSO!</span>');
|
||||||
|
|
||||||
|
// Rimuove il messaggio di conferma dopo 3 secondi lasciando i bottoni nello stato nuovo
|
||||||
|
setTimeout(() => {
|
||||||
|
if (currentFocusedNode === clientId) {
|
||||||
|
renderModeToggles(clientId);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
customAlert(t('titleError'), String(e), true);
|
||||||
|
fetchNodeConfigForModes(clientId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- INIT APP ---
|
||||||
async function initUI() {
|
async function initUI() {
|
||||||
applyTranslations();
|
applyTranslations();
|
||||||
try {
|
try {
|
||||||
@@ -335,12 +622,13 @@ async function initUI() {
|
|||||||
const miniGrid = document.getElementById('home-mini-nodes');
|
const miniGrid = document.getElementById('home-mini-nodes');
|
||||||
if (miniGrid) {
|
if (miniGrid) {
|
||||||
miniGrid.innerHTML = clients.map(c => `
|
miniGrid.innerHTML = clients.map(c => `
|
||||||
<div id="mini-card-${c.id}" class="mini-card" onclick="openNodeFocus('${c.id}')">
|
<div id="mini-card-${c.id}" class="mini-card" onclick="openNodeFocus('${c.id}')" style="width: 180px !important; min-width: 180px !important; height: 125px !important; display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 12px; box-sizing: border-box;">
|
||||||
<div class="mini-card-content">
|
<div class="mini-card-content" style="flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;">
|
||||||
<div id="mini-name-${c.id}" class="mini-card-name" title="${esc(c.name)}">${esc(c.name)}</div>
|
<div id="mini-name-${c.id}" class="mini-card-name" title="${esc(c.name)}">${esc(c.name)}</div>
|
||||||
<div id="mini-id-${c.id}" style="font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;">ID: ${c.id.toUpperCase()}</div>
|
<div id="mini-id-${c.id}" style="font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;">ID: ${c.id.toUpperCase()}</div>
|
||||||
|
<div id="mini-caller-${c.id}" style="font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: bold; margin-top: 6px; display: none; text-align: center; line-height: 1.1;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="mini-status-${c.id}" class="mini-card-status" title="OFFLINE">OFFLINE</div>
|
<div id="mini-status-${c.id}" class="mini-card-status" title="OFFLINE" style="position: relative !important; bottom: auto !important; left: auto !important; transform: none !important; width: 90%; margin: 0 auto; flex-shrink: 0;">OFFLINE</div>
|
||||||
</div>
|
</div>
|
||||||
`).join('');
|
`).join('');
|
||||||
}
|
}
|
||||||
@@ -386,7 +674,10 @@ function initOrUpdateMap() {
|
|||||||
const isOnline = !state.toUpperCase().includes("OFF") && state !== "";
|
const isOnline = !state.toUpperCase().includes("OFF") && state !== "";
|
||||||
const health = latestStatesData.health && latestStatesData.health[cid];
|
const health = latestStatesData.health && latestStatesData.health[cid];
|
||||||
const card = document.getElementById(`card-${c.id}`);
|
const card = document.getElementById(`card-${c.id}`);
|
||||||
const isTx = card && card.dataset.lastTx && (Date.now() - parseInt(card.dataset.lastTx) < 3000);
|
|
||||||
|
// Recupariamo lo stato calcolato in refreshStates()
|
||||||
|
const isTx = card && card.dataset.isTx === 'true';
|
||||||
|
const isHold = card && card.dataset.isHold === 'true';
|
||||||
const warns = (latestStatesData.warnings && latestStatesData.warnings[cid]) || [];
|
const warns = (latestStatesData.warnings && latestStatesData.warnings[cid]) || [];
|
||||||
|
|
||||||
if (info && info.lat && info.lon && parseFloat(info.lat) !== 0 && parseFloat(info.lon) !== 0) {
|
if (info && info.lat && info.lon && parseFloat(info.lat) !== 0 && parseFloat(info.lon) !== 0) {
|
||||||
@@ -395,7 +686,7 @@ function initOrUpdateMap() {
|
|||||||
bounds.push([lat, lon]);
|
bounds.push([lat, lon]);
|
||||||
|
|
||||||
let pinClass = isOnline ? (warns.length > 0 ? 'pin-warn' : 'pin-online') : 'pin-offline';
|
let pinClass = isOnline ? (warns.length > 0 ? 'pin-warn' : 'pin-online') : 'pin-offline';
|
||||||
if (isTx) pinClass += ' pin-tx';
|
if (isTx || isHold) pinClass += ' pin-tx';
|
||||||
|
|
||||||
let iconSymbol = "+";
|
let iconSymbol = "+";
|
||||||
if (warns.length > 0 && !isTx) iconSymbol = "!";
|
if (warns.length > 0 && !isTx) iconSymbol = "!";
|
||||||
@@ -473,7 +764,6 @@ async function refreshStates() {
|
|||||||
let txModeStr = "TX";
|
let txModeStr = "TX";
|
||||||
let isIdle = telemetryObj.idle === true;
|
let isIdle = telemetryObj.idle === true;
|
||||||
|
|
||||||
// 1. Usa la logica ORIGINALE, testando solo il contenuto di ts1, ts2 e alt per capire se stiamo trasmettendo.
|
|
||||||
if (telemetryObj.alt && telemetryObj.alt !== "") {
|
if (telemetryObj.alt && telemetryObj.alt !== "") {
|
||||||
let altText = telemetryObj.alt.toUpperCase();
|
let altText = telemetryObj.alt.toUpperCase();
|
||||||
if (altText.includes("NXDN")) { activeModeColor = "var(--success)"; txModeStr = "TX NXDN"; }
|
if (altText.includes("NXDN")) { activeModeColor = "var(--success)"; txModeStr = "TX NXDN"; }
|
||||||
@@ -499,7 +789,6 @@ async function refreshStates() {
|
|||||||
cardDiv.dataset.status = isOnline ? 'online' : 'offline';
|
cardDiv.dataset.status = isOnline ? 'online' : 'offline';
|
||||||
renderSeen(c, data, isOnline);
|
renderSeen(c, data, isOnline);
|
||||||
|
|
||||||
// Gestione Avvisi
|
|
||||||
const warns = (data.warnings && data.warnings[c.id.toLowerCase()]) || [];
|
const warns = (data.warnings && data.warnings[c.id.toLowerCase()]) || [];
|
||||||
cardDiv.dataset.hasWarn = (warns.length > 0) ? 'true' : 'false';
|
cardDiv.dataset.hasWarn = (warns.length > 0) ? 'true' : 'false';
|
||||||
const diagDiv = document.getElementById(`diag-warn-${c.id}`);
|
const diagDiv = document.getElementById(`diag-warn-${c.id}`);
|
||||||
@@ -513,7 +802,6 @@ async function refreshStates() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intestazione Card
|
|
||||||
const nameSpan = cardDiv.querySelector('.client-name');
|
const nameSpan = cardDiv.querySelector('.client-name');
|
||||||
const idBadge = cardDiv.querySelector('.badge-id');
|
const idBadge = cardDiv.querySelector('.badge-id');
|
||||||
const typeBadge = document.getElementById(`type-badge-${c.id}`);
|
const typeBadge = document.getElementById(`type-badge-${c.id}`);
|
||||||
@@ -532,7 +820,6 @@ async function refreshStates() {
|
|||||||
if (typeBadge) typeBadge.style.display = 'none';
|
if (typeBadge) typeBadge.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timeslots
|
|
||||||
const tsContainer = document.getElementById(`ts-container-${c.id}`); const ts1Div = document.getElementById(`dmr-ts1-${c.id}`); const ts2Div = document.getElementById(`dmr-ts2-${c.id}`); const altDiv = document.getElementById(`dmr-alt-${c.id}`);
|
const tsContainer = document.getElementById(`ts-container-${c.id}`); const ts1Div = document.getElementById(`dmr-ts1-${c.id}`); const ts2Div = document.getElementById(`dmr-ts2-${c.id}`); const altDiv = document.getElementById(`dmr-alt-${c.id}`);
|
||||||
|
|
||||||
if (telemetryObj.alt && telemetryObj.alt !== "") {
|
if (telemetryObj.alt && telemetryObj.alt !== "") {
|
||||||
@@ -599,9 +886,26 @@ async function refreshStates() {
|
|||||||
else if (action === 'unlinked') { badgeColor = 'var(--text-muted)'; badgeBorder = 'var(--border-light)'; suffix = ' [UNL]'; }
|
else if (action === 'unlinked') { badgeColor = 'var(--text-muted)'; badgeBorder = 'var(--border-light)'; suffix = ' [UNL]'; }
|
||||||
else { badgeColor = gw.color; badgeBorder = gw.color; }
|
else { badgeColor = gw.color; badgeBorder = gw.color; }
|
||||||
|
|
||||||
|
const chipBase = "display:inline-flex; align-items:center; gap:5px; font-size:0.75rem; font-family:'JetBrains Mono',monospace; padding:2px 6px; margin:2px 4px 2px 0; border-radius:3px; background:rgba(0,0,0,0.5); border:1px solid ";
|
||||||
|
|
||||||
if (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) {
|
if (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) {
|
||||||
gwData['DMR_NETS'].forEach(netName => { let netSuffix = (action === 'linking') ? ' [LNK]' : (action === 'failed' ? ' [ERR]' : (dest && action !== 'status' ? `:${dest}` : '')); gwHtml += `<span style="font-size:0.65rem; font-family:'JetBrains Mono', monospace; font-weight:400; padding:2px 4px; border:1px dashed ${badgeBorder}; background:transparent; color:${badgeColor} !important; margin-right: 4px; display: inline-block;">DMR:${esc(netName)}${esc(netSuffix)}</span>`; });
|
gwData['DMR_NETS'].forEach(netName => {
|
||||||
} else { gwHtml += `<span style="font-size:0.65rem; font-family:'JetBrains Mono', monospace; font-weight:400; padding:2px 4px; border:1px dashed ${badgeBorder}; background:transparent; color:${badgeColor} !important; margin-right: 4px; display: inline-block;">${gw.label}${esc(suffix)}</span>`; }
|
let tagStatus = (action === 'linking') ? '<span style="color:#f59e0b;font-weight:700;">LNK</span>' : (action === 'failed' ? '<span style="color:var(--danger);font-weight:700;">ERR</span>' : (dest && action !== 'status' ? `<span style="color:#ffffff;font-weight:600;">${esc(dest)}</span>` : ''));
|
||||||
|
gwHtml += `<span style="${chipBase}${badgeBorder};"><b style="color:${gw.color};">DMR</b><span style="color:#e2e8f0;">${esc(netName)}</span>${tagStatus ? '<span style="color:var(--text-muted);opacity:0.6;">·</span>' + tagStatus : ''}</span>`;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let destText = dest ? `<span style="color:#ffffff; font-weight:600;">${esc(dest)}</span>` : '';
|
||||||
|
let statusPill = '';
|
||||||
|
if (action === 'linking') statusPill = '<span style="color:#f59e0b; font-weight:700;">LNK</span>';
|
||||||
|
else if (action === 'failed') statusPill = '<span style="color:var(--danger); font-weight:700;">ERR</span>';
|
||||||
|
else if (action === 'unlinked') statusPill = '<span style="color:var(--text-muted);">UNL</span>';
|
||||||
|
|
||||||
|
let content = `<b style="color:${gw.color};">${gw.label}</b>`;
|
||||||
|
if (destText) content += `<span style="color:var(--text-muted);opacity:0.6;">·</span>${destText}`;
|
||||||
|
if (statusPill) content += `<span style="color:var(--text-muted);opacity:0.6;">·</span>${statusPill}`;
|
||||||
|
|
||||||
|
gwHtml += `<span style="${chipBase}${badgeBorder};">${content}</span>`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -632,8 +936,16 @@ async function refreshStates() {
|
|||||||
if (healthContainer) healthContainer.style.display = 'none';
|
if (healthContainer) healthContainer.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Logica tollerante per i Gateway in standby (spenti dalla UI)
|
||||||
let hasOfflineService = false;
|
let hasOfflineService = false;
|
||||||
if (healthObj && healthObj.processes) { for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) { if (svcStatus.toLowerCase() !== 'online') { hasOfflineService = true; break; } } }
|
if (healthObj && healthObj.processes) {
|
||||||
|
for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) {
|
||||||
|
let s = svcStatus.toLowerCase();
|
||||||
|
if (s !== 'online' && s !== 'standby') {
|
||||||
|
hasOfflineService = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const warnBadge = document.getElementById(`svc-warn-${c.id}`); const btnSvc = document.getElementById(`btn-svc-${c.id}`);
|
const warnBadge = document.getElementById(`svc-warn-${c.id}`); const btnSvc = document.getElementById(`btn-svc-${c.id}`);
|
||||||
if (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none';
|
if (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none';
|
||||||
if (btnSvc) { if (hasOfflineService) { btnSvc.style.borderColor = 'var(--danger)'; btnSvc.style.color = 'var(--danger)'; } else { btnSvc.style.borderColor = 'var(--text-main)'; btnSvc.style.color = 'var(--text-main)'; } }
|
if (btnSvc) { if (hasOfflineService) { btnSvc.style.borderColor = 'var(--danger)'; btnSvc.style.color = 'var(--danger)'; } else { btnSvc.style.borderColor = 'var(--text-main)'; btnSvc.style.color = 'var(--text-main)'; } }
|
||||||
@@ -651,17 +963,22 @@ async function refreshStates() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. TIMEOUT LOCALE PER L'EFFETTO CODA VISIVO (Sostituisce il check di isIdle)
|
// --- NESSUN TIMER LOCALE: COMANDA MQTT ---
|
||||||
let timeSinceTx = 0;
|
// Memorizza l'ultimo modo dedotto per usarlo durante l'Hangtime o i Beacon
|
||||||
if (isTx && isOnline) {
|
if (!isIdle && isOnline) {
|
||||||
cardDiv.dataset.lastTx = Date.now();
|
cardDiv.dataset.lastMode = txModeStr.replace("TX ", "").trim();
|
||||||
} else {
|
cardDiv.dataset.lastColor = activeModeColor;
|
||||||
timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Se non è in TX e MMDVM NON ha ancora dichiarato 'idle' -> siamo in Hold
|
||||||
|
let isHold = (!isTx && !isIdle && isOnline);
|
||||||
|
|
||||||
// L'interfaccia mantiene lo stato solo se non sta trasmettendo E se sono passati meno di 6 secondi (Hold).
|
// Salviamo lo stato sul DOM per la mappa
|
||||||
// In questo modo i micro-pacchetti D-STAR che non inviano l'end di chiamata svaniranno dopo 6s per forza.
|
cardDiv.dataset.isTx = isTx ? 'true' : 'false';
|
||||||
let isHold = (!isTx && timeSinceTx < 6000);
|
cardDiv.dataset.isHold = isHold ? 'true' : 'false';
|
||||||
|
|
||||||
|
let holdMode = cardDiv.dataset.lastMode || "DMR";
|
||||||
|
let holdColor = cardDiv.dataset.lastColor || "var(--primary)";
|
||||||
|
|
||||||
let displayState = stateValue;
|
let displayState = stateValue;
|
||||||
let statusColor = "";
|
let statusColor = "";
|
||||||
@@ -677,19 +994,32 @@ async function refreshStates() {
|
|||||||
statusBorder = activeModeColor;
|
statusBorder = activeModeColor;
|
||||||
cBorder = activeModeColor;
|
cBorder = activeModeColor;
|
||||||
} else if (isHold) {
|
} else if (isHold) {
|
||||||
displayState = `[ ${txModeStr.replace("TX ", "")} ]`;
|
displayState = `[ ${holdMode} ]`;
|
||||||
statusColor = activeModeColor;
|
statusColor = holdColor;
|
||||||
statusBorder = activeModeColor;
|
statusBorder = holdColor;
|
||||||
} else {
|
cBorder = holdColor;
|
||||||
// Quando scade l'Hold, FORZIAMO la scomparsa di ogni traccia di D-STAR / YSF
|
}
|
||||||
isIdle = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Applica i calcoli alla Card Principale
|
|
||||||
if (isOnline) {
|
if (isOnline) {
|
||||||
cardDiv.classList.add('online'); statusDiv.classList.remove('status-offline');
|
cardDiv.classList.add('online'); statusDiv.classList.remove('status-offline');
|
||||||
|
cardDiv.style.opacity = "1"; cardDiv.style.filter = "none";
|
||||||
|
|
||||||
|
cardDiv.style.setProperty('border-top-color', (isTx || isHold) ? statusColor : "var(--border-color)", 'important');
|
||||||
|
if(isTx) {
|
||||||
|
let shadowRGB = '59, 130, 246';
|
||||||
|
if (activeModeColor === '#10b981') shadowRGB = '16, 185, 129';
|
||||||
|
else if (activeModeColor === '#8b5cf6') shadowRGB = '139, 92, 246';
|
||||||
|
else if (activeModeColor === '#06b6d4') shadowRGB = '6, 182, 212';
|
||||||
|
else if (activeModeColor === '#f59e0b') shadowRGB = '245, 158, 11';
|
||||||
|
cardDiv.style.boxShadow = `0 0 20px rgba(${shadowRGB}, 0.5) !important`;
|
||||||
|
} else {
|
||||||
|
cardDiv.style.boxShadow = '0 4px 12px rgba(0,0,0,0.2) !important';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cardDiv.classList.remove('online'); statusDiv.classList.add('status-offline');
|
cardDiv.classList.remove('online'); statusDiv.classList.add('status-offline');
|
||||||
|
cardDiv.style.opacity = "0.7"; cardDiv.style.filter = "grayscale(80%)";
|
||||||
|
cardDiv.style.setProperty('border-top-color', '#64748b', 'important');
|
||||||
|
cardDiv.style.boxShadow = 'none !important';
|
||||||
}
|
}
|
||||||
|
|
||||||
cardDiv.style.borderColor = cBorder;
|
cardDiv.style.borderColor = cBorder;
|
||||||
@@ -699,24 +1029,51 @@ async function refreshStates() {
|
|||||||
statusDiv.style.borderColor = statusBorder;
|
statusDiv.style.borderColor = statusBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applica i calcoli alla Mini Card in HOME
|
|
||||||
const miniCard = document.getElementById(`mini-card-${c.id}`);
|
const miniCard = document.getElementById(`mini-card-${c.id}`);
|
||||||
const miniStatus = document.getElementById(`mini-status-${c.id}`);
|
const miniStatus = document.getElementById(`mini-status-${c.id}`);
|
||||||
|
const miniName = document.getElementById(`mini-name-${c.id}`);
|
||||||
|
const miniId = document.getElementById(`mini-id-${c.id}`);
|
||||||
|
const miniCaller = document.getElementById(`mini-caller-${c.id}`);
|
||||||
|
|
||||||
if (miniCard && miniStatus) {
|
if (miniCard && miniStatus) {
|
||||||
if (genObj && isOnline) {
|
if (genObj && isOnline) {
|
||||||
const miniName = document.getElementById(`mini-name-${c.id}`);
|
if(miniName) miniName.innerText = genObj.callsign;
|
||||||
const miniId = document.getElementById(`mini-id-${c.id}`);
|
if(miniId) miniId.innerText = `ID:${genObj.radio_id}`;
|
||||||
if (miniName) miniName.innerText = genObj.callsign;
|
|
||||||
if (miniId) miniId.innerText = `ID:${genObj.radio_id}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOnline) {
|
if (isOnline) {
|
||||||
|
miniCard.style.opacity = "1";
|
||||||
|
miniCard.style.filter = "none";
|
||||||
|
|
||||||
|
if (miniCaller) {
|
||||||
|
let activeCaller = "";
|
||||||
|
if (isTx) {
|
||||||
|
let rawStr = (telemetryObj.alt && telemetryObj.alt !== "") ? telemetryObj.alt : ((String(telemetryObj.ts1 ?? '').includes("🎙️") || String(telemetryObj.ts1 ?? '').includes("TX")) ? String(telemetryObj.ts1) : String(telemetryObj.ts2 ?? ''));
|
||||||
|
// Rimuove emoji, prefissi come "D-Star:", "YSF:" e pulisce
|
||||||
|
let cleaned = rawStr.replace(/[^\x00-\x7F]/g, '')
|
||||||
|
.replace(/(TX)?\s*(D-STAR|YSF|NXDN|P25|DMR|FM|M17)\s*:/ig, '')
|
||||||
|
.replace(/TX/ig, '')
|
||||||
|
.trim();
|
||||||
|
if (cleaned) activeCaller = cleaned.split(' ')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTx && activeCaller) {
|
||||||
|
miniCaller.innerText = activeCaller;
|
||||||
|
miniCaller.style.display = "block";
|
||||||
|
miniCaller.style.color = activeModeColor;
|
||||||
|
} else {
|
||||||
|
miniCaller.style.display = "none";
|
||||||
|
miniCaller.innerText = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (warns.length > 0 && !isTx && !isHold) {
|
if (warns.length > 0 && !isTx && !isHold) {
|
||||||
miniCard.style.borderColor = "var(--accent)";
|
miniCard.style.borderColor = "var(--accent)";
|
||||||
miniStatus.innerText = "(!) ALERT";
|
miniStatus.innerText = "(!) ALERT";
|
||||||
miniStatus.title = warns.join(" | ");
|
miniStatus.title = warns.join(" | ");
|
||||||
miniStatus.style.color = "var(--accent)";
|
miniStatus.style.color = "var(--accent)";
|
||||||
miniStatus.style.borderColor = "var(--accent)";
|
miniStatus.style.borderColor = "var(--accent)";
|
||||||
|
miniCard.style.boxShadow = 'none';
|
||||||
} else {
|
} else {
|
||||||
let mcBorder = "var(--border-main)";
|
let mcBorder = "var(--border-main)";
|
||||||
let mStatus = stateValue;
|
let mStatus = stateValue;
|
||||||
@@ -728,10 +1085,15 @@ async function refreshStates() {
|
|||||||
mStatus = `( ${txModeStr} )`;
|
mStatus = `( ${txModeStr} )`;
|
||||||
mColor = activeModeColor;
|
mColor = activeModeColor;
|
||||||
mBorderColor = activeModeColor;
|
mBorderColor = activeModeColor;
|
||||||
|
miniCard.style.boxShadow = `0 0 12px ${activeModeColor}60`; // GLOW in TX
|
||||||
} else if (isHold) {
|
} else if (isHold) {
|
||||||
mStatus = `[ ${txModeStr.replace("TX ", "")} ]`;
|
mcBorder = "var(--border-main)"; // Bordo grigio per non confonderlo con TX
|
||||||
mColor = activeModeColor;
|
mStatus = `[ ${holdMode} ]`;
|
||||||
mBorderColor = activeModeColor;
|
mColor = holdColor; // Solo testo colorato
|
||||||
|
mBorderColor = "var(--border-light)";
|
||||||
|
miniCard.style.boxShadow = 'none'; // Nessun glow in hold
|
||||||
|
} else {
|
||||||
|
miniCard.style.boxShadow = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
miniCard.style.borderColor = mcBorder;
|
miniCard.style.borderColor = mcBorder;
|
||||||
@@ -741,15 +1103,17 @@ async function refreshStates() {
|
|||||||
miniStatus.style.borderColor = mBorderColor;
|
miniStatus.style.borderColor = mBorderColor;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
miniCard.style.opacity = "0.7";
|
||||||
|
miniCard.style.filter = "grayscale(80%)";
|
||||||
miniCard.style.borderColor = "var(--border-light)";
|
miniCard.style.borderColor = "var(--border-light)";
|
||||||
miniStatus.innerText = "OFFLINE";
|
miniStatus.innerText = "OFFLINE";
|
||||||
miniStatus.title = "OFFLINE";
|
miniStatus.title = "OFFLINE";
|
||||||
miniStatus.style.color = "var(--danger)";
|
miniStatus.style.color = "var(--danger)";
|
||||||
miniStatus.style.borderColor = "var(--border-light)";
|
miniStatus.style.borderColor = "var(--border-light)";
|
||||||
|
miniCard.style.boxShadow = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applica i calcoli al Nodo Singolo (Focus Mode)
|
|
||||||
if (currentFocusedNode === c.id) {
|
if (currentFocusedNode === c.id) {
|
||||||
let focusStatus = document.getElementById('focus-status');
|
let focusStatus = document.getElementById('focus-status');
|
||||||
|
|
||||||
@@ -761,15 +1125,15 @@ async function refreshStates() {
|
|||||||
fsState = `( ${txModeStr} )`;
|
fsState = `( ${txModeStr} )`;
|
||||||
fsColor = activeModeColor;
|
fsColor = activeModeColor;
|
||||||
} else if (isHold) {
|
} else if (isHold) {
|
||||||
fsState = `[ ${txModeStr.replace("TX ", "")} ]`;
|
fsState = `[ ${holdMode} ]`;
|
||||||
fsColor = activeModeColor;
|
fsColor = holdColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
focusStatus.innerText = fsState;
|
focusStatus.innerText = fsState;
|
||||||
focusStatus.style.color = fsColor;
|
focusStatus.style.color = fsColor;
|
||||||
|
|
||||||
let focusLedColor = isOnline ? (isTx ? activeModeColor : 'var(--success)') : 'var(--border-light)';
|
let focusLedColor = isOnline ? (isTx ? activeModeColor : (isHold ? holdColor : 'var(--success)')) : 'var(--border-light)';
|
||||||
let focusLedBg = (isOnline && isTx) ? activeModeColor : 'transparent';
|
let focusLedBg = (isOnline && isTx) ? activeModeColor : 'transparent';
|
||||||
document.getElementById('focus-name').innerHTML = `<span style="display:inline-block; border-radius:50%; width:20px; height:20px; border:2px solid ${focusLedColor}; background:${focusLedBg}"></span> ${esc(genObj ? genObj.callsign : c.name)}`;
|
document.getElementById('focus-name').innerHTML = `<span style="display:inline-block; border-radius:50%; width:20px; height:20px; border:2px solid ${focusLedColor}; background:${focusLedBg}"></span> ${esc(genObj ? genObj.callsign : c.name)}`;
|
||||||
|
|
||||||
@@ -801,6 +1165,11 @@ async function refreshStates() {
|
|||||||
}
|
}
|
||||||
document.getElementById('focus-ts').innerHTML = focusTsHtml || "--";
|
document.getElementById('focus-ts').innerHTML = focusTsHtml || "--";
|
||||||
|
|
||||||
|
const modesCard = document.getElementById('focus-modes-card');
|
||||||
|
if (modesCard) {
|
||||||
|
modesCard.style.display = canControl ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
const focusControls = document.getElementById('focus-controls');
|
const focusControls = document.getElementById('focus-controls');
|
||||||
if (canControl || showReboot) {
|
if (canControl || showReboot) {
|
||||||
focusControls.style.display = 'block';
|
focusControls.style.display = 'block';
|
||||||
|
|||||||
+48
-18
@@ -20,30 +20,50 @@
|
|||||||
|
|
||||||
<!-- Foglio di Stile Esterno Modularizzato (Cache Buster) -->
|
<!-- Foglio di Stile Esterno Modularizzato (Cache Buster) -->
|
||||||
<link rel="stylesheet" href="/static/css/style.css?v=blueprint-header-fix">
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="top-bar-container">
|
<div id="top-bar-container" style="border-bottom: 2px solid var(--border-main); background: var(--bg-main, #04102e);">
|
||||||
<div id="top-bar">
|
<div id="top-bar" style="display: flex; justify-content: space-between; align-items: stretch; padding: 0; min-height: 90px; flex-wrap: wrap;">
|
||||||
<div class="title-brand">SCHEMATIC // FLEET C2</div>
|
|
||||||
|
|
||||||
<div class="nav-tabs">
|
<!-- HEADER SX: BANNER CON RIEMPIMENTO ASSOLUTO A FILO -->
|
||||||
<button class="nav-tab active" onclick="switchView('home')" id="tab-home">HOME</button>
|
<div id="master-banner-container" style="display: none; flex: 0 0 45%; max-width: 45%; border-right: 2px solid var(--border-main); background: #020b1e; align-items: stretch; justify-content: stretch; padding: 0; box-sizing: border-box; overflow: hidden;">
|
||||||
<button class="nav-tab" onclick="switchView('nodes')" id="tab-nodes">NODES</button>
|
<img src="/static/banners/banner.png" style="width: 100%; height: 100%; object-fit: cover; object-position: center; display: block;"
|
||||||
<button class="nav-tab" onclick="switchView('map')" id="tab-map">MAP</button>
|
onload="this.parentElement.style.display='flex';"
|
||||||
<button class="nav-tab" onclick="switchView('aprs')" id="tab-aprs">APRS</button>
|
onerror="this.parentElement.style.display='none';">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="top-bar-right">
|
<!-- HEADER DX: STRUTTURA FLUIDA A 3 RIGHE -->
|
||||||
<span id="mqtt-badge" class="mqtt-badge mqtt-offline">MQTT: CHK</span>
|
<div id="header-right-controls" style="flex: 1; display: flex; flex-direction: column; gap: 10px; justify-content: center; padding: 12px 20px; box-sizing: border-box; background: rgba(0, 15, 45, 0.25); min-width: 350px;">
|
||||||
<button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang">ITA</button>
|
|
||||||
<button class="theme-switch" id="push-btn" onclick="subscribeToPush()">PUSH</button>
|
<!-- RIGA 1: BRAND E OROLOGIO -->
|
||||||
<div id="auth-container" style="display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end;"></div>
|
<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>
|
</div>
|
||||||
</div>
|
</div><!-- VISTA FLEET MAP -->
|
||||||
|
|
||||||
<!-- VISTA FLEET MAP -->
|
|
||||||
<div id="view-map" style="display: none; padding: 0 20px;">
|
<div id="view-map" style="display: none; padding: 0 20px;">
|
||||||
<div id="map-container"></div>
|
<div id="map-container"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -85,6 +105,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- BANNER PERSONALIZZATO -->
|
||||||
<div class="grid" style="grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));">
|
<div class="grid" style="grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));">
|
||||||
<!-- COLONNA SX: HARDWARE E RF -->
|
<!-- COLONNA SX: HARDWARE E RF -->
|
||||||
<div style="display: flex; flex-direction: column; gap: 20px;">
|
<div style="display: flex; flex-direction: column; gap: 20px;">
|
||||||
@@ -107,6 +128,13 @@
|
|||||||
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>LOCATION:</span> <span id="focus-loc" style="color: var(--text-main);">--</span></div>
|
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-light); padding-bottom: 8px;"><span>LOCATION:</span> <span id="focus-loc" style="color: var(--text-main);">--</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card" id="focus-modes-card" style="border-width: 1px !important; display: none;">
|
||||||
|
<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>
|
</div>
|
||||||
|
|
||||||
<!-- COLONNA DX: SOFTWARE E LOG -->
|
<!-- COLONNA DX: SOFTWARE E LOG -->
|
||||||
@@ -186,6 +214,8 @@
|
|||||||
<!-- VISTA HOME -->
|
<!-- VISTA HOME -->
|
||||||
<div id="view-home">
|
<div id="view-home">
|
||||||
<div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;">
|
<div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;">
|
||||||
|
|
||||||
|
|
||||||
<h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
|
<h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
|
||||||
[ FLEET_STATUS ]
|
[ FLEET_STATUS ]
|
||||||
</h3>
|
</h3>
|
||||||
@@ -261,7 +291,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<div style="text-align: center; padding: 25px; color: var(--border-light); font-size: 0.85rem; font-weight: 300; display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap;">
|
<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>SYS_OP: IV3JDV @ ARIFVG</span>
|
||||||
<span>|</span>
|
<span>|</span>
|
||||||
<a href="https://git.arifvg.it/iv3jdv/fleet-control-server" target="_blank" style="color: inherit; text-decoration: none;">GITEA_REPO</a>
|
<a href="https://git.arifvg.it/iv3jdv/fleet-control-server" target="_blank" style="color: inherit; text-decoration: none;">GITEA_REPO</a>
|
||||||
@@ -433,7 +463,7 @@
|
|||||||
|
|
||||||
<!-- MOTORE MODULARIZZATO JS (Cache Buster aggiunto per forzare il refresh) -->
|
<!-- MOTORE MODULARIZZATO JS (Cache Buster aggiunto per forzare il refresh) -->
|
||||||
<script src="/static/js/modals.js?v=blueprint4"></script>
|
<script src="/static/js/modals.js?v=blueprint4"></script>
|
||||||
<script src="/static/js/app.js?v=blueprint-header-fix2"></script>
|
<script src="/static/js/app.js?v=1793656210"></script>
|
||||||
|
|
||||||
<!-- SERVICE WORKER -->
|
<!-- SERVICE WORKER -->
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user