From 6144a480c7366c1ef040061eae0590dd41538c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=BD=E5=B7=A5=E5=91=98?= <4846a27a-ba87-49c9-939d-7275f63efcc7@agents.multica.local> Date: Mon, 24 Aug 2026 01:47:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(HEL-69):=20serve=5Fstatic=20=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=20index=20=E5=85=9C=E5=BA=95=EF=BC=8C=E9=97=B8?= =?UTF-8?q?=E9=97=A8=E6=94=B9=E8=B7=B3=20/m/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 审核通过后部署侧小改:目录请求返回 index.html,避免 /m/ 回退桌面页;分流闸门同步改用干净 /m/ 地址。 Co-authored-by: Cursor Co-authored-by: multica-agent --- app/backend/http/handler.py | 7 +++++++ app/frontend/index.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/backend/http/handler.py b/app/backend/http/handler.py index 59b3643..c95e484 100644 --- a/app/backend/http/handler.py +++ b/app/backend/http/handler.py @@ -104,6 +104,13 @@ class HttpTransportMixin: except ValueError: self.send_error(HTTPStatus.FORBIDDEN) return + if candidate.is_dir(): + candidate = (candidate / "index.html").resolve() + try: + candidate.relative_to(STATIC_DIR.resolve()) + except ValueError: + self.send_error(HTTPStatus.FORBIDDEN) + return if not candidate.is_file(): candidate = STATIC_DIR / "index.html" try: diff --git a/app/frontend/index.html b/app/frontend/index.html index 6fa118f..2d85bfa 100644 --- a/app/frontend/index.html +++ b/app/frontend/index.html @@ -16,7 +16,7 @@ const autoMobile = window.matchMedia && window.matchMedia("(max-width: 720px)").matches; const mobileUA = /Android|iPhone|iPad|iPod|Mobile|Windows Phone/i.test(navigator.userAgent || ""); if (!forcedDesktop && !alreadyMobile && (forcedMobile || autoMobile || mobileUA)) { - window.location.replace("/m/index.html" + window.location.search + window.location.hash); + window.location.replace("/m/" + window.location.search + window.location.hash); } })();