The app fetches the list behind the call every 6 hours (10 minutes after a failure), never waiting, and keeps it in the cache folder. Each entry is checked: its own id, never a built-in preset's; a name and an endpoint; https only; at most 12; no decision API, no-key or user endpoint. Its logo goes through FetchIcon. A partner is a preset to the rest of magpie, and one that has left still is to the providers added from it, unsponsored. The window lists a partner in the languages it names only, with its tagline in the page's language; `magpie presets` and the TUI list them first too. MAGPIE_PARTNERS moves the list, off lists none. Run: go test -tags nogui -race ./internal/provider ./internal/gui ./internal/tui . (ok); TestPartners* -race -count=3; node --test internal/gui/tests/partners.test.cjs add-sheet gui-ja gui-de i18n-keys in Chromium and WebKit (en/zh/ja/de, 900 and 440px); node --test site/worker.test.mjs site/install.test.mjs; the built binary in a sandbox HOME against a local feed: listed, an http entry left out, listed from the cache with the site down, `provider add` from it.
30 lines
1.6 KiB
JavaScript
30 lines
1.6 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 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.
|
|
export const PARTNERS = [];
|