fix: harden OAuth identity and cookies and correct quota and JSON display

This commit is contained in:
elky
2026-09-08 10:51:25 +08:00
parent 7113d04f8a
commit cf8ea19856
24 changed files with 1327 additions and 154 deletions
@@ -71,6 +71,37 @@ describe('providerKeyQuota', () => {
}, 'codex')).toBe('月剩余 86.0%')
})
it('keeps account and model Codex weekly quotas distinct in display text', () => {
expect(getQuotaDisplayText({
status_snapshot: {
oauth: { code: 'valid' },
account: { code: 'ok', blocked: false },
quota: {
provider_type: 'codex',
code: 'ok',
exhausted: false,
windows: [
{
code: 'weekly',
label: '周',
scope: 'account',
window_minutes: 10_080,
remaining_ratio: 0.9,
},
{
code: 'additional_0_primary',
label: 'gpt-reserve',
scope: 'model',
model: 'gpt-reserve',
window_minutes: 10_080,
remaining_ratio: 0.4,
},
],
},
},
}, 'codex')).toBe('周剩余 90.0% | gpt-reserve 周剩余 40.0%')
})
it('formats Grok account quota from structured quota windows', () => {
expect(getQuotaDisplayText({
status_snapshot: {