From 62fde626535f6f9af04ca59f901f2efc9a4c64b9 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 26 Mar 2026 23:45:36 -0400 Subject: [PATCH] feat: persona-specific favicon + fix favicon.ico 404 app.js updates the to the active persona's emoji on load (CORTEX_EMOJI is already injected server-side). /favicon.ico route added as a fallback for login/settings/help pages that don't have persona context. Co-Authored-By: Claude Sonnet 4.6 --- cortex/routers/ui.py | 14 ++++++++++++++ cortex/static/app.js | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/cortex/routers/ui.py b/cortex/routers/ui.py index 64599a3..3db4871 100644 --- a/cortex/routers/ui.py +++ b/cortex/routers/ui.py @@ -62,6 +62,20 @@ def _first_persona(username: str) -> str | None: return names[0] if names else None +# --------------------------------------------------------------------------- +# Favicon — default sparkle; persona pages override via JS +# --------------------------------------------------------------------------- + +_FAVICON_SVG = ( + "" + "" +) + +@router.get("/favicon.ico", include_in_schema=False) +async def favicon(): + return Response(content=_FAVICON_SVG, media_type="image/svg+xml") + + # --------------------------------------------------------------------------- # Root redirect # --------------------------------------------------------------------------- diff --git a/cortex/static/app.js b/cortex/static/app.js index db5b26e..3b700ec 100644 --- a/cortex/static/app.js +++ b/cortex/static/app.js @@ -32,6 +32,15 @@ if (headerEmoji) headerEmoji.textContent = CORTEX_EMOJI; + // Set favicon to persona emoji + { + const favicon = document.querySelector("link[rel='icon']"); + if (favicon && CORTEX_EMOJI) { + const svg = `${CORTEX_EMOJI}`; + favicon.href = `data:image/svg+xml,${encodeURIComponent(svg)}`; + } + } + // Wire help link to preserve current persona on return const helpLink = document.getElementById('help-link'); if (helpLink) helpLink.href = `/help?persona=${encodeURIComponent(CORTEX_PERSONA)}`;