From c29dfed9f4110fbc5fef377a33fbce13adb91b9b Mon Sep 17 00:00:00 2001 From: damocles Date: Sat, 27 Jun 2026 13:52:46 +0200 Subject: [PATCH] docs(#2050): note per-account matrix avatar sync --- docs/persistence.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/persistence.md b/docs/persistence.md index c958220d..16e38e4c 100644 --- a/docs/persistence.md +++ b/docs/persistence.md @@ -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 `/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-`, reading +that account's homeserver from its `matrix-account-.json` sidecar +(mirrors `accounts::discover_token_accounts`). Idempotency is +**per-account**: a `matrix-avatar-icon-hash[-]` 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`