Skip to content

feat: co-branding links, starting with the T4P member name tag - #185

Merged
mostafazh merged 1 commit into
mainfrom
mostafazh/members-banner
Oct 21, 2026
Merged

mostafazh merged 1 commit into
mainfrom
mostafazh/members-banner

Conversation

@mostafazh

@mostafazh mostafazh commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds co-branding links to PPM. The first one is the membership-launch "Hello, I'm a T4P member" name tag (design #8 from the Mattermost vote).

A link like ppm.techforpalestine.org/?b=<code> turns a co-branded overlay on by default, and people can still switch it off. Without a valid code the page is unchanged.

Which code unlocks which brand, and the brand's text, live only in the BRAND_LINKS secret, never in the repo:

{ "<code>": { "brand": "t4p-member", "text": { "link": "join at t4p.al/j" } } }
  • text is optional and overrides the brand's defaults key by key (label, hint and whatever the overlay draws), so changing the wording takes no code change. Edit the secret, then retry the deployment.
  • To end a campaign, remove its code from the secret. Old links then fall back to the plain frame.
  • A new brand is one overlay component plus one BRANDS entry in src/app/brands.tsx.

Changes

  • src/lib/brands.ts: resolveBrand parses the secret. It accepts only known codes (no inherited keys), keeps short strings only, and turns co-branding off if the secret is broken.
  • src/app/api/brand/route.ts: GET /api/brand?code=, rate limited to 20 per minute per IP and never cached.
  • src/app/brands.tsx: the overlay registry with default text.
  • src/app/member-tag.tsx: the name tag overlay. The handwritten "T4P member" is outlined path data in member-tag-marker.ts, because html-to-image dropped the web font and fell back to serif in the downloaded PNG.
  • page.tsx / share-panel.tsx: the overlay is chosen once and mirrored onto the story card. The co-brand replaces the ppm.t4p.al ring label, since both use the ring's bottom arc.
  • Analytics: Downloaded gains a cobrand prop, either the brand id or off.

Config

  • BRAND_LINKS is set as a secret for Production and Preview, as {"t4p-members":{"brand":"t4p-member"}}.
  • To try it, open the preview deployment with ?b=t4p-members.

Before going live

  • The t4p.al/j redirect to the membership page exists. An IT request is filed. The frame prints "join at t4p.al/j"; if IT picks another path, change it with text.link in the secret.

Verification

  • tsc --noEmit: clean. eslint: 0 errors, with 2 existing <img> warnings.
  • vitest: 164/164 pass, including the new brands.test.ts.
  • Playwright branding, generate-pfp and start-over specs: 30/30 pass on chromium, firefox and webkit. They check that the sticker and link are in the downloaded PNG, that the tag is on by default and can be switched off, that the secret's text override works, and that nothing is offered without a valid code.

A link like ?b=<code> turns on a co-branded overlay by default; people can
still switch it off. Which code unlocks which brand, and the brand's text,
live in the BRAND_LINKS secret, never in the repo, so a campaign is started,
reworded or ended from the Cloudflare dashboard.

The first brand is the membership-launch "Hello, I'm a T4P member" sticker
with a join link along the ring.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying palestine-pfp-maker with  Cloudflare Pages  Cloudflare Pages

Latest commit: c98ccd3
Status: ✅  Deploy successful!
Preview URL: https://b73b72e5.palestine-pfp-maker.pages.dev
Branch Preview URL: https://mostafazh-members-banner.palestine-pfp-maker.pages.dev

View logs

@mostafazh
mostafazh merged commit c469a64 into main Oct 21, 2026
11 of 12 checks passed
@mostafazh
mostafazh deleted the mostafazh/members-banner branch October 21, 2026 21:31
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