Skip to content

Load notification app icons through the dashboard host - #12

Merged
fdussert merged 3 commits into
fdussert:mainfrom
FlorianBruniaux:codex/notification-app-icons
Oct 15, 2026
Merged

fdussert merged 3 commits into
fdussert:mainfrom
FlorianBruniaux:codex/notification-app-icons

Conversation

@FlorianBruniaux

@FlorianBruniaux FlorianBruniaux commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Notification and Shortcut widgets in opaque sandbox frames could not load local application icons directly. Both now ask the trusted dashboard host for a validated bundle ID and a PNG icon. The bridge requires the existing dock subscription; widgets keep their glyph fallback and retry when an icon is temporarily unavailable. A detached Shortcut button stops retrying.

French and English messages distinguish a missing application icon from a missing website favicon. The host route remains PNG-only and rejects invalid or foreign requests.

Related fork issue: FlorianBruniaux#20

Checks

  • pnpm typecheck, pnpm test (1,400 server and 392 UI tests), and pnpm build passed on 2636c64.
  • Tests cover no Dock subscription, invalid bundle IDs, foreign source, retries and detached Shortcut buttons.
  • git diff --check passed. Native XENEON rendering has not been retested from this branch.

The new Fremkit.appIcon() bridge method will require the maintainer's SDK version bump before a release.

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — this is a clean change. Validating the bundle id on both sides, keeping the host route PNG-only and gating it behind the dock subscription is exactly the shape I'd want, and the tests (no dock subscription, path refusal, foreign source, retry) cover the right things.

Only small things:

  1. widgets/shortcuts/index.html (around line 179) still points an <img> straight at /api/apps/icon/<bundleId>, so it has the same opaque-frame problem. Shortcuts already subscribes to dock, so it could move to Fremkit.appIcon() in this PR — or say it's a follow-up.

  2. The non-OK branch in useWidgetBridge.ts replies with bridge.noIcon, which reads "no icon for this site". Could you add an app-specific key (e.g. bridge.noAppIcon) to both fr.ts and en.ts?

  3. Nit: if a button is dropped while its icon request fails, missing() re-arms a retry timer on a detached node and it keeps retrying every 30 s. Checking button.isConnected (or img.isConnected) before scheduling would stop that. It predates this PR, so feel free to skip.

  4. The CHANGELOG line sits as a loose bullet above ### Changed; please move it under the right subsection. #10, #11 and #13 add theirs at the same spot, so expect a small rebase.

Note for us on the maintainer side: appIcon extends the bridge, so SDK_VERSION will need a bump before the next release. Nothing for you to do here. Also, #10 has the same WebKit root cause; if we end up fixing it in the CSP, I'll check whether that changes anything here.

@FlorianBruniaux
FlorianBruniaux force-pushed the codex/notification-app-icons branch from e326793 to 50137c6 Compare October 15, 2026 16:01
FlorianBruniaux and others added 2 commits October 15, 2026 18:23
Opaque widget frames cannot request local icon routes directly. Resolve validated bundle IDs through the trusted host bridge and retry missing icons without exposing local paths.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@FlorianBruniaux
FlorianBruniaux force-pushed the codex/notification-app-icons branch from 50137c6 to 2636c64 Compare October 15, 2026 16:24
@fdussert

Copy link
Copy Markdown
Owner

Thanks Florian, all four points are addressed, and the Shortcuts migration works end to end in WebKit (Safari and Calculator icons arrive as data:image/png through appIcon).

Sorry for moving the goalposts here — something changed underneath this PR after we reviewed it. Since #10 landed, the widget CSP lists the server's loopback origins in img-src, so an opaque frame can load /api/apps/icon/<bundleId> directly again (verified in WebKit, even from a widget with no dock subscription, e.g. the clock). That means the display bug this PR was written for is already fixed on main, and the real value of the PR is now the dock gate: only widgets that asked for the Dock should see app icons. Right now any widget can still probe which applications are installed with onload/onerror.

Could you add the same cross-site refusal to /api/apps/icon/:bundleId that /api/favicon already has (if (isCrossSiteFetch(req.headers)) return reply.code(403), see server/src/favicons/routes.ts), with a test? No widget fetches that route directly anymore after your Shortcuts change, so it's safe. The CHANGELOG line could then describe that gate rather than icons "finally" showing.

Optional nit: the isConnected guard you added in Shortcuts would also fit missing() in the Notifications widget.

Thanks again, and sorry for the extra round.

Co-Authored-By: Claude <noreply@anthropic.com>

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Florian, the icon route now refuses cross-site requests and the test covers it. In WebKit and Chromium a widget without dock gets onerror (403, Sec-Fetch-Site: cross-site), while Shortcuts and Notifications still get their icons through appIcon. Approving and merging (squash) — thanks for the extra round!

@fdussert
fdussert merged commit 4312058 into fdussert:main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants