feat(sync): 首次登录后固定随机初始凭据

This commit is contained in:
2026-09-15 00:23:20 +08:00
parent 5eb9a2b106
commit e119811800
15 changed files with 220 additions and 31 deletions
+8
View File
@@ -82,6 +82,14 @@ def main():
db.add_user(args.username or input("用户名: "), getpass.getpass("密码(至少12字符): "))
elif args.command == "serve":
db.migrate()
bootstrap = db.prepare_bootstrap_user()
if bootstrap:
print(json.dumps({
"event": "SYNC_BOOTSTRAP_CREDENTIALS",
"username": bootstrap["username"],
"password": bootstrap["password"],
"must_change_credentials": True,
}), flush=True)
import uvicorn
host = os.environ.get("SYNC_HOST", "0.0.0.0")
if host not in {"0.0.0.0", "127.0.0.1", "::1"}: