mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(account): add quota trend chart and multi-account risk gate
- Gate multi-account login, import, switch, backup quota polling, and vault controls behind explicit risk consent (accountSwitchRiskAccepted), restricting unaccepted sessions to active-account quota viewing - Add collinear-compressed per-account quota history tracking and a full-bleed 184px AccountQuotaTrendCard supporting cycle, preset, all-time, and custom ranges with cycle-boundary pre-reset filtering and isolated impulse spike sanitization - Unify Account tab controls onto shared SegmentedControl, CustomSelect, CustomDateTimePicker, .ctx-risk-mask, and global status/button primitives while removing bespoke .account-* CSS and balancing card padding
This commit is contained in:
@@ -11,6 +11,10 @@ import {
|
||||
resolveGoogleCredential,
|
||||
retrieveCredentialQuota,
|
||||
} from './account-oauth.mjs';
|
||||
import {
|
||||
recordAccountQuotaSnapshot,
|
||||
removeAccountQuotaHistory,
|
||||
} from './account-quota-history.mjs';
|
||||
import {
|
||||
checkVaultUnlockCooldown,
|
||||
createVaultSecurityMetadata,
|
||||
@@ -36,7 +40,7 @@ const ACCOUNT_ERRORS = new Set([
|
||||
'oauthUnavailable', 'quotaUnavailable',
|
||||
'switchStartFailed', 'clientCloseFailed', 'clientRestartFailed',
|
||||
'vaultLocked', 'wrongPassword', 'invalidPassword', 'passwordRateLimited',
|
||||
'vaultDecryptFailed', 'invalidActionNonce',
|
||||
'vaultDecryptFailed', 'invalidActionNonce', 'riskNotAccepted',
|
||||
]);
|
||||
|
||||
const ALLOWED_ACTIONS = new Set([
|
||||
@@ -717,6 +721,7 @@ export async function handleAccountCredentialAction(
|
||||
if (action === 'remove') {
|
||||
const activeSec = await ensureUnlockedVaultContext();
|
||||
clearTransientAccessTokens(email);
|
||||
removeAccountQuotaHistory(email);
|
||||
return publicList(
|
||||
await runStore({
|
||||
action,
|
||||
@@ -806,6 +811,9 @@ export async function handleAccountCredentialAction(
|
||||
expectedCredential: expectedCredForQuota,
|
||||
quota: quotaPayload,
|
||||
});
|
||||
if (useDiskSigCache) {
|
||||
recordAccountQuotaSnapshot(email, pools, fetchedAt, { isActiveHost: false });
|
||||
}
|
||||
return { email, pools, fetchedAt, ...tierMeta };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user