docs(#2050): note per-account matrix avatar sync

This commit is contained in:
damocles 2026-06-27 13:52:46 +02:00 committed by mara
commit c29dfed9f4

View file

@ -408,10 +408,21 @@ avatars are a two-step `POST /media/r0/upload` → `PUT
`access_token` written by `hive-c0re::matrix::ensure_user_for` to
`<state>/matrix-token`.
The oneshot syncs the avatar for **every** account, not just the
hive-internal one: a `sync_one` shell function runs the upload + set
dance for the bare `matrix-token` (`main`, against `localhost:8008`)
and then for each dashboard-provisioned `matrix-token-<name>`, reading
that account's homeserver from its `matrix-account-<name>.json` sidecar
(mirrors `accounts::discover_token_accounts`). Idempotency is
**per-account**: a `matrix-avatar-icon-hash[-<name>]` file each, because
the `mxc://` URI is homeserver-scoped so every account uploads to its own
homeserver independently.
Triggered by EITHER boot (`wantedBy = multi-user.target`) OR the
sibling `matrix-avatar-sync.path` firing on token appearance. Both
paths re-run the oneshot idempotently — running the avatar set
twice is harmless.
sibling `matrix-avatar-sync.path` firing on token appearance — its glob
covers both `matrix-token` and `matrix-token-*`, so an account logged in
after boot gets its avatar without a restart. Both paths re-run the
oneshot idempotently — running the avatar set twice is harmless.
Critically: **`RemainAfterExit = false`** (not the more common
`true` for oneshots). systemd treats `RemainAfterExit = true`