修复
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user