From 56cd9d5323fd96c9ea838348521a4a06cc85dc43 Mon Sep 17 00:00:00 2001 From: Roby Date: Mon, 27 Apr 2026 17:28:06 +0200 Subject: [PATCH] feat(ui): add dynamic hotspot/repeater badge based on duplex mode --- app.py | 5 ++-- templates/index.html | 59 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 7eaf932..951dcf7 100644 --- a/app.py +++ b/app.py @@ -334,16 +334,17 @@ def on_message(client, userdata, msg): except Exception as e: logger.error(f"Error parsing MMDVMHost info for {cid}: {e}") - # --- MMDVMHOST GENERAL MANAGEMENT (CALLSIGN & ID) --- + # --- MMDVMHOST GENERAL MANAGEMENT (CALLSIGN & ID & DUPLEX) --- elif len(parts) >= 4 and parts[0] == 'data' and parts[2].lower() == 'mmdvmhost' and parts[3].lower() == 'general': try: cid = parts[1].lower() data = json.loads(payload) callsign = data.get("Callsign", "") radio_id = data.get("Id", "") + duplex = data.get("Duplex", "1") # 1 = Repeater, 0 = Simplex if callsign: - node_general[cid] = {"callsign": callsign, "radio_id": radio_id} + node_general[cid] = {"callsign": callsign, "radio_id": radio_id, "duplex": str(duplex)} socketio.emit('dati_aggiornati') except Exception as e: logger.error(f"Error parsing MMDVMHost general for {cid}: {e}") diff --git a/templates/index.html b/templates/index.html index 2a00210..b1e295a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -56,6 +56,28 @@ .node-meta { font-size: 0.75rem; color: #8b949e; text-align: center; margin-bottom: 15px; line-height: 1.4; } .node-meta-item { display: block; } + /* --- Badge Tipo Nodo --- */ + .type-badge { + font-size: 0.65rem; + padding: 2px 6px; + border-radius: 4px; + font-weight: 700; + text-transform: uppercase; + display: inline-block; + margin-left: 8px; + vertical-align: middle; + } + .type-repeater { + background: rgba(47, 129, 247, 0.15); + color: var(--primary); + border: 1px solid var(--primary); + } + .type-hotspot { + background: rgba(163, 113, 247, 0.15); + color: var(--accent); + border: 1px solid var(--accent); + } + /* Display Stato */ .status-display { text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 700; padding: 8px; border-radius: 3px; background: #010409; border: 1px solid var(--border-color); margin-bottom: 15px; color: var(--text-muted); } .card.online .status-display { color: var(--success); border-color: rgba(46, 160, 67, 0.4); } @@ -595,7 +617,10 @@
${c.name} - ID: ${c.id.toUpperCase()} +
+ ID: ${c.id.toUpperCase()} + +