中控 Bridge Token 为空时自动生成,Origin 改为选填说明。

打开 env 配置或首次部署即可写入 Token,便于复制到中控登记。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-01 11:16:20 +08:00
parent 5806fe2f53
commit a4a9634ba8
4 changed files with 47 additions and 7 deletions
+9 -1
View File
@@ -3,6 +3,7 @@
- FLASK_SECRET_KEY
- APP_USERNAME=admin / APP_PASSWORD=admin123(仅空时)
- HUB_BRIDGE_TOKEN(仅空时,供中控对接)
"""
from __future__ import annotations
@@ -47,6 +48,9 @@ def main() -> int:
if (cur_pass or "").strip() in PASSWORD_PLACEHOLDERS:
updates["APP_PASSWORD"] = "admin123"
if not (env_get(lines, "HUB_BRIDGE_TOKEN") or "").strip():
updates["HUB_BRIDGE_TOKEN"] = secrets.token_urlsafe(32)
if not updates:
print(" 密钥已存在,无需写入")
return 0
@@ -54,7 +58,11 @@ def main() -> int:
print(f" 将更新 {env_path}: {', '.join(updates.keys())}")
if args.dry_run:
for k, v in updates.items():
shown = v if k != "APP_PASSWORD" and "SECRET" not in k else "***"
shown = (
"***"
if k in ("APP_PASSWORD", "HUB_BRIDGE_TOKEN") or "SECRET" in k
else v
)
print(f" {k}={shown}")
return 0