feat(web): use history routing and preserve scroll on filter changes

This commit is contained in:
kairee committed 2026-11-01 01:55:37 +08:00
1 parent 1b08854b25
commit 52a8d90c47
9 files changed
+113 -33

No files matched your search

+6 -1
View File
@@ -388,7 +388,12 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
except ValueError:
raise ApiError(HTTPStatus.NOT_FOUND, "not_found", "文件不存在")
else:
raise ApiError(HTTPStatus.NOT_FOUND, "not_found", "页面不存在")
# 伪静态前端路由:/rank、/video/123、/up/123 等直接返回 index.html,
# 由前端根据 location.pathname 渲染。带扩展名的路径仍按文件处理并返回 404。
last_segment = path.rstrip("/").rsplit("/", 1)[-1]
if "." in last_segment:
raise ApiError(HTTPStatus.NOT_FOUND, "not_found", "文件不存在")
target = STATIC_ROOT / "index.html"
if not target.is_file():
raise ApiError(HTTPStatus.NOT_FOUND, "not_found", "页面不存在")
content_type = mimetypes.guess_type(str(target))[0] or "application/octet-stream"