This commit is contained in:
dekun
2026-05-30 16:01:46 +08:00
parent 1993c7b4b1
commit e96a386d35
5 changed files with 240 additions and 8 deletions
+17 -2
View File
@@ -66,12 +66,12 @@ class Service(db.Model):
return f"{self.build_origin()}{p}"
def build_open_url(self) -> str:
"""导航 iframe 首次打开的地址(中控走 login?embed=1 以便写入会话)。"""
"""导航 iframe 首次打开的地址(中控 / Gate 扫单走 login?embed=1 以便写入会话)。"""
kind = (self.embed_kind or "").strip().lower()
next_path = (self.path or "/monitor").strip() or "/monitor"
if not next_path.startswith("/"):
next_path = "/" + next_path
if kind == "hub":
if kind == "hub" or kind in ("gate_scout", "gate_exec", "scout", "exec"):
from urllib.parse import urlencode
q = urlencode({"embed": "1", "next": next_path})
@@ -80,3 +80,18 @@ class Service(db.Model):
def is_hub_embed(self) -> bool:
return (self.embed_kind or "").strip().lower() == "hub"
def is_gate_scout_embed(self) -> bool:
return (self.embed_kind or "").strip().lower() in (
"gate_scout",
"gate_exec",
"scout",
"exec",
)
def gate_scout_api_login_path(self) -> str:
"""服务端代登录使用的 API 路径。"""
kind = (self.embed_kind or "").strip().lower()
if kind in ("gate_exec", "exec"):
return "/login"
return "/api/auth/login"