Repository navigation
feat(site): buy + gated downloads for Terraphim Proxy - #48
Merged
Merged
Conversation
- _index.md: Buy — $15 button in 'Your keys, your costs' wired to the Terraphim Skills checkout endpoint, sign-in fallback, ghost button to the downloads page, caption linking the refund policy - download.md: releases table from the public catalogue API, Bearer-gated artefact downloads with 402 purchase_required handling, X-SHA256 verification display, ?checkout=success banner, graceful API failure - proxy-buy.js / proxy-download.js: static scripts for both flows - privacy.md: direct-download purchases paragraph (Stripe via api.terraphim-skills.md; marketplace stores email, purchase and download records for entitlement/refund adjudication); 'no data whatsoever' claim scoped explicitly to the application Refs terraphim/terraphim-llm-proxy#508
… policy, JS tests
F1: sign-in links now carry ?return_to=<absolute current page URL> so the
OAuth callback lands back on this origin with the JWT in the fragment;
both page scripts capture #token=<jwt> (and ?token= for forward-compat)
into localStorage and history.replaceState it out of the address bar.
F3: the ?checkout=success banner only reads 'purchase confirmed' when a
token is present; signed-out visitors see neutral 'checkout completed —
sign in' wording — the parameter is trivially forgeable.
F4/F5: refund policy — short version now matches the table (14 days +
no download), both CONFIRM placeholders resolved ('effective upon launch
of direct-download sales', '3 business days'), and 'downloaded' is
defined as when our service first serves a release download request —
failed/interrupted delivery does not count, ambiguous cases resolved in
the customer's favour, cross-referenced from the table.
F6: pure helpers extracted to static/js/proxy-helpers.js (UMD-style —
window.ProxyHelpers in the browser, module.exports under node) with
node:test coverage in tests/js/proxy-helpers.test.js: escaping of
script/attribute payloads, wrapped vs unwrapped release shapes, URL
encoding, humanSize/fmtDate edge cases, token-in-location parsing and
hash stripping. 15 tests, 0 deps, no mocks.
Refs terraphim/terraphim-llm-proxy#508
Contributor
Author
Structural review (pi-rust / gpt-5.6-sol via structural-pr-review)Confidence: 4/5 — approved after fixes. Round 1 returned 6 findings; all verified against the diff and resolved in Round 1 findings → resolution
Verified locally
Important files changed
Last reviewed commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the terraphim.ai side of the Terraphim Proxy purchase flow, coded against the marketplace API contract being built on root/terraphim-skills-server issues #16/#17 (no live API calls in this PR).
/terraphim-llm-proxy/. On click it readsterraphim_tokenfrom localStorage; absent → sign-in link toapi.terraphim-skills.md/auth/oauth/github; present →GET /api/billing/checkout?product=terraphim-proxywith the Bearer token and redirects to the returned Stripe URL. 401 → sign-in prompt; other failures → 'checkout unavailable' message. Includes a One-time purchase · macOS caption linking the refund policy, plus a ghost Downloads button and a Downloads entry in the Links list./terraphim-llm-proxy/download/(weight after refunds,page.html). Shows a 'purchase confirmed' banner on?checkout=success, renders the public release catalogue (GET /api/products/terraphim-proxy/releases, tolerating both array and{releases:[...]}shapes) as a table of version / asset / released / size / truncated SHA-256 (full hash intitle) / action. Download buttons fetch/releases/{version}/{asset}with the Bearer token; 402 → 'purchase required' callout linking back to the buy section; success → blob saved via a hidden anchor and the responseX-SHA256displayed forshasum -a 256verification. Signed-out visitors see a sign-in prompt in place of the download actions; an unreachable API leaves a 'releases unavailable' note rather than a blank page.api.terraphim-skills.md), which stores the account email, the purchase, and which releases were downloaded, used solely for entitlement and refund adjudication. The 'no data whatsoever' claim is scoped explicitly to the application itself. Effective date bumped to 24 October 2026.static/js/proxy-buy.jsandstatic/js/proxy-download.js(Zola's markdown breaks inline<script>blocks at blank lines); page-scoped styles ride inline in the markdown, reusing.btn,.prose tableand the theme's OKLCH variables.Note: the branch also picks up the previously-unpushed
9530641 docs(proxy): refund policy for direct-download purchasescommit that was already on local main — the buy button links to it, so it travels together.zola buildclean (55 pages, 0 errors).Refs https://git.terraphim.cloud/terraphim/terraphim-llm-proxy/issues/508