diff --git a/routes/pages.py b/routes/pages.py index 66e6c77..845a85f 100644 --- a/routes/pages.py +++ b/routes/pages.py @@ -6,7 +6,7 @@ import json import os from typing import Optional -from flask import Blueprint, current_app, redirect, render_template, request, session, url_for +from flask import Blueprint, current_app, redirect, render_template, session, url_for from flask_login import current_user, login_required from routes.decorators import admin_required @@ -72,13 +72,6 @@ def _get_asset_build_id(static_root: str, rel_paths: list[str]) -> Optional[str] return str(int(max(mtimes))) -def _is_legacy_admin_user_agent(user_agent: str) -> bool: - if not user_agent: - return False - ua = user_agent.lower() - return "msie" in ua or "trident/" in ua - - @pages_bp.route("/") def index(): """主页 - 重定向到登录或应用""" @@ -125,8 +118,6 @@ def admin_login_page(): @admin_required def admin_page(): """后台管理页面""" - if request.args.get("legacy") == "1" or _is_legacy_admin_user_agent(request.headers.get("User-Agent", "")): - return render_template("admin_legacy.html") logger = get_logger() manifest_path = os.path.join(current_app.root_path, "static", "admin", ".vite", "manifest.json") try: @@ -138,8 +129,8 @@ def admin_page(): css_files = entry.get("css") or [] if not js_file: - logger.warning(f"[admin_spa] manifest缺少入口文件: {manifest_path}") - return render_template("admin_legacy.html") + logger.error(f"[admin_spa] manifest缺少入口文件: {manifest_path}") + return "后台前端资源缺失,请重新构建管理端", 503 admin_spa_js_file = f"admin/{js_file}" admin_spa_css_files = [f"admin/{p}" for p in css_files] @@ -155,8 +146,8 @@ def admin_page(): admin_spa_build_id=admin_spa_build_id, ) except FileNotFoundError: - logger.warning(f"[admin_spa] 未找到manifest: {manifest_path},回退旧版后台模板") - return render_template("admin_legacy.html") + logger.error(f"[admin_spa] 未找到manifest: {manifest_path}") + return "后台前端资源未构建,请联系管理员", 503 except Exception as e: logger.error(f"[admin_spa] 加载manifest失败: {e}") - return render_template("admin_legacy.html") + return "后台页面加载失败,请稍后重试", 500 diff --git a/templates/admin.html b/templates/admin.html index 3566d20..b9d01de 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -14,34 +14,6 @@
- {% if admin_spa_build_id %} diff --git a/templates/admin_legacy.html b/templates/admin_legacy.html deleted file mode 100644 index c455e68..0000000 --- a/templates/admin_legacy.html +++ /dev/null @@ -1,3520 +0,0 @@ - - - - - -IP:PORT (例如: 123.45.67.89:8888)
- | 时间 | -来源 | -用户 | -账号 | -浏览类型 | -状态 | -内容/附件 | -用时 | -失败原因 | -
|---|---|---|---|---|---|---|---|---|