From: CodeBuddy Date: Wed, 26 Aug 2026 01:08:12 +0000 (+0800) Subject: feat: 新增任务门禁内部校验接口,接入 StationBuilder 任务 X-Git-Url: http://acesimba.cloud/gitweb/?a=commitdiff_plain;h=e86f7d0222950e70d6ee9262eb10c6cd5291888a;p=StationAIDemo.git feat: 新增任务门禁内部校验接口,接入 StationBuilder 任务 --- diff --git a/backend/main.py b/backend/main.py index 8b59e44..5150a3a 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1074,6 +1074,15 @@ async def task_gate(task_id: str): 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 { diff --git a/backend/tasks.json b/backend/tasks.json index 59d10e1..b7d660a 100644 --- a/backend/tasks.json +++ b/backend/tasks.json @@ -3,5 +3,10 @@ "id": "aidemo", "name": "AIDemo", "open": true + }, + { + "id": "stationbuilder", + "name": "StationBuilder", + "open": true } ] \ No newline at end of file