The home page's "Sponsored by" cards and the READMEs' Sponsors logo linked
the sponsors directly, so nothing told the owner how many clicks each seat
brought. They now link /go/<id>/home and https://usemagpie.ai/go/<id>/readme.
site/sponsors.js holds where each sends the browser (the sponsor's own ref
link, unchanged: APINEBULA has one per place). The worker counts a GET as
"magpie sponsor go" {id, where, country} in PostHog, beside the in-app
partners' "magpie partner go" (whose /go links were already counted), and a
HEAD goes on uncounted. A partner's keys/site links are tried first; a
sponsor link takes no region.
A test fails if index.html or either README links a sponsor's own URL
directly, or names a /go link sponsors.js doesn't have.
Run: node --test site/worker.test.mjs (20 pass) and site/install.test.mjs
(10 pass). Broke it by hand: README.zh-CN.md back on the direct link turns
the guard red. Deployed (version e4f40cff); curl on usemagpie.ai:
/go/apinebula/readme → 302 apinebula.ai/ref/qmXqFGpr, /go/apinebula/home →
302 apinebula.ai/ref/Gs54HwyB, /go/yylx/home → 302 yylx.io/?ref=magpie,
/go/yylx/readme and /go/apinebula/home/x → 404; / and /zh/ serve the /go
hrefs. Not checked: the events arriving in PostHog (the worker's key can't
read).
A plugin's package.json icon, an import link's icon= and the library's
market icons sit on hosts their authors pick. magpie fetched each straight
from there, so an author could log the IP of everyone who opened Discover
or the library. The owner asked for icons to keep showing without that.
- site/worker.js: /api/icon?url=<https URL> fetches the picture from
Cloudflare with only Accept: image/* and its own User-Agent, follows
redirects, caps it at 1 MB (the app's MaxIcon), passes on only PNG,
JPEG, GIF, WebP, ICO or SVG (by bytes, as StoreIcon), and counts and
keeps nothing. It refuses http, userinfo, a non-443 port and
usemagpie.ai itself; 404s are cached 5 minutes, 5xx not at all.
- internal/iconproxy: URL(u) is the proxied address (MAGPIE_ICON_PROXY
for tests); a picture already on usemagpie.ai is asked for as it is.
- provider.FetchIcon (plugin, import link and partner icons) and
library.fetchImage (market icons, avatars) fetch through it. The
import link's checks (https, public host) still come first; there is
no direct fallback. provider.FaviconFor still reads the user's own
provider's site directly: they already send it their requests.
- Privacy text in README en/zh, docs/reference.md and site docs
start/import in en/zh/ja says so.
Ran:
- node --test site/*.test.mjs: 28 pass. The new test asks with Cookie,
UA, X-Forwarded-For and CF-Connecting-IP and checks only accept and
user-agent go upstream; 415/413/502/400 cases; its fetch stub throws
instead of reaching the network. With the usemagpie.ai refusal
removed by hand it goes red (27/1).
- TestFetchIconGoesThroughTheProxy and TestIconGoesThroughTheProxy
(author host is .invalid; an httptest server stands in for the proxy):
with the proxy taken out by hand both go red (provider: lookup
author.invalid; library: the proxy was never asked), green restored.
- go test ./internal/iconproxy ./internal/provider ./internal/library
./internal/gui: ok. gofmt -l clean; go vet darwin (those four),
linux (iconproxy, provider, library), windows (all four): clean.
goTarget adds ref=magpie to the partner's key page or website, keeping the
address's own query and fragment; an address that names its own ref (a
referral code) keeps it as it is. The home page's sponsor card links to
yylx.io/?ref=magpie.
Run: node --test site/*.test.mjs (27 pass), with new cases for the query,
the fragment and a partner's own ref.
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.
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.
* Add German translation and harden paths against unset env vars
Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows.
* Makefile: know magpie's folder by its go.mod, so paths with spaces work
The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs.
* i18n: German for the strings main added since, with a parity test
75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system.
* appdir: ignore relative folder variables when reading, keep them for children
CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder.
* Sandbox the tests main added since
internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE.
* agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose
omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over.
* i18n: German for the Library's multi-select and System One's decision API
The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes.
* appdir: tidy the import into magpie's group; say what Go makes of /c/x
The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x.
The download button follows the visitor's OS, a platform list sits under
the final call to action, /download/{windows,linux}[-arm64] redirect to
the builds, and install.sh installs the Linux desktop app, with a menu
entry, when WebKitGTK 4.1 is present.
site/ is the website: a static page plus a worker that turns the newest
release of yetone/magpie-releases into an update feed (/api/latest, with
every file's SHA-256), stable download links and an install script.
The app asks the feed at start-up and every six hours, downloads a newer
version in the background, and installs it on Restart to Update or on
quit. A download must match its checksum and be signed by the same team
as the app it replaces. `magpie update` does the same from a terminal and
replaces a bare binary in place.