Sync Lotus settings across devices via account data #104

Closed
opened 2026-09-17 01:39:34 -04:00 by jared · 1 comment
Owner

Every Lotus setting is localStorage-only (src/app/state/settings.ts), so a user on web + desktop + phone configures theme, composer toolbar order, quiet hours, call preferences, etc. three times.

Design

  • Persist a synced subset to account data io.lotus.settings (mx.setAccountData) on the user's own homeserver — works for users on other homeservers too since it's per-account. No new permissions, no third party.
  • Denylist device-specific keys (audio devices, PTT/deafen hotkeys if hardware-bound, window chrome, desktop-only toggles, anything storing hardware ids or per-device caches). Everything else syncs.
  • Conflict handling: last-write-wins by updatedAt timestamp inside the event; local write → debounce → push; remote accountData event → merge into the local atom without re-pushing (loop guard).
  • First login on a new device pulls the synced object before the UI renders the settings-dependent shell (theme flash acceptable but avoid a double repaint if cheap).
  • Respect the existing cross-tab storage listener + merge-on-write in settings.ts (Gitea #… storage listener work) — sync must not fight it.
  • Toggle in Settings → General ("Sync settings across devices", default on) with a "Reset synced settings" action.

Acceptance

  • Unit tests for merge/denylist/loop-guard logic (pure helpers in src/app/utils/settingsSync.ts).
  • Manual: change theme on web → appears on desktop within one sync; toggling the sync off leaves local settings intact.
Every Lotus setting is `localStorage`-only (`src/app/state/settings.ts`), so a user on web + desktop + phone configures theme, composer toolbar order, quiet hours, call preferences, etc. three times. ### Design - Persist a synced subset to account data `io.lotus.settings` (`mx.setAccountData`) on the user's own homeserver — works for users on other homeservers too since it's per-account. No new permissions, no third party. - Denylist device-specific keys (audio devices, PTT/deafen hotkeys if hardware-bound, window chrome, desktop-only toggles, anything storing hardware ids or per-device caches). Everything else syncs. - Conflict handling: last-write-wins by `updatedAt` timestamp inside the event; local write → debounce → push; remote `accountData` event → merge into the local atom without re-pushing (loop guard). - First login on a new device pulls the synced object before the UI renders the settings-dependent shell (theme flash acceptable but avoid a double repaint if cheap). - Respect the existing cross-tab storage listener + merge-on-write in `settings.ts` (Gitea #… storage listener work) — sync must not fight it. - Toggle in Settings → General ("Sync settings across devices", default on) with a "Reset synced settings" action. ### Acceptance - Unit tests for merge/denylist/loop-guard logic (pure helpers in `src/app/utils/settingsSync.ts`). - Manual: change theme on web → appears on desktop within one sync; toggling the sync off leaves local settings intact.
jared added this to the Features 2026-Q4 milestone 2026-09-17 01:39:34 -04:00
jared added the enhancementpriority: higharea: settings labels 2026-09-17 01:39:34 -04:00
jared self-assigned this 2026-09-17 01:39:34 -04:00
Author
Owner

Shipped on lotus#103 in 5b0d3554, #104 in 1ff28820. Gates green (tsc, eslint 68/68, prettier, 1068 tests, build, boot-check, bundle budget). Deploys via the usual CI → lotus-deploy gate.

Live check to do once deployed: (#103) paste a YouTube share link with ?si= and confirm it sends clean; (#104) change the theme on web and confirm desktop follows after its next sync.

Shipped on `lotus` — #103 in 5b0d3554, #104 in 1ff28820. Gates green (tsc, eslint 68/68, prettier, 1068 tests, build, boot-check, bundle budget). Deploys via the usual CI → lotus-deploy gate. Live check to do once deployed: (#103) paste a YouTube share link with `?si=` and confirm it sends clean; (#104) change the theme on web and confirm desktop follows after its next sync.
jared closed this issue 2026-09-17 01:56:21 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#104