hoobnn on Discord #general: a custom provider's icon given by an image
URL was neither fetched nor applied, and on editing it again the URL
was gone.
Cause: the Image URL… box (1dc22a37c) sent its address with Enter only.
An address typed and then saved, or left by clicking elsewhere, was
never fetched, so Save sent the old icon ("generic"). And nothing kept
the address: the box went away after a fetch that worked, and the
provider had no field for it, so a reopened editor showed none.
Now:
- The box has a Use button (an existing string, in every language), and
leaving it fetches too. Save fetches an address typed and not fetched
yet, then saves with the picture; one that can't be used keeps the
editor open with the note why, and saves nothing.
- Provider.IconFrom (iconFrom) records the address the uploaded picture
came from. /api/providers gives it back, the editor opens with it in
its box, a save that doesn't name the icon (CLI, TUI) keeps both, and
provider.Save drops it when Icon isn't an uploaded picture (a built-in,
Default, the letters, a chosen file or the site's icon clear it in the
editor too). It is a record only, never fetched again.
- The fetch itself is unchanged: POST /api/icons/url through
guardClient (public addresses only), https only, MaxIcon 1 MB, type
sniffed. Remote images are never loaded by the page itself.
Siblings: iconPicker is the only editor with an icon address; the
import link's iconUrl is fetched on confirm (fetchImportIcon) and stays
import-only.
Core script budget: this adds ~1KB to app.js; it fits the unchanged
1,533,105 (now 1,532,840) by cutting four long comments in app.js
(text-cut tooltips, rowOwnRect, modalHold, modalDepth) to two lines
each. No raise.
Run at this tree (based on origin/main 0516c18ca), on mote:
- GUI: icon-url-saved.test.cjs (new) and icon-url.test.cjs, Chromium and
WebKit, 420 and 1100 wide, en/zh/zh-TW/ja/de: 40 of 40 ok (the
existing test now expects the box to stay with the working address).
- Broken by hand: Save's flush removed -> icon-url-saved red in
Chromium ("Save didn't send the fetched picture", actual 'generic',
hoobnn's case); draftOf without iconFrom -> red in WebKit (the box
with the address never shows on reopening).
- go test ./internal/gui ./internal/provider: provider ok; gui ok but
for three reds that fail the same on a fresh origin/main 586b59fe7
copy, each already filed: TestSettingsSaveKeepsWhatItDoesNotSend
(BusyLoad, #4739), TestMainWindowCorners/macOS_26_SDK (#3949) and
TestColdTurnsTaken in the full package run (#4510; it passes alone
on main). TestCoreScriptBudget ok.
TestProviderSaveKeepsIconFrom (new) red with the save merge's IconFrom
keep removed ("a save without the icon lost it"), green restored.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./...; go build, linux nogui and windows
builds: ok.
Not yet at push (the owner's ship-at-once rule): the whole GUI suite
(mote was busy with another session's full GUI run) and the full Go
suite (running on the Linux box); both run after the push, and any red
they show is fixed or filed in its own commit.
Not tried: a real image URL against the real backend in the app; the
fetch path is unchanged from 1dc22a37c, which was.