Files
magpie/site/partners.js
T
yetone 34f2078db8 site: a partner's website and key links go through usemagpie.ai/go, which counts the click; fetches of the partner list are counted too
The app's own partner counts only come from users who leave the stats on,
so a sponsor's reach and clicks are now also counted where the server sees
them. /api/partners hands out each partner's website and keysUrl (and a
region's) as usemagpie.ai/go/<id>/site|keys[/<region>]; /go sends a
"magpie partner go" event to PostHog (partner, link, region, country) and
302s to partners.js's own URL. One in ten list fetches sends "magpie
partners fetch" with weight 10 while someone is listed. Events carry a
random id each, no install id or address. Ended entries leave the list but
/go still resolves them, since added providers keep the links. Privacy text
updated in README (en, zh), docs/reference.md and the site docs (en, zh, ja).

Run: node --test site/*.test.mjs (27 pass); a scratch copy with a fake
partner served rewritten links, 302'd /go to the real URLs and posted both
events; PostHog's /i/v0/e/ answered 200 to the payload shape.
2026-10-10 13:48:26 +08:00

36 lines
2.0 KiB
JavaScript

// The add sheet's Partners: the services that pay to be listed first in
// magpie's "Add provider" sheet, under a heading that says they sponsor
// magpie. The app fetches this list from /api/partners every six hours and
// keeps it (internal/provider/partners.go), so a change here reaches users
// with `npx wrangler deploy`, no release. At most 12 whose term hasn't
// ended are listed, in this order.
//
// An entry is a preset (internal/provider/presets.go) and a few fields more:
//
// id a-z, 0-9 and "-", 2-41 characters; never a built-in preset's
// id. It is kept in the providers users add from it: don't
// change it, and don't give it to someone else later.
// name the row's name; short a shorter one, when name is long
// chat OpenAI chat completions base URL (…/v1)
// responses OpenAI Responses base URL; anthropic Anthropic messages base URL
// (at least one of the three, or regions)
// regions [{id, name, chat, responses, anthropic, keysUrl, website}]: the
// first is the default
// keysUrl where the user makes a key (a referral link is fine)
// website the service's home page
// iconUrl its logo (png, svg, webp, jpeg; square), fetched and kept by
// each app
// notes the tagline by language: {en, zh, "zh-TW", ja, de}; en stands
// in for a language without one
// langs the app languages it is listed in (["zh"]); none is all
// from, until RFC 3339 times bounding when it is listed (the paid term)
//
// Every URL is https. An entry that breaks a rule is left out by the app.
//
// The app gets keysUrl and website (a region's too) as usemagpie.ai/go/…
// links, which count the click and send the browser on (worker.js). The
// providers users add keep those links, so an entry stays here after its
// term ends: /api/partners leaves it out, /go still finds it. Remove one
// only when nobody can still be using it.
export const PARTNERS = [];