usrname1833 on Discord: many sites serve no {HOST}/favicon.ico, so a custom
provider's icon came out wrong or missing, with no way to give it one.
The provider editor's icon row now has Get icon, a pull-down that opens the
app's own menu (no native select) headed Icon:
- Automatic: the site's icon from the base URL, as before.
- Image URL…: a url box under the row, focused; Enter fetches the address,
Escape puts it away and gives focus back to Get icon.
- Letter icon: the name's first letters on a coloured tile (letterIcon).
POST /api/icons/url (provider.IconFromURL) fetches the typed address the way
a favicon is fetched: guardClient (public addresses only), iconURL (https,
public host, no userinfo), fetchIcon's 15s timeout, MaxIcon 1 MB and the
type sniffed to PNG/JPEG/GIF/WebP/ICO/SVG. An address that can't be used
gives the letter tile with a warn note saying why, and the box stays for
another try. The old From the website button and its two strings are gone;
eight new strings in zh, zh-TW, ja and de. app.js +1,484 bytes to
1,309,847 (budget 1,316,874), core 1,534,839 (1,539,856); no budget raised.
Run at this tree (rebased on origin/main e484b1e93), on mote:
- gofmt -l clean; go vet ./internal/provider ./internal/gui on darwin,
linux (nogui) and windows; go build ./..., linux nogui and windows builds.
- go test ./internal/provider: ok (TestIconFromURL new: a PNG kept; HTML,
404, over 1 MB and a stalled server each give the letters with why; http,
loopback, localhost and userinfo addresses refused; an empty name takes
the base's site label).
- go test -run "Budget|Icon|Favicon|Provider|Settings" ./internal/gui:
TestCoreScriptBudget ok; TestSettingsSaveKeepsWhatItDoesNotSend red, the
same at a clean e484b1e93 (#4514).
- node --test icon-url (new), models-add-and-icons, i18n-keys: 27 of 28.
icon-url is Chromium and WebKit x 420 and 1100 x en, zh, zh-TW, ja, de,
20 of 20 (menu, posted bodies, warn note, Escape focus, no scroll, no
spill at 420, Save sends the icon). The one red is i18n-keys' "Unmarked"
in plugins/routing, the same at a clean e484b1e93 (#4524).
Screenshots of the menu and the warn note checked in both engines.
Broken by hand: no letter fallback on a failed fetch -> TestIconFromURL red
('"" isn't stored'); the exported path skipping iconURL -> red for all four
refused addresses; icon-url.test.cjs on main's app.js and i18n.js -> 0 of
10 in Chromium (no Get icon).
Not tried: a real image address on a live site from the built app, and the
whole GUI suite (mote was running another session's full suite).