Skip to content

feat(ops): a static page that asks the worker once for its numbers - #96

Merged
LeslieOA merged 2 commits into
developfrom
feat/ops-static
Nov 23, 2026
Merged

LeslieOA merged 2 commits into
developfrom
feat/ops-static

Conversation

@LeslieOA

Copy link
Copy Markdown
Member

The operations page is now a static asset, served without running the worker.

  • The worker is a single JSON endpoint, /api/usage, behind the same Cloudflare Access check. It answers with the month so far, the last seven days and the relay's kept totals, which is enough for every view. The browser reuses that answer for five minutes.
  • The period and plan toggles are buttons that redraw in the browser from that answer. There is no reload and no new analytics query.
  • A sign-in that has expired shows a message with a reload link instead of a broken page.
  • npm run build inlines the browser code into dist/index.html, and wrangler.toml serves dist as assets, with /api/* going to the worker.

Tests: 14 pass in packages/ops. The page was also checked in headless Firefox against a stand-in API: switching the period and the plan made no second request.

🤖 Generated with Claude Code

LeslieOA and others added 2 commits November 23, 2026 10:36
The page is now a static asset, served without running the worker. The worker
answers one JSON request, /api/usage, with the month so far and the last seven
days, which the browser keeps for five minutes. Switching the period or the
plan redraws in the browser from that answer, with no reload and no new
request to Cloudflare's analytics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssets

Deployed with `wrangler deploy`, the page is a static asset and the worker sees
only /api/usage. Deployed from the bundle alone, src/entry.ts serves the same
page, which the browser keeps for an hour. compatibility_date moves above
[assets], where it was being read as an assets setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LeslieOA
LeslieOA merged commit 0f8c3c8 into develop Nov 23, 2026
2 checks passed
@LeslieOA
LeslieOA deleted the feat/ops-static branch November 23, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant