From 7959d911e636def2c34b824e85ce33b1f281b87d Mon Sep 17 00:00:00 2001 From: AskaEth Date: Sat, 25 Jul 2026 16:29:00 +0800 Subject: [PATCH] feat: WS sends selected_game_id on connect, gear indicator auto-adapts to game mapping (Forza/AC/iRacing) --- app.py | 7 ++- dashboards/gear_indicator/index.html | 77 ++++++++++++++++++++++------ static/js/pages/dashboard.js | 3 +- 3 files changed, 68 insertions(+), 19 deletions(-) diff --git a/app.py b/app.py index fdf7634..2b11bcb 100644 --- a/app.py +++ b/app.py @@ -84,7 +84,12 @@ async def scene_render(request: Request, scene_id: str): async def websocket_endpoint(ws: WebSocket): cid = await ws_manager.connect(ws) try: - await ws.send_json({"type": "connected", "client_id": cid}) + cfg = get_config() + await ws.send_json({ + "type": "connected", + "client_id": cid, + "selected_game_id": cfg.get("selected_game_id"), + }) while True: msg = await ws.receive_json() if msg.get("type") == "ping": diff --git a/dashboards/gear_indicator/index.html b/dashboards/gear_indicator/index.html index a4b2ff5..41e94e4 100644 --- a/dashboards/gear_indicator/index.html +++ b/dashboards/gear_indicator/index.html @@ -46,6 +46,60 @@ html,body{width:100%;height:100%;overflow:hidden;background:#000;