App icons: one icon per app, served as favicon, apple-touch-icon and web-app manifest - #54
Merged
Merged
Conversation
…web-app manifest
- enlace.app_icons: pick one icon per app across tiers (overlay > app_meta >
[app_meta].icons_dir/<name>.png > app's own > monogram), serve square PNG
renditions (/_apps/{name}/icon-{32,180,192,512}.png, Pillow) and a generated
/_apps/{name}/manifest.webmanifest, and add the missing <link> tags to each
app's HTML (platform-owned icons replace the page's own).
- enlace check warns about apps with no PNG form (no home-screen icon).
- Harvest: resolve mount-absolute (/{app}/favicon.svg) and ?v=-stamped icon
hrefs, and take the largest declared icon rather than the first.
- html_rewrite: the buffered <head> rewrite shared by the deploy meta tags and
the icon links (was inline in manifest.py).
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.
Why
An app's icon appears in four places: the launcher tile, the browser tab, the iOS home screen (
apple-touch-icon, PNG only) and the Android home screen (web-app manifesticons). enlace only handled the first, so on thorwhalen.com most apps had no favicon, only one had a manifest, and several tabs showed a different icon from their tile.What
enlace.app_iconspicks one icon per app (overlay >[app_meta.apps.<name>].icon><name>.pngin the new[app_meta].icons_dir> the app's own > monogram), and serves:/_apps/{name}/icon-{32,180,192,512}.png: square PNGs cut from a raster source (Pillow, newenlace[icons]extra)/_apps/{name}/manifest.webmanifest: generated, scoped to/{name}/,displayfrom[app_meta].manifest_display(defaultbrowser)/_apps/{name}/iconAppIconLinksMiddlewareadds the missing<link rel=icon|apple-touch-icon|manifest>andapple-mobile-web-app-titleto each app's HTML. An icon from the platform tiers replaces the page's own icon links; an app's own icon only fills the gaps. Protected apps getcrossorigin="use-credentials"on the manifest link.enlace checkwarns about apps with no PNG form (no home-screen icon).?v=-stamped and mount-absolute (/{app}/favicon.svg) icon hrefs now resolve, and the largest declared icon wins over the first one listed.enlace.html_rewritenow holds the buffered<head>-rewrite dance, shared by the deploy meta tags and the icon links (previously inline inmanifest.py).17 new tests (
test_app_icons.py). The existing suites pass unchanged.https://claude.ai/code/session_0162LVDYMJLDjsoq1ix991tj