Skip to content

Hosted: the website's checkout switch and the public founders row - #1408

Merged
nedtwigg merged 3 commits into
mainfrom
hosted-billing-launch
Oct 29, 2026
Merged

nedtwigg merged 3 commits into
mainfrom
hosted-billing-launch

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Billing PR 4a, stacked on #1407. Billing stays closed: CHECKOUT_OPEN is false and no STRIPE_* bindings are set.

  • Checkout switch: while CHECKOUT_OPEN is false, the buy buttons keep today's notice. Once true, they link to the account app's /checkout?plan= carrying the visit's ref, the hosted plan clicked event still fires, and the JSON-LD offers change from PreOrder to InStock. Tier annual is renamed yearly to match the server's plan names.
  • Public founders row (hosted/server/cohort-routes.ts):
    • GET /api/hosted/cohorts returns {cohort?, seatsLeft?, founders: {total, shown}}. total counts founding purchases net of refunds. shown holds at most 40 founders who opted in and whose founding subscription still holds, ordered by shownSince. Answers are cached 60 s per isolate, and the route cannot read a login.
    • The page shows seats only for the cohort it prerendered, so a stale deploy never shows wrong seats.
    • GET /api/hosted/founders/<sha256 token> serves founder avatars server-side, so a visitor's browser never asks a sign-in provider for them. It fetches only https URLs on the GitHub or Google picture hosts, or raster data: URLs (Microsoft stores those). It never follows a redirect, caps the size at 256 KiB, and serves only PNG, JPEG, GIF or WebP, judged by the file's leading bytes.
  • Same-origin: the site's Pages Worker (_worker.js and _routes.json, from Website: cookieless PostHog visit counts #1401) now also forwards GET and HEAD under dormouse.sh/api/hosted/* to https://hosted.dormouse.sh. It drops cookies, credentials, the reader's address and the query string, and passes back only content type, length and caching headers. The proxy fetches the account's own origin, so the 421 gate (S77) needs no exception.
    • Not verified: that a Pages Worker can fetch a Custom-Domain Worker in the same zone. Cloudflare documents that it can, but it hasn't been tested live.
  • Specs: pricing.md, hosted.md, website-docs.md, the audit prompt, and FAIL IF S288 in security-hosted.md. Privacy now says the founder picture is fetched from the provider, and only shown if the provider supplied one.

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1dd5292
Status:⚡️  Build in progress...

View logs

nedtwigg and others added 3 commits October 28, 2026 17:06
…red cohort

CHECKOUT_OPEN (committed false) turns the buy buttons into links to the
account app's /checkout?plan=, carrying the visit's ref, and the JSON-LD
offers from PreOrder to InStock. The yearly tier's id is now "yearly",
the plan name checkout and billing use. The founding card drops seats
left unless the endpoint's cohort is the one whose price it prerendered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /api/hosted/cohorts on the account Worker answers the open cohort,
its seats left, and the founders row (opted-in founders whose founding
subscription still holds, by shownSince, at most 40), cached 60 s per
isolate and resolving no login. Each shown founder's picture is served
under a token at /api/hosted/founders/, fetched only from a provider's
picture host or a raster data URL, never through a redirect, and checked
as PNG, JPEG, GIF, or WebP by its bytes.

The site's Pages Worker forwards GET and HEAD under /api/hosted/ to the
account's own origin with nothing of the reader's, so the 421 gate needs
no exception.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pricing.md moves the cohort endpoint above the fold, states the switch
(PreOrder/InStock, the buy button's two states) and the seats-only-for-
the-prerendered-cohort rule; opening checkout is now the Stripe bindings
then CHECKOUT_OPEN. hosted.md adds the two public routes and the forward
from dormouse.sh; website-docs.md widens the site Worker to /api/hosted/*.
security-hosted.md adds FAIL IF S288 (next is 289) and the audit prompt
reads the site's Worker. Privacy says the picture is fetched from the
provider, and only when it supplied one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nedtwigg
nedtwigg force-pushed the hosted-billing-launch branch from 359bc3c to 1dd5292 Compare October 29, 2026 00:06
@nedtwigg
nedtwigg merged commit d3a53fa into main Oct 29, 2026
8 of 10 checks passed
@nedtwigg
nedtwigg deleted the hosted-billing-launch branch October 29, 2026 00:06
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.

2 participants