diff --git a/app.py b/app.py index ad488ac..fdf7634 100644 --- a/app.py +++ b/app.py @@ -57,13 +57,17 @@ async def index(request: Request): @app.get("/dashboard/{theme_id}", response_class=HTMLResponse) async def dashboard_render(request: Request, theme_id: str): from models.dashboard import dashboard_manager + index_html = dashboard_manager.get_index_html(theme_id) + if index_html: + return HTMLResponse(content=index_html) theme = dashboard_manager.get(theme_id) - template_html = dashboard_manager.get_template(theme_id) - return templates.TemplateResponse("dashboard.html", { - "request": request, - "theme": theme, - "template_html": template_html, - }) + if not theme: + raise HTTPException(status_code=404, detail="Dashboard not found") + return HTMLResponse(content=f""" +
+ 仪表盘 "{theme['name']}" 缺少 index.html + + """) @app.get("/scene/{scene_id}", response_class=HTMLResponse) diff --git a/dashboards/gear_indicator/index.html b/dashboards/gear_indicator/index.html new file mode 100644 index 0000000..64d13df --- /dev/null +++ b/dashboards/gear_indicator/index.html @@ -0,0 +1,77 @@ + + + + + +manifest.json 和 parser.py 的文件夹manifest.json 定义游戏元信息,parser.py 实现 get_parser() 函数get_parser() 返回对象需实现 game_id() 和 parse(data, addr) 方法games/user/ 目录安装manifest.json + parser.py 的文件夹manifest.json 定义元信息,parser.py 需有 get_parser() 函数game_id() 和 parse(data, addr) 方法.tsp 即可导入TelemetryData 字段参考见 server/telemetry/data.py