feat(site): use the coder_app icon (and name) for the web terminal page when opened via `?app=`
Problem
Users install coder_app command apps (e.g. a TUI launched with command = "herdr") as PWAs in Chrome. A command app opens the coderd terminal page, and that page always carries the Coder favicon, so the installed PWA gets the Coder icon regardless of what coder_app.icon is set to.
Today coder_app.icon only affects the button in the dashboard. The terminal page is the same SPA shell as the rest of the dashboard: site/index.html hardcodes <link rel="icon"> to /favicons/favicon-{light,dark}.{svg,png} and there is no web-app manifest, per-app or otherwise. The enterprise Appearance logo_url does not affect the favicon either.
Proposal
site/src/pages/TerminalPage/TerminalPage.tsx already resolves ?app=<slug> to the app object from workspaceAgent.apps (to get the trusted command), so app.icon and app.display_name are available.
When ?app= is present and resolves to an app:
- Set the page's
<link rel="icon">toapp.icon(falling back to the Coder favicon when the app has no icon). - Optionally set the
<title>to the app'sdisplay_nameinstead of the hardcodedTerminal - owner/workspace. This overlaps with #25693.
A dynamic <link rel="icon"> is enough for Chrome's install dialog to pick up the icon. A per-app web-app manifest (name, icons, start_url) would make the installed PWA behave more cleanly, but is a larger change and could be a follow-up.
Context
Raised by a customer running a TUI as a coder_app command app; their users install it as a PWA and would like it to carry the app's own icon.
Related: #25693 (customisable web terminal title).
Filed by Coder Agents on behalf of @ericpaulsen.
Source: coder/coder