[object Object]

← back to build-pages

favicon: /favicon.svg + /favicon.ico routes serve real brand mark (referenced by OpenSearch) + 3 smoke

9419dd0dd322b7bec0903cd86272de21150448d2 · 2026-05-13 19:48:41 -0700 · SteveStudio2

Files touched

Diff

commit 9419dd0dd322b7bec0903cd86272de21150448d2
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 19:48:41 2026 -0700

    favicon: /favicon.svg + /favicon.ico routes serve real brand mark (referenced by OpenSearch) + 3 smoke
---
 server.js     | 13 +++++++++++++
 test/smoke.js |  7 +++++++
 2 files changed, 20 insertions(+)

diff --git a/server.js b/server.js
index 9abdca5..513bc32 100644
--- a/server.js
+++ b/server.js
@@ -258,6 +258,19 @@ app.use((req, res, next) => {
 });
 app.use('/css', express.static(path.join(__dirname, 'public/css'), { maxAge: '1h' }));
 
+// favicon.svg — same brand mark as the data: URI in <head>, but served as
+// a real URL so OpenSearch <Image>, Slack/Discord link unfurling, and any
+// "where's the icon file" tool can find it.
+const FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="6" fill="#111"/><text x="16" y="22" font-family="Georgia,serif" font-size="20" fill="#ffd633" text-anchor="middle">BP</text></svg>`;
+app.get('/favicon.svg', (_req, res) => {
+  res.setHeader('Cache-Control', 'public, max-age=86400');
+  res.type('image/svg+xml').send(FAVICON_SVG);
+});
+app.get('/favicon.ico', (_req, res) => {
+  res.setHeader('Cache-Control', 'public, max-age=86400');
+  res.type('image/svg+xml').send(FAVICON_SVG);
+});
+
 // robots.txt — let everything be crawled. /api/* is JSON discovery, public.
 app.get('/robots.txt', (_req, res) => {
   res.setHeader('Cache-Control', 'public, max-age=86400');
diff --git a/test/smoke.js b/test/smoke.js
index a385334..64216a5 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -220,6 +220,13 @@ function check(name, cond, hint = '') {
   check('search: 302',             r.status === 302);
   check('search: redirects to /?q', /\/\?q=whisper/.test(r.headers['location'] || ''));
 
+  // 12b2. favicons reachable as real URLs (OpenSearch <Image> needs this)
+  r = await fetch('/favicon.svg');
+  check('favicon.svg: 200',        r.status === 200);
+  check('favicon.svg: svg type',   /image\/svg/.test(r.headers['content-type'] || ''));
+  r = await fetch('/favicon.ico');
+  check('favicon.ico: 200',        r.status === 200);
+
   // 12c. OpenSearch — autodiscovery + descriptor
   r = await fetch('/opensearch.xml');
   check('opensearch: 200',         r.status === 200);

← 89a5046 opensearch: /opensearch.xml descriptor + autodiscovery <link  ·  back to build-pages  ·  Makefile: add 'make stats' target — pretty-print fleet stats fafcc17 →