mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-06 17:37:47 +08:00
fix(frontend): 合并 OAuth 状态展示并移除 Codex 积分信息
- providerKeyStatus: 合并 snapshot 与 legacy OAuth 状态,按严重程度取优并补全失效原因 - ProviderDetailDrawer: 移除 Codex 积分摘要与相关字段显示
This commit is contained in:
@@ -127,11 +127,44 @@ function getLegacyOAuthState(
|
||||
)
|
||||
}
|
||||
|
||||
function getOAuthStatusSeverity(status: OAuthStatusInfo | null): number {
|
||||
if (!status) return 0
|
||||
if (status.isInvalid) return 3
|
||||
if (status.isExpired) return 2
|
||||
return 1
|
||||
}
|
||||
|
||||
function mergeOAuthStatusDisplay(
|
||||
snapshotStatus: OAuthStatusInfo | null,
|
||||
legacyStatus: OAuthStatusInfo | null,
|
||||
): OAuthStatusInfo | null {
|
||||
if (getOAuthStatusSeverity(legacyStatus) > getOAuthStatusSeverity(snapshotStatus)) {
|
||||
return legacyStatus
|
||||
}
|
||||
|
||||
if (
|
||||
snapshotStatus?.isInvalid
|
||||
&& !snapshotStatus.invalidReason
|
||||
&& legacyStatus?.isInvalid
|
||||
&& legacyStatus.invalidReason
|
||||
) {
|
||||
return {
|
||||
...snapshotStatus,
|
||||
invalidReason: legacyStatus.invalidReason,
|
||||
}
|
||||
}
|
||||
|
||||
return snapshotStatus ?? legacyStatus
|
||||
}
|
||||
|
||||
export function getOAuthStatusDisplay(
|
||||
input: ProviderKeyStatusCarrier,
|
||||
tick: number,
|
||||
): OAuthStatusInfo | null {
|
||||
return getSnapshotOAuthState(input, tick) ?? getLegacyOAuthState(input, tick)
|
||||
return mergeOAuthStatusDisplay(
|
||||
getSnapshotOAuthState(input, tick),
|
||||
getLegacyOAuthState(input, tick),
|
||||
)
|
||||
}
|
||||
|
||||
export function getOAuthStatusTitle(
|
||||
|
||||
Reference in New Issue
Block a user