return HTMLResponse(content=html)
+@app.get("/api/internal/task-gate/{task_id}")
+async def task_gate_internal(task_id: str):
+ """供 nginx auth_request 调用:任务开放返回 200,关闭/不存在返回 403。"""
+ task = get_task(task_id)
+ if task is None or not task.get("open"):
+ return JSONResponse(status_code=403, content={"ok": False, "message": "任务不存在或已关闭"})
+ return {"ok": True}
+
+
@app.get("/api/health")
async def health():
return {
"id": "aidemo",
"name": "AIDemo",
"open": true
+ },
+ {
+ "id": "stationbuilder",
+ "name": "StationBuilder",
+ "open": true
}
]
\ No newline at end of file