refactor: 将共用代码迁入 lib/ 模块化目录

统一 strategy、key_monitor、trade、hub 等共用库到 lib/ 子包,并补充 lib-structure 文档,便于四所与中控维护。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-02 16:23:09 +08:00
parent 4742a0bb9d
commit 5797d49d8a
190 changed files with 27946 additions and 27499 deletions
+19
View File
@@ -0,0 +1,19 @@
"""中控 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