fix: Codex配置页看不到已保存的凭证
CredentialEditViewModel.load() 缺少 CodexCredential 分支, 导致已保存的凭据不回显到表单。
This commit is contained in:
parent
a5ba79ea4b
commit
23ae718327
@ -79,6 +79,20 @@ class CredentialEditViewModel @Inject constructor(
|
|||||||
authCookie = (existing as? Credential.SessionCredential)?.authCookie.orEmpty(),
|
authCookie = (existing as? Credential.SessionCredential)?.authCookie.orEmpty(),
|
||||||
workspaceId = (existing as? Credential.SessionCredential)?.workspaceId.orEmpty(),
|
workspaceId = (existing as? Credential.SessionCredential)?.workspaceId.orEmpty(),
|
||||||
cookieCount = (existing as? Credential.SessionCredential)?.cookies?.size ?: 0,
|
cookieCount = (existing as? Credential.SessionCredential)?.cookies?.size ?: 0,
|
||||||
|
codexAuthJson = if (existing is Credential.CodexCredential) {
|
||||||
|
buildString {
|
||||||
|
appendLine("{")
|
||||||
|
appendLine(" \"access_token\": \"${existing.accessToken}\",")
|
||||||
|
appendLine(" \"refresh_token\": \"${existing.refreshToken}\",")
|
||||||
|
append(" \"account_id\": \"${existing.accountId}\"")
|
||||||
|
if (existing.expiresAt > 0) {
|
||||||
|
appendLine(",")
|
||||||
|
append(" \"expires_at\": ${existing.expiresAt}")
|
||||||
|
}
|
||||||
|
appendLine()
|
||||||
|
append("}")
|
||||||
|
}
|
||||||
|
} else "",
|
||||||
hasExisting = existing != null
|
hasExisting = existing != null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user