Show the server's branding logo instead of the built-in one #112

Merged
jcoffey-dev merged 1 commits from feat/101-server-logo into main 2026-11-18 20:43:09 +00:00
1 Commits
Author SHA1 Message Date
jcoffey-dev 42c5a9d62d Show the server's branding logo instead of the built-in one
ci / node (pull_request) Skipped
ci / version (pull_request) Skipped
ci / docker-build (pull_request) Skipped
ci / publish (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 1m16s
ci / announce (pull_request) Skipped
The logo an administrator sets on the mail server (Settings › System ›
Branding, or a domain's or tenant's logo) changed the server's sign-in page
and the console, but never the webmail, which always showed its own image.

The sign-in page and the top bar now show the server's logo, falling back to
the built-in one when the server has none. The browser asks /api/logo, which
asks the mail server's GET /logo on its behalf, for the signed-in reader's
domain, or the server's default before sign-in. The dark theme asks for the
logo set for dark mode (?theme=dark, inbuxa-server#410), which the server
falls back from to the ordinary one.

/api/logo hands the server's answer on as the server would: an image with
nosniff and, for SVG, a sandboxing Content-Security-Policy; a logo set as an
https URL becomes a redirect to the image proxy, since the page loads images
from its own origin only, and only for an image load; anything else is a
404. It never follows a redirect itself, keeps each answer five minutes, and
is limited per address, so readers' page loads don't spend the server's
anonymous-request limit, which counts this process as one address. The
image proxy needs a signed-in reader, so a URL logo shows in the top bar,
and the sign-in page keeps the built-in logo for it; a logo stored as an
image shows on both.

The built-in image is held in place, unseen, until the server has answered,
so it doesn't flash before a custom logo. In the top bar a custom logo takes
the inbuxa wordmark's place; a name set with APP_NAME stays beside it.

Fixes #101

Test: /api/logo passes an image on with its headers, asks the server for
theme=dark and keeps that apart from the light answer, asks the server once
for repeated loads, sends a URL logo to the image proxy only for an image
load, and answers 404 for no logo, an http: URL or a non-image. The client
builds the URL from the reader's domain and the theme, and probes each URL
once, as an image.
2026-11-18 13:36:31 -07:00