Feature: paid posts slice 2, post model + teaser gate
A post can be marked paid (klonkt-demo-aki), premium-gated in the
editor with an optional per-post price; additive columns posts.paid +
paid_min_cents. On the web, a paid post shows only a teaser to anyone
who is not the owner/editor (new pages/paid-gate, mirroring the
fan-gate); the owner previews the full post. The passkey unlock arrives
in slices 3-4, so the gate says so for now.
Federation is leak-safe: buildNote federates only a PUBLIC teaser (the
excerpt, else the first paragraph, never later content) plus a
"read the full post (supporters)" link back, and no media attachments.
A short paid post can no longer spill its body: the teaser is the first
paragraph only, pinned by a test.
Changed files:
src/config/database.js
- additive columns posts.paid, posts.paid_min_cents
src/routes/posts.js
- create/update read paid + price (premium-gated), store them, pass
to deliverCreate/Update; paidTeaser helper; the paid web gate
src/services/ActivityPubService.js
- buildNote: paid post -> public teaser + link, first paragraph only
src/views/pages/post-edit.ejs
- paid toggle + price field (in the premium block)
New file:
src/views/pages/paid-gate.ejs
- teaser + supporters notice
test/paid-federation.test.js
- teaser + link, no full content, excerpt-as-teaser, non-paid intact
-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>