Commit Graph
1 Commits
Author SHA1 Message Date
yetone c55395df9e gui: a plugin install goes on when the proxy in front of magpie web gives up (#2032, precisionz)
precisionz installed Zed from magpie web on a phone; the page spun for a
while and then showed Cloudflare's own error page ("<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie…"). A tunnel or proxy in front of
magpie web stops waiting after its own limit (Cloudflare: 100 seconds,
then 524), closes the connection, and /api/plugins/{op} ran bun under the
request's context, so the install was cancelled halfway.

/api/plugins/{op} now runs under context.WithoutCancel(r.Context()) with
the same 5-minute cap, as moveContext already does for a move. add,
remove, update and upgrade go through test seams (addPlugin, ...).

Verified:
- TestPluginOpsOutliveRequest (new) cancels each request before serving
  it. With r.Context() put back it fails: "got [add: stopped with the
  page remove: stopped with the page update: stopped with the page
  upgrade: stopped with the page]". With the fix it passes.
- HOME=<temp> go test -tags nogui ./internal/gui/: ok (107s).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/gui/: clean.
Not tried: a real Cloudflare tunnel in front of magpie web.
2026-10-14 04:22:19 +08:00