diff --git a/backend/euniv/api.py b/backend/euniv/api.py index a4e0963..4221e0b 100644 --- a/backend/euniv/api.py +++ b/backend/euniv/api.py @@ -679,10 +679,10 @@ _dist = Path(__file__).resolve().parents[2] / "web" / "dist" @app.get("/tool-upgrade", include_in_schema=False) @app.get("/tool-upgrade/", include_in_schema=False) def tool_upgrade_page() -> FileResponse: - index = _dist / "index.html" - if not index.is_file(): + page = _dist / "tool-upgrade" / "index.html" + if not page.is_file(): raise HTTPException(status_code=404, detail="页面不存在") - return FileResponse(index, headers={"Cache-Control": "no-cache"}) + return FileResponse(page, headers={"Cache-Control": "no-cache"}) if _dist.is_dir(): diff --git a/backend/tests/test_api.py b/backend/tests/test_api.py index e606aa7..6cad719 100644 --- a/backend/tests/test_api.py +++ b/backend/tests/test_api.py @@ -1227,5 +1227,7 @@ def test_tool_upgrade_page_is_reachable_only_by_its_address() -> None: response = TestClient(api_module.app).get("/tool-upgrade") assert response.status_code == 200 - assert 'id="app"' in response.text + assert "旧版工具已失效" in response.text + assert "复制地址" in response.text + assert 'type="module"' not in response.text assert response.headers["cache-control"] == "no-cache" diff --git a/web/public/tool-upgrade/index.html b/web/public/tool-upgrade/index.html new file mode 100644 index 0000000..39f3116 --- /dev/null +++ b/web/public/tool-upgrade/index.html @@ -0,0 +1,146 @@ + + + + + + + + 旧版工具已失效 + + + +
+
+
+

旧版工具已失效

+

因目标平台升级,旧版工具已失效,无法登录使用。新版工具已上线。

+

请复制下面的地址,打开浏览器,粘贴到地址栏后访问。

+

https://euniv.asio.asia

+ +

+
+
+ + + diff --git a/web/src/App.vue b/web/src/App.vue index d2dbff2..dc76800 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -3,7 +3,6 @@ import { onMounted, onUnmounted, ref } from "vue"; import { apiFetch, setSessionDenied } from "./shared/http"; import { darkTheme, dateZhCN, NButton, NConfigProvider, NDialogProvider, zhCN } from "naive-ui"; import LoginView from "./features/auth/LoginView.vue"; -import ToolUpgradeView from "./features/tool-upgrade/ToolUpgradeView.vue"; import Shell from "./shell/Shell.vue"; import AdminShell from "./shell/AdminShell.vue"; import { isDark, themeOverrides } from "./shared/theme"; @@ -12,7 +11,6 @@ import { sessionFromPayload, type AppSession } from "./shared/session"; const ready = ref(false); const session = ref(null); const sessionError = ref(""); -const isToolUpgrade = window.location.pathname.replace(/\/+$/, "") === "/tool-upgrade"; function applyPayload(payload: unknown) { if (!payload || typeof payload !== "object") return null; @@ -46,7 +44,6 @@ async function loadSession() { } onMounted(() => { - if (isToolUpgrade) return; setSessionDenied(() => { void loadSession(); }); @@ -112,8 +109,7 @@ function onLogin(next: AppSession) {