From e86f7d0222950e70d6ee9262eb10c6cd5291888a Mon Sep 17 00:00:00 2001 From: CodeBuddy Date: Wed, 26 Aug 2026 09:08:12 +0800 Subject: [PATCH] =?utf8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BB=BB=E5=8A=A1?= =?utf8?q?=E9=97=A8=E7=A6=81=E5=86=85=E9=83=A8=E6=A0=A1=E9=AA=8C=E6=8E=A5?= =?utf8?q?=E5=8F=A3=EF=BC=8C=E6=8E=A5=E5=85=A5=20StationBuilder=20?= =?utf8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- backend/main.py | 9 +++++++++ backend/tasks.json | 5 +++++ 2 files changed, 14 insertions(+) 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 -- 2.43.0