feat(routes): 迁移任务状态端点(topen/queue/batch_progress/task/*)

- web/routers/tasks.py:topen、queue、batch_progress、task/cancel、
  task/heartbeat、task/list 迁至 /api/v1/*
- 读写 core.state 共享任务表/统计(与 Flask 同一批对象)——两栈迁移期看到同一份
  任务状态,这是单进程双框架成立的关键
- task/cancel 保持 POST-only(与 Flask 同口径,杜绝顶层导航 GET 触发取消)

契约奇偶校验:24 项全 OK(新增 queue/topen/task:list/heartbeat/progress404);
验证:pytest 46/46;ruff All checks passed;pyright 0 errors;冒烟 10/10。
This commit is contained in:
snowy-yang committed 2026-09-26 01:18:51 +08:00
1 parent f45a9ccd3a
commit f588d313f0
2 files changed
+249

No files matched your search

+2
View File
@@ -26,6 +26,7 @@ from web.routers import music as music_router
from web.routers import podcast as podcast_router
from web.routers import site as site_router
from web.routers import system as system_router
from web.routers import tasks as tasks_router
@asynccontextmanager
@@ -73,6 +74,7 @@ def create_app(serve_flask_fallback: bool = False) -> FastAPI:
app.include_router(music_router.router, prefix='/api/v1', tags=['music'])
app.include_router(account_router.router, prefix='/api/v1', tags=['account'])
app.include_router(podcast_router.router, prefix='/api/v1', tags=['podcast'])
app.include_router(tasks_router.router, prefix='/api/v1', tags=['tasks'])
install_error_handlers(app)