feat(sync): include avatar in sync snapshot + auto-backup (multi-device)

The profile picture (users.avatar_b64, cosmetic/unencrypted) travelled only
in the manual export. Now it's also in buildSyncSnapshot and the auto-backup
container, so a new device / a restore picks it up.

- Restore is ADDITIVE (mirrors the import path): applyRemoteSnapshot adopts
  remote.avatar_b64 only when the local device has no avatar — never clobbers
  a locally-set picture. No per-avatar timestamp to arbitrate, so changing an
  existing avatar doesn't propagate (cosmetic, accepted).
- +2 merge tests (adopt-when-empty, don't-clobber-when-set). 65/65 green.
- Server /avatar endpoint unchanged (already accepts {avatar_b64}).

Closes the avatar item of CODE_AUDIT §4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-08 20:06:31 +01:00
parent dd86b2bd23
commit c58424d58c
5 changed files with 56 additions and 3 deletions
+5 -1
View File
@@ -844,7 +844,11 @@ après chaque `DELETE /attachments/{id}`. Un petit vault sain ne paie rien.
chargé à `enterApp`. Pas de photo → initiale sur couleur déterministe
(`avatarColorFor(username)`). Upload downscale 128px JPEG via `FileReader`
`data:` URI (PAS `blob:` — la CSP `img-src 'self' data:` bloque blob).
Inclus dans l'export JSON (`avatar_b64`), restauré à l'import si absent.
Inclus dans l'export JSON, l'auto-backup ET le snapshot de sync
(`avatar_b64`). Restauré **additivement** (seulement si le device n'a pas
déjà d'avatar) à l'import et dans `applyRemoteSnapshot` — pas de timestamp
par avatar, donc on n'écrase jamais une photo locale (changer un avatar
existant ne se propage pas ; cosmétique, assumé).
- **Quick search — modes fill** (Ctrl+Shift+Q) : Enter/clic-gauche =
password seul, Shift+Enter/clic-droit = full (user + Tab + pwd), Ctrl+Enter/
Ctrl+clic = username seul. `Bridge.executeAutofill(u, p, hide, 'user')`