Use per-exchange PWA names and logos for instance app installs.

Show Binance/OKX/Gate 交易系统 with distinct exchange icons in manifests, apple titles, and login branding.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-16 08:44:07 +08:00
parent 717a3d5694
commit 19a4a5194d
62 changed files with 327 additions and 89 deletions
+16 -12
View File
@@ -15,10 +15,10 @@ REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SRC = os.path.join(REPO, "brand", "icons")
HUB_DEST = os.path.join(REPO, "manual_trading_hub", "static", "icons")
EXCHANGE_DIRS = (
"crypto_monitor_binance",
"crypto_monitor_okx",
"crypto_monitor_gate",
EXCHANGES = (
("crypto_monitor_binance", "binance", "manifest.binance.webmanifest"),
("crypto_monitor_okx", "okx", "manifest.okx.webmanifest"),
("crypto_monitor_gate", "gate", "manifest.gate.webmanifest"),
)
FILES = (
@@ -32,12 +32,15 @@ FILES = (
)
def sync_dir(dest: str, url_prefix: str, manifest_template: str) -> str:
if not os.path.isdir(SRC):
return f"SKIP {dest}: 请先运行 python scripts/generate_brand_icons.py"
def sync_dir(src_dir: str, dest: str, url_prefix: str, manifest_template: str) -> str:
if not os.path.isdir(src_dir):
return f"SKIP {dest}: 缺少 {src_dir},请先运行 python scripts/generate_brand_icons.py"
os.makedirs(dest, exist_ok=True)
for name in FILES:
shutil.copy2(os.path.join(SRC, name), os.path.join(dest, name))
src = os.path.join(src_dir, name)
if not os.path.isfile(src):
return f"SKIP {dest}: 缺少 {src}"
shutil.copy2(src, os.path.join(dest, name))
manifest_src = os.path.join(REPO, "brand", manifest_template)
if os.path.isfile(manifest_src):
with open(manifest_src, encoding="utf-8") as f:
@@ -53,10 +56,11 @@ def sync_dir(dest: str, url_prefix: str, manifest_template: str) -> str:
def main() -> None:
print(sync_dir(HUB_DEST, "/assets/icons", "manifest.webmanifest"))
for d in EXCHANGE_DIRS:
dest = os.path.join(REPO, d, "static", "icons")
print(sync_dir(dest, "/static/icons", "manifest.exchange.webmanifest"))
print(sync_dir(SRC, HUB_DEST, "/assets/icons", "manifest.webmanifest"))
for folder, key, manifest in EXCHANGES:
dest = os.path.join(REPO, folder, "static", "icons")
src_dir = os.path.join(SRC, key)
print(sync_dir(src_dir, dest, "/static/icons", manifest))
if __name__ == "__main__":