fix(HEL-69): serve_static 目录 index 兜底,闸门改跳 /m/
审核通过后部署侧小改:目录请求返回 index.html,避免 /m/ 回退桌面页;分流闸门同步改用干净 /m/ 地址。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
9064d5a682
commit
c445f19842
@@ -104,6 +104,13 @@ class HttpTransportMixin:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
self.send_error(HTTPStatus.FORBIDDEN)
|
self.send_error(HTTPStatus.FORBIDDEN)
|
||||||
return
|
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():
|
if not candidate.is_file():
|
||||||
candidate = STATIC_DIR / "index.html"
|
candidate = STATIC_DIR / "index.html"
|
||||||
try:
|
try:
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
const autoMobile = window.matchMedia && window.matchMedia("(max-width: 720px)").matches;
|
const autoMobile = window.matchMedia && window.matchMedia("(max-width: 720px)").matches;
|
||||||
const mobileUA = /Android|iPhone|iPad|iPod|Mobile|Windows Phone/i.test(navigator.userAgent || "");
|
const mobileUA = /Android|iPhone|iPad|iPod|Mobile|Windows Phone/i.test(navigator.userAgent || "");
|
||||||
if (!forcedDesktop && !alreadyMobile && (forcedMobile || autoMobile || mobileUA)) {
|
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);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user