Spaces:
Paused
Paused
Commit History
-
feat: dashboard login gate for public deployments (#148)
icebear +1: icebear0828Unverified signature* feat: dashboard login gate for public deployments (#141) Cookie-based session auth when proxy_api_key is set and request is non-localhost. API routes (/v1/*) unaffected, Electron (localhost) auto-bypassed. - In-memory session store with TTL from session.ttl_minutes config - Dashboard auth middleware with path-based allowlist - Login/logout/status endpoints with per-IP brute-force protection - HTTPS auto-detection: Secure flag on cookie when X-Forwarded-Proto: https - Remote session cannot clear proxy_api_key (prevents disabling login gate) - Frontend LoginGate component with i18n (en/zh), conditional logout button * fix: dashboard login security hardening - Timing-safe password comparison (crypto.timingSafeEqual) - Rate limiter cleanup of expired entries to prevent memory leak - Extract shared parseSessionCookie to src/utils/parse-cookie.ts - Remove silent password.trim() that could cause subtle mismatches - Logout button visible on mobile (icon-only on small screens) - Fix fragi…91ee702 -
feat: usage stats page with time-series token tracking (#147)
icebear +1: icebear0828Unverified signature* feat: usage stats page with time-series token tracking - Background snapshot recording (piggybacks on quota refresh, ~5min interval) - UsageStatsStore: JSON persistence, 7-day retention, delta computation - GET /admin/usage-stats/summary — live cumulative totals - GET /admin/usage-stats/history — time-series deltas with hourly/daily granularity - Pure SVG line charts (input/output tokens + request count) - Granularity (hourly/daily) and range (24h/3d/7d) selectors - 13 backend tests (snapshot, delta, aggregation, retention, API routes) - i18n: en + zh * fix: usage stats review fixes — chart coords, refresh, cleanup --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>df56b50 -
feat: account management page with batch operations (#146)
icebear +1: icebear0828Unverified signature* fix: treat unfetched plan types as possibly compatible in acquire() When model-fetcher fails to fetch models for a plan type (e.g. the selected free account had an expired token), _planModelMap only contains successfully fetched plans. acquire() then excludes all accounts whose planType is absent from the map — even though their compatibility is unknown, not negative. Add isPlanFetched() to model-store and use it in acquire() to distinguish "plan was fetched and model is absent" (exclude) from "plan was never fetched" (include as possibly compatible). This prevents false 503s when a plan's model fetch failed at startup. * feat: account management page with batch operations Add #/account-management page for bulk account management: - POST /auth/accounts/batch-delete and batch-status endpoints - Batch delete, set active, set disabled with confirmation - Status summary chips (clickable to filter) - Reuse AccountTable with optional proxy column - Import/export accessible from new pag…7516302 -
feat: detect banned accounts and show status in dashboard (#142)
icebear +1: icebear0828Unverified signature* feat: detect banned accounts and show status in dashboard When upstream returns non-Cloudflare 403, the account is now marked as "banned" instead of silently failing quota fetches with no UI feedback. - Add "banned" to AccountStatus type - usage-refresher: detect 403 ban during quota fetch, auto-recover on success - proxy-handler: detect 403 ban during requests, fallback to next account - Dashboard: rose-colored "Banned"/"已封禁" badge in card/table views - Status filter dropdown includes "Banned" option - acquire() naturally skips banned (status !== "active") * feat: handle 401 token invalidation with auto-retry Previously 401 "token has been invalidated" was passed through to the client without marking the account or trying alternatives. - proxy-handler: 401 → markStatus("expired") + try next account - usage-refresher: 401 → markStatus("expired") during quota fetch - Refresh scheduler will attempt token renewal for expired accounts --------- Co-authored-by: icebear0828 <icebear…ba262d0
-
fix: add missing userId field to test fixtures (#128)
icebear +1: icebear0828Unverified signatureTwo test helper functions (account-persistence, rotation-strategy) were missing the required userId field added in #127. Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>b72575f -
fix: allow multiple team accounts sharing same chatgpt_account_id (#126) (#127)
icebear +1: icebear0828Unverified signatureTeam members share chatgpt_account_id but have distinct chatgpt_user_id. Change dedup key from accountId alone to accountId + userId composite, so each team member gets their own entry in the pool. - Add userId field to AccountEntry/AccountInfo types - Dedup by (accountId, userId) in addAccount() - Backfill userId from JWT on persistence load - 5 new tests for team dedup scenarios Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>7e5ecc4
-
fix: prevent quota-exhausted accounts from cycling back to active (#115)
icebear0828Accounts that hit their quota limit were cycling between rate_limited and active status every 60s, causing requests to be routed to exhausted accounts repeatedly. Root cause: markQuotaExhausted() only worked on "active" accounts, and the quota refresher only checked "active" accounts. Since 429 backoff (60s) recovered accounts to "active" before the 5-min quota refresh could mark them exhausted with the real reset time, neither mechanism could break the cycle. Fix: - markQuotaExhausted() now works on rate_limited accounts (only extends, never shortens rate_limit_until) - Quota refresher now includes rate_limited accounts in its fetch cycle261b199
-
refactor: decouple AccountPool, split codex-api and web.ts, fix CI (#113)
icebear +1: icebear0828Unverified signature* refactor: decouple AccountPool, split codex-api and web.ts, fix CI Phase 0 — CI fixes: - Fix TS2322: WS transport instructions type mismatch (Electron/Docker build) - Remove duplicate selectAll i18n keys (Vite warning) - Add rebase retry to sync-changelog.yml push step (race with bump-electron) Phase 1-5 — Architecture improvements: - Extract codex-types.ts: API type definitions separated from class - Extract rotation-strategy.ts: pure-function selection logic (10 tests) - Split web.ts (605 LOC) into routes/admin/ (health/update/connection/settings) - Extract account-persistence.ts: injectable fs persistence interface (8 tests) - Split codex-api.ts into codex-sse/usage/models modules (10 tests) All existing import paths preserved via re-exports. 902 tests pass (70 files), build clean. * fix: address PR #113 review issues before merge - Fix needsPersist regression: load() now returns { entries, needsPersist } and auto-persists when backfill is applied (restores original behavio…0c8b3c0 -
feat: add sticky rotation strategy (#107) (#110)
icebear +1: icebear0828Unverified signature* feat: add sticky rotation strategy with admin UI (#107) Keep using the same account until rate-limited or quota exhausted, instead of rotating across multiple accounts. - Add "sticky" to rotation_strategy config enum - Implement sticky sort in selectByStrategy() (last_used desc) - Add GET/POST /admin/rotation-settings endpoints - Add RotationSettings component (sticky vs rotation radio group) - Add i18n translations (en + zh) - 13 new tests (account-pool-sticky + rotation-settings routes) * refactor: extract ROTATION_STRATEGIES constant to eliminate hardcoded duplication Single source of truth for valid rotation strategies — route handler and Zod schema both reference the exported constant. --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>d0eeb87 -
test: add plan-based model routing tests (14 cases)
icebear0828- model-store: plan map build, reverse index, plan updates, non-Codex slug filtering, gpt-oss admission, store debug output - account-pool: plan-matched acquire, team-only rejection, fallback on empty plans, plan map update re-routing, preference ordering Covers the exact code path where free accounts get blocked from models that the backend has since opened to free tier (gpt-5.4 case).9c1c54e
-
feat: auto-refresh quota with tiered warnings (#92) (#93)
icebear +1: icebear0828Unverified signatureBackground quota refresher fetches official usage every 5min (configurable), caches on AccountEntry for instant dashboard reads, and marks exhausted accounts as rate_limited. Tiered warning thresholds (default 80%/90%) trigger visual banners in the dashboard. Frontend auto-polls every 30s. Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>4f2665c
-
feat: display secondary rate limit window (weekly cap) in dashboard
icebear0828 +1: Claude Opus 4.6Add secondary_rate_limit to CodexQuota type and map secondary_window from Codex usage API. Dashboard now shows both primary (hourly) and secondary (weekly) quota bars with independent progress and reset times. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2996fd8
-
feat: OpenCode platform support, vitest tests, changelog & Docker hardening
icebear0828 +1: Claude Opus 4.6- Add opencode.json provider config for OpenCode IDE integration - Add CHANGELOG.md covering all versions (v0.1.0–v0.8.0) - Add vitest with unit tests for account-pool, codex-api, codex-event-extractor - Add request-id middleware to global middleware chain - Harden Dockerfile: non-root user, HEALTHCHECK probe - Simplify /health endpoint to return pool summary only Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>92c5df7