Repository navigation
fix(console): PWA manifest declares the branding icon's real type and size, with 192/512 PNG fallbacks - #29405
Merged
Merged
Conversation
…ing favicon The runtime manifest declared every icon as an SVG at sizes 'any'. A PNG or ICO branding favicon now declares its real type and measured size, and a branding without a square raster of at least 192 px gains the Console's own 192 px and 512 px PNGs (rendered from public/favicon.svg), so a branded Console stays installable. The raster favicon is measured off the boot path: the manifest link lands once the measurement settles. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSqNEXXfJECHQqN7mG
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSqNEXXfJECHQqN7mG
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSqNEXXfJECHQqN7mG
Contributor
Author
|
domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m 席位核对 · ACCEPT · 2026-11-02T14:27ZHead-sha:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #29332
Clause-②: no
Metadata-protocol: none
维护者速读
image/svg+xml+sizes: 'any'。品牌 favicon 是 SVG 时照旧;是 PNG/ICO 等位图时按真实类型与实测像素尺寸声明;没有 ≥192 px 正方形位图时,补上平台默认的 192/512 PNG(由现有favicon.svg渲染,新增两个静态文件)。no-acceptable-icon,最低 144 px),与 Console as an installable PWA on desktop: register the Service Worker for the app shell, and prepare aweb_pushdelivery path #29155 要的「品牌化可安装」相悖。ui/apps/console/src/pwaManifestIcons.ts(resolveManifestIcons的判定);ui/apps/console/src/main.tsx(injectPwaManifest,异步注入)。pnpm --dir ui exec vitest run apps/console/src/pwaManifestIcons.test.ts,预期 23 个用例全绿。What changes
ui/apps/console/src/pwaManifestIcons.ts(new, console-local):resolveManifestIcons(faviconUrl, baseURI)builds the manifest icon entries.favicon.svg): one entry,image/svg+xml,sizes: 'any', as before. Nothing is loaded.data:media type): the image is measured throughHTMLImageElementand declared with its own type andWIDTHxHEIGHT. A favicon whose type is unknown, or that fails to load, measures zero or does not answer within 10 s, is left out rather than guessed.icon-192.pngandicon-512.pngare appended.ui/apps/console/public/icon-192.png,icon-512.png(new): the platform default icons, rendered once with Chromium from the existingpublic/favicon.svg. No default PNG icon existed anywhere in the repository and no server-rendered resize exists, so these are the card's "platform default icons" option (seat approved before the assets were added).ui/apps/console/src/main.tsx: the manifest block moves intoinjectPwaManifest, called withoutawait. The static manifest is still removed synchronously, the native-host check is unchanged, and the Blob manifest link lands once the icon measurement settles, so first paint is never held for it.start_url,scopeand the absolute icon URLs from feat(console): installable desktop PWA with an offline app shell and a push-ready Service Worker #29326 are unchanged.@object-ui/consolepatch.Trade-off: a branding with a small raster favicon installs with the platform default icon at launcher sizes, since browsers pick the icon closest to the size they need. Upscaling a 32 px favicon client-side would look worse and needs canvas and CSP work, so the branded icon stays in the manifest at its true size and the defaults cover the large sizes.
Tests
pnpm --dir ui exec vitest run apps/console/src/pwaManifestIcons.test.ts: 23/23 passed. Covers the manifest (throughgeneratePWAManifest) for no branding, SVG, small PNG, large square PNG, large non-square PNG, ICO, an unmeasurable raster and an unknown type, plusiconTypeOfand the browser measurement (load, error, zero size, timeout).image/svg+xmldeclaration,scripts/ablation-replace.mjsonconst type = iconTypeOf(src);): 6 failed / 17 passed, the PNG, ICO, unmeasurable and unknown-type cases red; no branding and SVG stay green, as they should. Restored, blob equal to HEAD,git diff HEADempty.turbo run type-check --filter=@object-ui/console: 71/71 tasks successful.dispatch-gates --commands): 33/33 exit 0 at29065950, reconciled with--ran(0 NOT-MEASURED, 0 UNRUN),vitest run scripts/included (169 files passed).origin/mainwas merged afterwards (1b6eb74f); none of the merged commits touch these files, and the unit test re-ran green there (23/23).Acceptance notes
index.html) still labels every non-SVG faviconimage/png, an ICO included. Out of this card's surface; browsers sniff favicon bytes, so nothing visible follows from it.Verification
Installability, read with CDP (
Page.getInstallabilityErrors,Page.getAppManifest) in full Chromium (launchPersistentContext,channel: 'chromium'), on avite buildof the Console served under/console/with itsbasetag and a stubbedGET /api/v1/runtime/configcarryingbranding.faviconUrl.no-acceptable-icon(minimum 144 px); icon declaredimage/svg+xml,any32x32PNG +192x192+512x512image/svg+xml,any256x256image/pnganyanyanyanyGenerated by Claude Code