88b7fb7a0a
Forked from crypto_monitor OKX instance (copy-only). Keeps standalone options, perp-options and options-options hedge; drops standalone perp entrypoints; forces coin margin; adds sim wallets; default port 5010. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
651 B
Python
20 lines
651 B
Python
"""中控 iframe 内软导航:服务端跳过重型同步,避免切 tab 等待数秒."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from flask import Request
|
|
|
|
|
|
def request_is_hub_soft_nav(req: Request | None = None) -> bool:
|
|
"""embed=1 且带 X-Instance-Soft-Nav 头:实例页内 fetch 换页,非整页刷新."""
|
|
try:
|
|
from flask import request as flask_request
|
|
|
|
r = req or flask_request
|
|
if str(r.args.get("embed") or "").strip() != "1":
|
|
return False
|
|
flag = (r.headers.get("X-Instance-Soft-Nav") or "").strip().lower()
|
|
return flag in ("1", "true", "yes")
|
|
except Exception:
|
|
return False
|