Repository navigation
Tip links: Patreon, Ko-fi and the like on people and products - #62
Merged
Merged
Conversation
A person adds tip links in Settings, a crew adds a product's in Edit details, and each shows as a row of buttons: on /@handle, and in the product's header card. The platform is read from the address, never typed, so a "Patreon" button can only lead to patreon.com: Patreon, Ko-fi, Buy Me a Coffee, GitHub Sponsors, Open Collective, Liberapay and PayPal.me, one each, plus one other https address, which shows its own host. - migration 2330: contributors.tip_links and profiles.tip_links (JSONB, empty by default) - contracts: tip-links.ts (platforms, parseTipLinks, tipLinksOf); PublicContributor, PublicProfile and the catalog API (1.8.0) carry tipLinks; disclosure lines for both - core: PUT /me and the profile PATCH take tipLinks, replaced whole; every read re-checks stored rows by today's rules - web: a Tip links box in Settings and in Edit details; the TipLinks buttons (new tab, rel noopener noreferrer nofollow ugc) - tests: parser, both writes, the public projection, a live-pg round trip, and the forms Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
People and products can show where to support them.
/@handleunder the other links.Each link is a soft pill with a heart and a name. It opens in a new tab with
rel="noopener noreferrer nofollow ugc".The rule: the platform comes from the address
The owner chose "known platforms plus one other". You paste addresses, one per line, and the platform is read from the host, never typed. A "Patreon" button can therefore only lead to patreon.com, the same reasoning as
githubUrl's github.com allowlist.patreon.com/…ko-fi.com/…buymeacoffee.com/…github.com/sponsors/…onlyopencollective.com/…liberapay.com/…paypal.me/…, orpaypal.com/paypalme/…and/donatepatreon.com.evil.example) and other GitHub or PayPal pages count as "other" and show their real host.tipLinksOf, so a row can never show a platform name its address doesn't earn.Changes
contributors.tip_linksandprofiles.tip_links, JSONB,[]by default. Additive and idempotent.tip-links.ts.tipLinksis added toPublicContributor/PUBLIC_CONTRIBUTOR_KEYS,PublicProfile/PUBLIC_PROFILE_KEYS,MaintainerProfile,UpdateProfileRequest,ContributorProfileandCatalogProduct/CATALOG_PRODUCT_KEYS. Catalog API 1.8.0, with a changelog entry and an OpenAPI description. Disclosure lines are added for both.PUT /meand the profilePATCHtaketipLinks(addresses), replaced whole. Leaving it out keeps the links and[]clears them; a bad list returns 422 with the parser's sentence. The maintainer, public and catalog projections carry the links.ui/tip-links.tsx, the Settings box, the Studio Edit details box and the actions route (sent only when the box is on the form), plus the people and product pages.Not in this PR
The MCP tools (
update_my_profile,update_listing) don't taketipLinksyet. Agents can read the links through the catalog API but can't write them.Tests
packages/contracts/src/tip-links.test.ts: platforms, look-alikes, every refusal, the form text round trip, and the stored-row re-check.packages/db/src/pg/tip-links.test.ts(real Postgres): both columns are written, kept by a write that doesn't name them, cleared, and read by the public contributor read.tests/core/src/tip-links.test.tsandproduct-posts.test.ts: both writes, including what gets refused.contributor-profile.test.tschecks that a stored "patreon" row on another host is projected asother.tests/web/src/tip-links.test.ts: forms, buttons and the save plan.Security (OWASP)
javascript:is refused), rendered as Reacthreftext, and the stored JSON is re-validated on every read.noopener noreferrer, plusnofollow ugcbecause strangers write them. Nothing on openproduct is paid for or ranked through them.🤖 Generated with Claude Code