fix: 升级说明改为内嵌背景的独立页面
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user