mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
Fix OAuth token import and table filters
This commit is contained in:
@@ -145,9 +145,14 @@ fn secret_fingerprint(value: &str) -> String {
|
||||
}
|
||||
|
||||
fn oauth_invalid_reason_is_account_block(reason: Option<&str>) -> bool {
|
||||
reason
|
||||
.map(str::trim)
|
||||
.is_some_and(|value| value.starts_with(OAUTH_ACCOUNT_BLOCK_PREFIX))
|
||||
let Some(reason) = reason.map(str::trim).filter(|value| !value.is_empty()) else {
|
||||
return false;
|
||||
};
|
||||
if reason.starts_with(OAUTH_ACCOUNT_BLOCK_PREFIX) {
|
||||
return true;
|
||||
}
|
||||
aether_admin::provider::status::resolve_account_status_snapshot(None, None, Some(reason))
|
||||
.blocked
|
||||
}
|
||||
|
||||
fn normalize_local_oauth_refresh_error_message(
|
||||
@@ -267,15 +272,8 @@ fn merge_local_oauth_refresh_failure_reason(
|
||||
if current_reason.starts_with(OAUTH_EXPIRED_PREFIX) {
|
||||
return None;
|
||||
}
|
||||
if current_reason.starts_with(OAUTH_ACCOUNT_BLOCK_PREFIX) {
|
||||
if let Some((head, _)) = current_reason.split_once("[REFRESH_FAILED]") {
|
||||
return Some(
|
||||
format!("{}\n{}", head.trim_end(), refresh_reason)
|
||||
.trim()
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
return Some(format!("{current_reason}\n{refresh_reason}"));
|
||||
if oauth_invalid_reason_is_account_block(Some(current_reason)) {
|
||||
return None;
|
||||
}
|
||||
Some(refresh_reason.to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user