diff --git a/stt/client/stt/hud/index.html b/stt/client/stt/hud/index.html index 9fc3f64..448ecc6 100644 --- a/stt/client/stt/hud/index.html +++ b/stt/client/stt/hud/index.html @@ -752,6 +752,8 @@ .svc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .svc-actions .btn { width: auto; font-size: 14px; padding: 11px 10px; } .svc-actions .btn#svcStop { grid-column: 1 / -1; } /* Arrêter sur toute la largeur */ + .svc-version { font-size: 12.5px; color: var(--ink-soft); margin: 12px 0 0; text-align: center; } + .svc-version strong { color: var(--ink); font-weight: 600; } /* Toast — confirmation éphémère (clic / voix) */ .toast { @@ -990,6 +992,7 @@ +
Version installée : …
@@ -1168,6 +1171,7 @@ function handleEvent(ev) { case 'mic': setMicUI(!!ev.muted); break; // état micro renvoyé par le backend case 'services': renderServices(ev.services || []); break; // tuiles du portail case 'portal-status': applyPortalStatus(ev); break; // santé live des services + case 'meta': setVersion(ev.version || '?'); break; // version installée case 'toast': showToast(ev.text || ''); break; // confirmation (clic/voix) default: console.warn('Événement inconnu :', ev); } @@ -1466,6 +1470,11 @@ function showToast(text) { toastTimer = setTimeout(() => toastEl.classList.remove('show'), 2200); } +function setVersion(v) { + const strong = document.querySelector('#svcVersion strong'); + if (strong) strong.textContent = (v && v !== '?') ? ('v' + v) : 'inconnue'; +} + /* ============================================================================ RÉGLAGES — collecte, persistance (thème en localStorage), UI ============================================================================ */ diff --git a/stt/client/stt/ui/app.py b/stt/client/stt/ui/app.py index 91c59a9..0df0007 100644 --- a/stt/client/stt/ui/app.py +++ b/stt/client/stt/ui/app.py @@ -72,6 +72,16 @@ async def serve(cfg: dict[str, Any], make_engine, client) -> None: ], } + # Version installée (affichée près du bouton « Mettre à jour » du HUD) + from importlib.metadata import PackageNotFoundError + from importlib.metadata import version as _pkg_version + + try: + _stt_version = _pkg_version("stt") + except PackageNotFoundError: + _stt_version = "?" + meta_msg = {"type": "meta", "version": _stt_version} + def broadcast(event: dict) -> None: nonlocal last_state, last_mic, last_status if event.get("type") == "state": @@ -142,6 +152,7 @@ async def serve(cfg: dict[str, Any], make_engine, client) -> None: await ws.send(json.dumps(last_state, ensure_ascii=False)) await ws.send(json.dumps(last_mic, ensure_ascii=False)) # état micro courant await ws.send(json.dumps(services_msg, ensure_ascii=False)) # tuiles du portail + await ws.send(json.dumps(meta_msg, ensure_ascii=False)) # version installée if last_status is not None: # santé connue → l'envoyer tout de suite await ws.send(json.dumps(last_status, ensure_ascii=False)) # Le HUD envoie {"type":"settings","data":{...}} (réglage),