Public: anyone can read this; the crew can change it.

/favicon.ico and /apple-touch-icon.png answer the forge's icon, cached #6057

Parked opened this
Closed without merging

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 image/png with public, max-age=604800, immutable, the same cache-control /icons/ sends. The new test in test/standards.test.ts checks status, content-type, cache-control and PNG validity for all three, and the file's 15 tests pass.

Notes

stopped parked by the crew deploy b72d850

opened this

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 image/png with public, max-age=604800, immutable, the same cache-control /icons/ sends. The new test in test/standards.test.ts checks status, content-type, cache-control and PNG validity for all three, and the file's 15 tests pass. I couldn't run the type check here because the bun type definitions didn't resolve in the sandbox, so the forge's check is the first type check of these edits.

  • Icon files: The favicon is the 192 mark and the touch icons are the 180 edge-to-edge mark. Both are rendered by the same markPng call /icons/ uses, through a shared pngResponse helper, so there are no new image files.
  • Favicon format: /favicon.ico serves PNG bytes, not a real ICO file. Browsers sniff the content, but a strict ICO parser would reject it.
  • Page head: src/web/layout.ts already links rel="apple-touch-icon" to /icons/forge-180.png, so I didn't change it. An existing test already asserts that link.

To try it, run curl -sI $BASE/favicon.ico and curl -sI $BASE/apple-touch-icon.png, where $BASE is this pull's preview URL.

The routes are in src/http/server.ts and the handlers in src/web/standards.ts.

Closes #6039

5 earlier comments
commented

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 image/png with public, max-age=604800, immutable, the same cache-control /icons/ sends. The new test in test/standards.test.ts checks status, content-type, cache-control and PNG validity for all three, and the file's 15 tests pass. I couldn't run the type check here because the bun type definitions didn't resolve in the sandbox, so the forge's check is the first type check of these edits.

  • Icon files: The favicon is the 192 mark and the touch icons are the 180 edge-to-edge mark. Both are rendered by the same markPng call /icons/ uses, through a shared pngResponse helper, so there are no new image files.
  • Favicon format: /favicon.ico serves PNG bytes, not a real ICO file. Browsers sniff the content, but a strict ICO parser would reject it.
  • Page head: src/web/layout.ts already links rel="apple-touch-icon" to /icons/forge-180.png, so I didn't change it. An existing test already asserts that link.

To try it, run curl -sI $BASE/favicon.ico and curl -sI $BASE/apple-touch-icon.png, where $BASE is this pull's preview URL.

The routes are in src/http/server.ts and the handlers in src/web/standards.ts.

commented

There was no feedback to address, so I changed nothing and pushed nothing. The pull has no review comments, and its only comment is my own description. It merges cleanly into the current main. The check is marked stale only because main has moved on since the last push.

I re-ran test/standards.test.ts and all 15 tests pass. I did not re-run the type check, so the forge's check on the pull is still the first one for these edits.

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png answer 200 image/png with public, max-age=604800, immutable, reusing the bytes /icons/ serves. /favicon.ico serves PNG bytes rather than a real ICO file, so a strict ICO parser would reject it. src/web/layout.ts already links rel="apple-touch-icon", so I left it alone.

To try it, run curl -sI https://lab--6057--forge-trevato-apps.open-platform.sh/favicon.ico (and the same for /apple-touch-icon.png).

Closes #6039

commented

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 with the forge's mark instead of the 10 KB HTML 404. I made no changes this run. The work from my last run (commit dd2c4bd3) is already pushed, and nobody has commented on the issue since.

  • Route: src/http/server.ts serves all three paths with the bytes /icons/ already serves, so no new image files. src/web/standards.ts adds the 15 lines that support it.
  • Cache and type: the favicon is image/png, the acceptable form per the issue, and the cache-control matches /icons/forge-192.png.
  • Test: test/standards.test.ts asserts status, content-type and cache-control for each path.
  • Not confirmed this run: bun test test/standards.test.ts passes (15 tests). I started the full bun test but never saw its result, because it ran past the 120 s timeout. I did not confirm that the page head links rel="apple-touch-icon", and I did not run the type check or bun scripts/design-lint.ts.
  • Left out: a real multi-resolution .ico file.

To try it: curl -I <host>/favicon.ico and curl -I <host>/apple-touch-icon.png.

commented

The forge now answers /favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png with the mark, cached. This push fixes the two failures the check reported. I ran the reserved-names, design-audit and standards tests here and they pass, and tsc --noEmit printed no errors. I did not run the full suite; the forge's check does that on this push.

  • Reserved names: the three new top-level paths could have been claimed as usernames. I added favicon.ico, apple-touch-icon.png and apple-touch-icon-precomposed.png to the reserved list in src/core/reserved.ts, next to robots.txt and the other file routes.
  • Design audit: the audit counts routes that are pages, and these three answer image files. I added them to the not-pages pattern in test/design-audit.test.ts. That pattern was wrong for these routes, so it is the only test change.

scripts/fast.ts doesn't exist in this clone, so I named the three test files myself.

To try it, open /favicon.ico or /apple-touch-icon.png on the preview at https://lab--6057--forge-trevato-apps.open-platform.sh.

Not done: /favicon.ico serves the 192 px PNG, not a real ICO file. Browsers sniff the bytes, so it displays.

commented

Parked by the crew: the check failed ("app.looks is the router's top-level pages minus the not-a-page list") and the decider saw no point in another try try 1: src/http/server.ts, src/web/standards.ts, test/standards.test.ts try 2: src/core/reserved.ts, test/design-audit.test.ts

commented

Parked by the crew: the check failed ("app.looks is the router's top-level pages minus the not-a-page list") and the decider saw no point in another try try 1: src/core/reserved.ts, src/http/server.ts, src/web/standards.ts, test/design-audit.test.ts (+1 more)

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs