前端整理: 合并文件管理页 + 新增导航页
1. 合并 files-page 与 pdf-admin 为统一文件管理页 /api/files-page:
- 新增 GET /api/admin/files/with-pdf 接口,以 uploaded_files 为基础,
用 pdf_jobs.source_file_id / output_file_id 内存匹配,为关联文件标注
转换状态、用户软删标记与角色(源epub/产物PDF)
- PdfJobOut 补 source_file_id / output_file_id 字段
- file_browser 新增 PDF 任务列(状态徽标/软删标记/硬删任务按钮)
- 删除 /api/pdf-admin 路由及 static/pdf_admin.* 三个文件
2. 新增导航页 /api/index,卡片式收集所有页面入口;
各子页(upload/whiteboard/system_status/files-page)脚注加返回导航链接
3. 更新 docs/routes.md、docs/configuration.md 同步说明
测试: pytest tests/test_pdf_service.py 7 passed; 手动校验各页面路由与合并接口响应
This commit is contained in:
37
app/main.py
37
app/main.py
@@ -6,10 +6,11 @@
|
||||
GET /redoc -> ReDoc (Basic Auth)
|
||||
GET /openapi.json -> OpenAPI 文档(Basic Auth)
|
||||
GET /health -> 存活探针(公开)
|
||||
GET /upload -> 上传页面(公开 HTML)
|
||||
GET /files -> 文件浏览页(Basic Auth,同 docs)
|
||||
GET /wb/{id} -> 白板页面(公开,不存在则新建)
|
||||
GET /wb-admin -> 白板管理页(Basic Auth,同 docs)
|
||||
GET /api/index -> 导航页(公开,收集所有页面入口)
|
||||
GET /api/upload -> 上传页面(公开 HTML)
|
||||
GET /api/files-page -> 文件管理页(Basic Auth,同 docs;含 PDF 转换管理)
|
||||
GET /api/wb/{id} -> 白板页面(公开,不存在则新建)
|
||||
GET /api/wb-admin -> 白板管理页(Basic Auth,同 docs)
|
||||
GET /api/... -> 业务接口
|
||||
WS /ws/wb/{id} -> 白板实时同步(公开)
|
||||
/static/... -> 前端静态资源(JS/CSS)
|
||||
@@ -183,6 +184,16 @@ def create_app() -> FastAPI:
|
||||
def health() -> dict:
|
||||
return {"status": "ok"}
|
||||
|
||||
@app.get(
|
||||
"/api/index",
|
||||
response_class=HTMLResponse,
|
||||
tags=["pages"],
|
||||
summary="导航页(公开)",
|
||||
description="收集所有页面入口的卡片式导航页,各子页脚注可返回此处。",
|
||||
)
|
||||
def index_page() -> HTMLResponse:
|
||||
return _serve_static_html("index.html")
|
||||
|
||||
@app.get(
|
||||
"/api/upload",
|
||||
response_class=HTMLResponse,
|
||||
@@ -197,8 +208,12 @@ def create_app() -> FastAPI:
|
||||
"/api/files-page",
|
||||
response_class=HTMLResponse,
|
||||
tags=["pages"],
|
||||
summary="文件浏览页(需鉴权)",
|
||||
description="列出 / 下载 / 删除已上传文件;支持多选、批量下载删除与分页。Basic Auth 同 docs。",
|
||||
summary="文件管理页(需鉴权)",
|
||||
description=(
|
||||
"列出 / 下载 / 删除已上传文件,并合并 PDF 转换管理:以 uploaded_files 为基础,"
|
||||
"用 pdf_jobs 匹配标注关联文件的转换状态、用户软删标记,可硬删任务。"
|
||||
"支持多选、批量下载删除与分页。Basic Auth 同 docs。"
|
||||
),
|
||||
)
|
||||
def files_page(_: str = Depends(require_docs_auth)) -> HTMLResponse:
|
||||
return _serve_static_html("file_browser.html")
|
||||
@@ -223,16 +238,6 @@ def create_app() -> FastAPI:
|
||||
def whiteboard_page(board_id: str) -> HTMLResponse:
|
||||
return _serve_static_html("whiteboard.html")
|
||||
|
||||
@app.get(
|
||||
"/api/pdf-admin",
|
||||
response_class=HTMLResponse,
|
||||
tags=["pages"],
|
||||
summary="PDF 转换管理页(需鉴权)",
|
||||
description="查看全部转换任务(含用户已软删的,标注是否已删除),并可硬删。Basic Auth 同 docs。",
|
||||
)
|
||||
def pdf_admin_page(_: str = Depends(require_docs_auth)) -> HTMLResponse:
|
||||
return _serve_static_html("pdf_admin.html")
|
||||
|
||||
return app
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user