Files
claudeandClaude Opus 5.5 7d6eec8963 Harmony on eom.dev: Supabase + Harmony on Kubernetes, Dex sign-in, Catppuccin, LiveKit
Kubernetes port of Harmony 1.9.6's self-host compose stack (Supabase Postgres,
GoTrue, PostgREST, Realtime, storage-api, imgproxy, Kong; Harmony web,
federation server/worker, Redis, media cache, Caddy router; LiveKit) at
harmony.eom.dev, api.harmony.eom.dev and voice.harmony.eom.dev.

- Dex is the only sign-in (GoTrue custom OIDC provider custom:dex); e-mail
  login off; listed addresses become instance admins.
- Upstream bootstrap.sh runs unchanged in a Job through a docker shim.
- Catppuccin Mocha/Latte stylesheet injected into the stock web image.
- Secrets generated once and kept in Secret/harmony.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 17:31:50 -05:00

170 lines
8.1 KiB
Markdown

# eom.dev Catppuccin theme for Harmony
`catppuccin.css` turns Harmony's stock **Dark** preset into Catppuccin
**Mocha** and its stock **Light** preset into Catppuccin **Latte**, with mauve
as primary/accent and lavender for secondary and hover. The sign-in pages
(`AuthShell.vue`) are also recoloured. Fonts are left alone, so the Appearance
font picker (Figtree or pixel) still works. Written against Harmony **1.9.6**.
`theme.sh` is the web container's entrypoint hook. Mount it as
`/docker-entrypoint.d/50-eom-theme.sh` with mode 0755, so it runs after the
image's `40-harmony-config.sh`. It mounts with `catppuccin.css` at
`/usr/share/nginx/html/eom/`. The hook does three things:
- adds `<link rel="stylesheet" href="/eom/catppuccin.css?v=<md5>">` before
`</head>`;
- recolours the `theme-color`, `msapplication-TileColor` and
`msapplication-navbutton-color` meta tags;
- if `/usr/share/nginx/html/eom/theme.js` exists, adds a blocking
`<script src="/eom/theme.js?v=<md5>">` in front of the link. No theme.js
ships today.
It is idempotent. Each run removes the tags the previous run added and adds
fresh ones, so a changed stylesheet gets a new `?v=` even after a plain
restart.
## How it works, and why CSS-only
Harmony keeps no theme in its stylesheets. `applyPresetTheme()` in
`src/composables/useVisualTheme.ts` writes the preset colours inline on
`<html>` with `style.setProperty`, and then sets `data-theme` /
`data-theme-type`. Custom themes do the same through `applyThemePalette()` in
`src/utils/colorUtils.ts`, which sets `data-theme="custom"`. Skins set
`data-skin="<id>"`.
The stylesheet is therefore scoped to
`:root[data-theme="dark"|"light"]:not([data-skin])`. The variables Harmony
writes inline carry `!important`, because a stylesheet `!important` beats an
inline declaration that has none. Variables that only exist in
`design-system.css` carry no `!important`.
Before the bundle sets `data-theme`, `:root:not([data-theme])` follows
`prefers-color-scheme`. That is Harmony's own signed-out behaviour, so the
first paint already matches.
The alternative was a theme.js that seeds a `custom` theme into users'
appearance settings. I rejected it:
- a seeded custom theme becomes the user's stored choice and syncs to their
profile;
- it can only produce an OKLCH-generated approximation, not exact
Catppuccin;
- it can't apply to signed-out pages, because those follow the system
scheme and persist nothing;
- settings are user- and instance-scoped in localStorage
(`harmony_i_<instance>_user_<id>_visual-theme`).
Hooking `setProperty` from JS would be fragile. Because the CSS uses
`!important`, `getComputedStyle` also returns the Catppuccin values, so
Harmony's JS that reads them gets mauve:
- `applyContrastFills` in high-contrast mode;
- the Theme Customizer's starting values.
**Tradeoff:** on the stock Dark and Light presets, the Appearance "CSS
variable overrides" editor can't change the variables listed under
"!important" below; the stylesheet wins. Overrides of every other variable
still work. Anyone who wants to tweak those colours can pick a custom theme
(the customizer starts from the current Catppuccin values) or Midnight.
User choice is unaffected:
- Midnight, every custom theme and community preset, and every skin render
exactly as upstream;
- switching back to Dark or Light brings Catppuccin back.
The "Powered by Harmony" attribution (`src/components/auth/AuthShell.vue`,
`a.powered-by`; not AuthComponent.vue in 1.9.6) is not targeted. Its colours
come from the recoloured shell tokens, and it stays legible:
| Flavour | Text colour | Background | Contrast |
|---|---|---|---|
| Mocha | `#a6adc8` | `#11111b` | 8.4:1 |
| Latte | `#5c5f77` | `#dce0e8` | 4.7:1 |
The "Harmony" name inside it is drawn in mauve. No Harmony logo or artwork is
added or changed.
### Service worker
`public/service-worker.js` (v3.9) does not touch navigations, and nginx
serves `/index.html` `no-cache`. The precached `/` is never served for a
navigation, so unlike Funkwhale no revision patch is needed. Same-origin
`.css` is served stale-while-revalidate, keyed by the full URL, so the `?v=`
hash is what busts it. nginx also gives `/eom/*` `max-age=86400`.
## Upstream things this depends on (re-check on upgrade)
- **DOM hooks.** `useVisualTheme.ts` and `colorUtils.ts` still set
`data-theme` to `dark`, `light`, `midnight` or `custom`, and set
`data-skin` when a skin is active.
- **Variables written inline by the presets (`!important` here).** These are
written by `applyPresetTheme` and `applySurfaceSemanticTokens`:
- `--harmony-primary`, plus its `-hover`, `-light`, `-alpha`,
`-alpha-light` and `-alpha-strong` variants;
- the same six for `--harmony-secondary` and `--harmony-accent`;
- `--h-primary`, `--h-primary-light`, `--h-primary-dark`, `--h-brand`;
- `--background-primary` through `--background-senary`;
- `--background-{primary,secondary,tertiary,senary}-alpha`;
- `--text-primary`, `--text-secondary`, `--text-tertiary`, `--text-muted`;
- `--border-primary`, `--border-secondary`, `--border-hover`,
`--border-focus`, `--border-color`;
- `--icon-primary`, `--icon-secondary`, `--icon-active`;
- `--nav-rail-button-bg`, `--nav-rail-button-icon`,
`--channel-item-hover-bg`, `--channel-item-selected-bg`.
If a new release writes more colour variables inline, add them here with
`!important`, or they will show stock values.
- **Stylesheet-only variables (`src/assets/design-system.css`, no
`!important`).**
- `--text-on-primary`, `--text-inverse`, `--text-link`, `--text-danger`,
`--text-success`;
- `--background-septenary`, `--background-floating`;
- `--icon-tertiary`, `--icon-muted`;
- `--success`, `--success-hover`, `--error`, `--error-hover`,
`--error-fill`, `--error-fill-hover`, `--warning`, `--info`;
- `--status-online`, `--status-away`, `--status-busy`, `--status-offline`;
- `--color-primary-rgb`, `--h-brand-rgb`, `--color-success-rgb`,
`--color-warning-rgb`, `--color-danger-rgb`;
- `--tooltip-bg`, `--tooltip-text`, `--tooltip-arrow`;
- `--mention-highlight`.
The selectors here have specificity 0,3,0, which beats design-system's
`:root[data-theme-type="light"]` at 0,2,0.
- **Glass effects off.** `[data-disable-blur="true"]` makes the `*-alpha`
surfaces opaque, and is mirrored here.
- **Sign-in pages.** `AuthShell.vue` keeps its local tokens on `.auth-wrapper`
(`--page`, `--surface`, `--surface-light`, `--surface-hover`, `--border`,
`--text`, `--text-muted`, `--text-dim`, `--autofill-bg`). They are
overridden with `.auth-wrapper.auth-wrapper` to outrank the scoped
light-mode rule.
- **index.html meta values.** The hook's `sed` replaces the stock values
`#1e1f22`, `#ffffff` and `#0EA5E9`. If upstream changes them, the
replacement silently stops matching; the stylesheet link is unaffected.
- **Not overridden.** Hard-coded colours inside components, which are mostly
`var(--harmony-primary, #0EA5E9)` fallbacks that never apply; skins; the
Midnight preset; `manifest.json`'s `theme_color`.
## Verify
1. In the running pod, run
`grep -o '/eom/catppuccin.css?v=[0-9a-f]*' /usr/share/nginx/html/index.html`.
It should print one match, and `curl -I https://harmony.eom.dev/eom/catppuccin.css`
should return 200 `text/css`.
2. Signed out, open https://harmony.eom.dev. With the OS dark, the page should be
crust (`#11111b`), the card base (`#1e1e2e`) and the Log in button mauve
(`#cba6f7`) with dark text. With the OS light, the page should be
`#dce0e8` and the button `#8839ef` with white text. "Powered by
**Harmony**" should be visible under the card.
3. In devtools, run
`getComputedStyle(document.documentElement).getPropertyValue('--harmony-primary')`.
It should return `#cba6f7` on Dark and `#8839ef` on Light. The inline
`style` attribute still shows Harmony's `#0EA5E9`; that is expected.
4. Signed in, go to Settings → Appearance:
- Dark and Light should look Catppuccin;
- Midnight, any community preset or custom theme, and any skin should look
exactly like upstream;
- switching back should restore Catppuccin.
5. After changing the CSS, restart the pod and check that the `?v=` hash in
index.html changed.