]> acesimba.cloud Git - StationAIDemo.git/commitdiff
feat: 新增任务门禁内部校验接口,接入 StationBuilder 任务
authorCodeBuddy <codebuddy@acesimba.cloud>
Wed, 26 Aug 2026 01:08:12 +0000 (09:08 +0800)
committerCodeBuddy <codebuddy@acesimba.cloud>
Wed, 26 Aug 2026 01:08:12 +0000 (09:08 +0800)
backend/main.py
backend/tasks.json

index 8b59e4437f22d7daadbec891eb26a726f90fe89b..5150a3a39a3f7da0fb8cfc223fb47f302c6d1fa0 100644 (file)
@@ -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 {
index 59d10e1f6aea6966067426476b30534af97a7f0a..b7d660a3ad8488fcab1288ecdd17e59757a92f67 100644 (file)
@@ -3,5 +3,10 @@
     "id": "aidemo",
     "name": "AIDemo",
     "open": true
+  },
+  {
+    "id": "stationbuilder",
+    "name": "StationBuilder",
+    "open": true
   }
 ]
\ No newline at end of file