From ee2dac28bd0469af0db3c3ff93b7e78f0951c53a Mon Sep 17 00:00:00 2001 From: CJACK Date: Sun, 1 Feb 2026 21:47:23 +0800 Subject: [PATCH] chore: remove debug logs --- routes/home.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/routes/home.py b/routes/home.py index 9e63b50..dad0fb8 100644 --- a/routes/home.py +++ b/routes/home.py @@ -279,21 +279,8 @@ def index(request: Request): @router.get("/admin/{path:path}") async def webui(request: Request, path: str = ""): """提供 WebUI 静态文件""" - from core.config import logger - - logger.info(f"[webui] 请求路径: /admin/{path}, STATIC_ADMIN_DIR: {STATIC_ADMIN_DIR}") - # 检查 static/admin 目录是否存在 if not os.path.isdir(STATIC_ADMIN_DIR): - logger.error(f"[webui] 目录不存在: {STATIC_ADMIN_DIR}") - # 列出当前工作目录的内容帮助调试 - try: - import glob - cwd = os.getcwd() - files = glob.glob(os.path.join(cwd, "static", "**"), recursive=True)[:20] - logger.error(f"[webui] 当前工作目录: {cwd}, 可用文件: {files}") - except Exception as e: - logger.error(f"[webui] 列出文件失败: {e}") return HTMLResponse( content="

WebUI not built

Run cd webui && npm run build first.

", status_code=404 @@ -302,16 +289,8 @@ async def webui(request: Request, path: str = ""): # 如果请求的是具体文件(如 js, css) if path and "." in path: file_path = os.path.join(STATIC_ADMIN_DIR, path) - logger.info(f"[webui] 查找文件: {file_path}, 存在: {os.path.isfile(file_path)}") if os.path.isfile(file_path): return FileResponse(file_path) - # 列出实际存在的文件 - try: - import glob - available = glob.glob(os.path.join(STATIC_ADMIN_DIR, "**", "*"), recursive=True) - logger.error(f"[webui] 文件不存在: {file_path}, 可用文件: {available[:10]}") - except Exception as e: - logger.error(f"[webui] 列出文件失败: {e}") return HTMLResponse(content="Not Found", status_code=404) # 否则返回 index.html(SPA 路由) @@ -321,3 +300,4 @@ async def webui(request: Request, path: str = ""): return HTMLResponse(content="index.html not found", status_code=404) +