Skip to content

web: add a favicon to the web UI #470

Description

@bennotk

What problem does this solve?

data/index.html ships no icon at all. Browsers show the generic default in the tab and in bookmarks, and src/web/WebServer.h answers /favicon.ico with a hardcoded 204 to keep the request from generating log noise:

// Browsers always request a favicon; return 204 so the request doesn't
// fall through serveStatic's default-file fallback and generate log noise.
_server.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest* r) { r->send(204); });

With several devices reachable in the same browser session, tabs are indistinguishable.

Proposed solution

Ship the LightWitch hat icon and reference it from the SPA shell.

  • data/favicon.svg — vector artwork (44 paths, viewBox="0 0 512 512"), 9.2 KB raw / 3.2 KB gzipped. .svg is already covered by both compression paths (COMPRESSIBLE in scripts/pre_uploadfs.py, and the "Gzip web assets" step in .github/workflows/firmware.yml), so the device only ever stores the gzipped variant.
  • data/favicon.ico — 15 KB, needed because Safari still does not support SVG favicons.
  • Two <link rel="icon"> tags in the <head> of data/index.html.
  • Drop the 204 handler so serveStatic can serve the file.

Roughly 18 KB on LittleFS, of which ~3 KB compressed.

Explicitly out of scope

  • No apple-touch-icon.png, no site.webmanifest, no PWA install path. The manifest from the icon set carries generator placeholders ("name": "MyWebSite", both colors #ffffff, both icons purpose: "maskable" with no any variant) and would need its own decisions.
  • No raster favicon sizes beyond the .ico; the SVG covers every modern browser at any resolution.

Acceptance criteria

  • The icon appears in the browser tab against the mock server and on a device.
  • Safari falls back to favicon.ico.
  • /favicon.ico returns the file instead of 204.

Checklist obligations

  • Mock parity: none needed — server/index.js already serves data/ through express.static(DATA_DIR) before the SPA catch-all.
  • /validate-ui on the shell, since data/ changes.

Related

Filesystem headroom is tight (#377). This change adds ~18 KB to a 320 KB partition; the numbers in #377 are out of date and worth a separate look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions