Add proper PWA install icons and sim-aware app manifest.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-16 16:38:37 +08:00
parent f66b4c3fb3
commit 960565482f
16 changed files with 247 additions and 26 deletions
+13 -4
View File
@@ -201,9 +201,18 @@ def register_embed_routes(
return resp
def pwa_app_name(exchange_key: str) -> str:
"""安装 App / 主屏幕显示名(各所独立标识)."""
def pwa_app_name(exchange_key: str, *, is_sim: bool | None = None) -> str:
"""安装 App / 主屏幕显示名(各所独立标识;模拟盘带 _sim)."""
ex = (exchange_key or "").strip().lower()
base = {
"binance": "Binance",
"okx": "OKX",
"gate": "Gate",
}.get(ex, "Crypto")
if is_sim is True:
return f"{base}_sim"
if is_sim is False:
return f"{base}_live"
return {
"binance": "Binance 交易系统",
"okx": "OKX 交易系统",
@@ -211,11 +220,11 @@ def pwa_app_name(exchange_key: str) -> str:
}.get(ex, "交易系统")
def embed_context_extras(exchange_key: str) -> dict:
def embed_context_extras(exchange_key: str, *, is_sim: bool | None = None) -> dict:
return {
"order_rule_tips_tpl": order_rule_tips_template(exchange_key),
"include_transfer_block": include_transfer_block(exchange_key),
"ui_open_guard_enabled": ui_open_guard_enabled(exchange_key),
"ui_orphan_recovery_enabled": ui_orphan_recovery_enabled(exchange_key),
"pwa_app_name": pwa_app_name(exchange_key),
"pwa_app_name": pwa_app_name(exchange_key, is_sim=is_sim),
}
+7
View File
@@ -12,6 +12,13 @@
<script src="/static/account_risk_badge.js?v=4"></script>
<script src="/static/open_submit_gate.js?v=1"></script>
<meta name="theme-color" content="#0b0d14">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="{{ pwa_app_name }}">
<link rel="icon" href="/static/icons/favicon.ico?v=2" sizes="any">
<link rel="icon" href="/static/icons/icon-32.png?v=2" type="image/png" sizes="32x32">
<link rel="icon" href="/static/icons/icon.svg?v=2" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png?v=2">
<link rel="manifest" href="/manifest.webmanifest">
<title>{{ pwa_app_name }}</title>
</head>
<body
+6 -4
View File
@@ -12,11 +12,13 @@
<script src="/static/open_submit_gate.js?v=1"></script>
<meta name="theme-color" content="#0b0d14">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="{{ pwa_app_name }}">
<link rel="icon" href="/static/icons/favicon.ico" sizes="32x32">
<link rel="icon" href="/static/icons/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
<link rel="manifest" href="/static/icons/manifest.webmanifest">
<link rel="icon" href="/static/icons/favicon.ico?v=2" sizes="any">
<link rel="icon" href="/static/icons/icon-32.png?v=2" type="image/png" sizes="32x32">
<link rel="icon" href="/static/icons/icon.svg?v=2" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png?v=2">
<link rel="manifest" href="/manifest.webmanifest">
<title>{{ pwa_app_name }}</title>
<link rel="stylesheet" href="/static/instance_page.css?v=17">
<link rel="stylesheet" href="/static/instance_theme.css?v=121">
+6 -4
View File
@@ -5,11 +5,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<script src="/static/instance_theme.js?v=4"></script>
<meta name="theme-color" content="#0b0d14">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="{{ pwa_app_name }}">
<link rel="icon" href="/static/icons/favicon.ico" sizes="32x32">
<link rel="icon" href="/static/icons/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
<link rel="manifest" href="/static/icons/manifest.webmanifest">
<link rel="icon" href="/static/icons/favicon.ico?v=2" sizes="any">
<link rel="icon" href="/static/icons/icon-32.png?v=2" type="image/png" sizes="32x32">
<link rel="icon" href="/static/icons/icon.svg?v=2" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png?v=2">
<link rel="manifest" href="/manifest.webmanifest">
<title>登录 · {{ pwa_app_name }}</title>
<style>
* {