Fix order_popup flag through SSO and hide stats in hub order popup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 23:38:21 +08:00
parent d8140c6216
commit 347e6b5545
5 changed files with 55 additions and 17 deletions
+20 -6
View File
@@ -126,6 +126,10 @@ def register_embed_routes(
if tab not in EMBED_TABS:
tab = "trade"
session["hub_embed_shell"] = True
if request_order_popup():
session["hub_order_popup"] = True
else:
session.pop("hub_order_popup", None)
return render_main_page_fn(tab, embed_mode="shell")
@login_required
@@ -140,13 +144,23 @@ def register_embed_routes(
return jsonify({"ok": True, "page": tab, "html": html})
def merge_next_query(path: str, **params: str) -> str:
"""把 query 参数合并进 next 路径(SSO / embed 跳转用)。"""
split = urlsplit(path or "/")
q = dict(parse_qsl(split.query, keep_blank_values=True))
for k, v in params.items():
val = (v or "").strip()
if val:
q[k] = val
base = split.path or "/"
return f"{base}?{urlencode(q)}" if q else base
def request_order_popup() -> bool:
return (request.args.get("order_popup") or "").strip().lower() in (
"1",
"true",
"yes",
"on",
)
raw = (request.args.get("order_popup") or "").strip().lower()
if raw in ("1", "true", "yes", "on"):
return True
return bool(session.get("hub_order_popup"))
def embed_context_extras(exchange_key: str) -> dict: