refactor: 移除旧版单文件管理后台兼容

This commit is contained in:
2026-07-15 07:46:30 +00:00
parent 4df439b5ce
commit 0b71e8d024
17 changed files with 16 additions and 2744 deletions
+3 -14
View File
@@ -7,7 +7,6 @@ from app.core.config import configured_path
router = APIRouter(include_in_schema=False)
ADMIN_HTML_PATH = configured_path("ADMIN_HTML_PATH", "legacy/admin.html")
ADMIN_UI_DIST_PATH = configured_path("ADMIN_UI_DIST_PATH", "admin-ui/dist")
ADMIN_UI_INDEX_PATH = ADMIN_UI_DIST_PATH / "index.html"
ADMIN_UI_ASSETS_PATH = ADMIN_UI_DIST_PATH / "assets"
@@ -23,20 +22,10 @@ def mount_admin_assets(app: FastAPI):
@router.get("/")
@router.get("/admin.html")
def admin_page():
if ADMIN_UI_INDEX_PATH.is_file():
return FileResponse(ADMIN_UI_INDEX_PATH, headers={"Cache-Control": "no-store"})
if not ADMIN_HTML_PATH.is_file():
raise HTTPException(status_code=404, detail="管理页面文件不存在")
return FileResponse(ADMIN_HTML_PATH, headers={"Cache-Control": "no-store"})
@router.get("/legacy-admin.html")
def legacy_admin_page():
if not ADMIN_HTML_PATH.is_file():
raise HTTPException(status_code=404, detail="旧管理页面文件不存在")
return FileResponse(ADMIN_HTML_PATH, headers={"Cache-Control": "no-store"})
if not ADMIN_UI_INDEX_PATH.is_file():
raise HTTPException(status_code=404, detail="管理后台前端文件不存在,请先构建 admin-ui/dist")
return FileResponse(ADMIN_UI_INDEX_PATH, headers={"Cache-Control": "no-store"})
@router.get("/favicon.ico")