mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 16:16:52 +00:00
fix(quota): remove misleading token expiration check in quota fetcher
Backend was returning 'Token expired' error based on stale file state without attempting API call. CLIProxyAPIPlus refreshes tokens at runtime but intentionally doesn't persist to disk, making file-based expiration checks always misleading. Now quota fetcher attempts API call regardless of file expiration state. If token is truly invalid, API returns 401 which is handled properly.
This commit is contained in:
@@ -377,17 +377,10 @@ export async function fetchAccountQuota(
|
||||
};
|
||||
}
|
||||
|
||||
// Check if token is expired
|
||||
if (authData.isExpired) {
|
||||
return {
|
||||
success: false,
|
||||
models: [],
|
||||
lastUpdated: Date.now(),
|
||||
isExpired: true,
|
||||
expiresAt: authData.expiresAt || undefined,
|
||||
error: 'Token expired',
|
||||
};
|
||||
}
|
||||
// Note: We don't check isExpired here because:
|
||||
// 1. CLIProxyAPIPlus refreshes tokens at runtime but doesn't persist to disk
|
||||
// 2. File-based expiration is always stale and misleading
|
||||
// 3. If token is truly invalid, the API call below will fail with 401
|
||||
|
||||
// Get project ID - prefer stored value, fallback to API call
|
||||
let projectId = authData.projectId;
|
||||
|
||||
Reference in New Issue
Block a user