feat: Add authorized field to old format account parsing based on accessToken presence.

This commit is contained in:
2026-01-18 06:27:23 +08:00
parent 4ca15d9f01
commit b75d12b5aa

View File

@@ -156,13 +156,15 @@ def _parse_team_config(t: dict, index: int) -> dict:
# 旧格式: account 是对象 # 旧格式: account 是对象
email = t.get("user", {}).get("email", f"Team{index+1}") email = t.get("user", {}).get("email", f"Team{index+1}")
name = email.split("@")[0] if "@" in email else f"Team{index+1}" name = email.split("@")[0] if "@" in email else f"Team{index+1}"
auth_token = t.get("accessToken", "")
return { return {
"name": name, "name": name,
"account_id": t.get("account", {}).get("id", ""), "account_id": t.get("account", {}).get("id", ""),
"org_id": t.get("account", {}).get("organizationId", ""), "org_id": t.get("account", {}).get("organizationId", ""),
"auth_token": t.get("accessToken", ""), "auth_token": auth_token,
"owner_email": email, "owner_email": email,
"owner_password": "", "owner_password": "",
"authorized": bool(auth_token), # 旧格式有 token 即视为已授权
"format": "old", "format": "old",
"raw": t "raw": t
} }