feat: cap 503 overload key retries to 1 retry key and split Admin UI into subpages

This commit is contained in:
tyuXX 2026-11-05 19:44:07 +00:00
parent 343208216e
commit 9d44c92b01
15 changed files with 3372 additions and 2997 deletions

View file

@ -13,15 +13,34 @@ async function runIntegrationTests() {
const validKey = config.apiPassword!;
try {
// 1. GET /admin UI
console.log('1. Testing GET /admin page load...');
const adminRes = await fetch(`${baseUrl}/admin`);
assert.strictEqual(adminRes.status, 200);
const adminHtml = await adminRes.text();
assert.ok(adminHtml.includes('GeminiRevolver — Admin Console'));
assert.ok(adminHtml.includes('Admin Access'));
assert.ok(adminHtml.includes('auth-gate-section'));
console.log(' ✓ Admin UI served successfully with auth gate.');
// 1. GET /admin UI & Subpages
console.log('1. Testing GET /admin redirect and dedicated subpages...');
const adminRedirectRes = await fetch(`${baseUrl}/admin`, { redirect: 'manual' });
assert.strictEqual(adminRedirectRes.status, 302, 'GET /admin should redirect to /admin/models');
assert.ok(adminRedirectRes.headers.get('location')?.endsWith('/admin/models'));
const subpages = [
{ path: '/admin/models', marker: 'Configured Custom Models' },
{ path: '/admin/providers', marker: 'API Providers & Key Pools' },
{ path: '/admin/playground', marker: 'Revolver Playground' },
{ path: '/admin/telemetry', marker: 'Live Provider & Key Health' },
{ path: '/admin/live_logs', marker: 'Live Request Log Watcher' }
];
for (const sp of subpages) {
const spRes = await fetch(`${baseUrl}${sp.path}`);
assert.strictEqual(spRes.status, 200, `Subpage ${sp.path} should return 200`);
const spHtml = await spRes.text();
assert.ok(spHtml.includes('GeminiRevolver — Admin Console'), `${sp.path} should render Admin Console layout`);
assert.ok(spHtml.includes('auth-gate-section'), `${sp.path} should include auth gate`);
assert.ok(spHtml.includes(sp.marker), `${sp.path} should include page marker '${sp.marker}'`);
}
// Verify Live Logs inspector tabs do NOT have the .tab-btn class collision
const liveLogsHtml = await (await fetch(`${baseUrl}/admin/live_logs`)).text();
assert.ok(liveLogsHtml.includes('class="insp-tab-btn active" data-insp-tab="insp-input"'), 'Inspector tabs must use isolated .insp-tab-btn class');
assert.ok(!liveLogsHtml.includes('tab-btn active insp-tab-btn'), 'Inspector tabs must not collide with .tab-btn');
console.log(' ✓ Admin root redirect and all 5 subpages (/admin/models, /admin/providers, /admin/playground, /admin/telemetry, /admin/live_logs) verified.');
// 2. Auth tests on /api/admin/verify
console.log('\n2. Testing /api/admin/verify authentication...');