mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +08:00
Distinguish expired OAuth token status
This commit is contained in:
@@ -171,7 +171,10 @@ fn oauth_invalid_reason_is_account_block(reason: Option<&str>) -> bool {
|
||||
snapshot.blocked
|
||||
&& !matches!(
|
||||
snapshot.code.trim().to_ascii_lowercase().as_str(),
|
||||
"oauth_token_invalid" | "oauth_expired" | "oauth_refresh_failed"
|
||||
"oauth_token_invalid"
|
||||
| "oauth_token_expired"
|
||||
| "oauth_expired"
|
||||
| "oauth_refresh_failed"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -356,14 +359,16 @@ fn build_oauth_status_snapshot_value(key: &StoredProviderCatalogKey) -> Value {
|
||||
let invalid_reason = trimmed_reason(key.oauth_invalid_reason.as_deref());
|
||||
|
||||
if let Some(reason) = tagged_reason(invalid_reason.as_deref(), OAUTH_EXPIRED_PREFIX) {
|
||||
let (code, label) =
|
||||
aether_admin::provider::status::oauth_token_snapshot_status_parts(reason.as_str());
|
||||
return json!({
|
||||
"code": "invalid",
|
||||
"label": "已失效",
|
||||
"code": code,
|
||||
"label": label,
|
||||
"reason": reason,
|
||||
"expires_at": expires_at_unix_secs,
|
||||
"invalid_at": invalid_at_unix_secs,
|
||||
"source": "oauth_invalid",
|
||||
"requires_reauth": true,
|
||||
"requires_reauth": code == "invalid",
|
||||
"expiring_soon": false,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user