fix(demo): stop locking per-browser preferences in demo mode

The Interface tab carried data-demo-lock as a whole, which greyed out the
sidebar layout breakpoint along with the toast settings. The breakpoint is
localStorage — per browser, invisible to every other visitor — so it belongs
with theme, notification permission and the quick-access bar, all of which
were already allowed. The toast settings are server-side and shared, so the
lock moves onto the uiSettingsForm that owns them.

Audited every other locked region against the localStorage key list: this was
the only per-browser control caught by a lock. Notifications, theme, FAB
placement/size/position and the sidebar breakpoint are now the complete set of
preferences a demo visitor may change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
MarekWoandClaude Opus 5 committed 2026-08-28 18:37:34 +02:00
1 parent ece8ebb6d2
commit 92ea5dae5d
3 files changed
+12 -5

No files matched your search

+5 -3
View File
@@ -33,7 +33,7 @@ lock it.
| Repeaters | Login, settings, CLI, reboot, **power off**, stored passwords |
| This server | Update trigger (rebuilds the containers), backups, database vacuum, retention settings |
| External publishing | Observer/MQTT settings and brokers, diagnostics capture and upload |
| Shared preferences | UI language, chat and interface settings, DM retry policy, analyzer and region registries |
| Shared preferences | UI language, chat settings, toast notification settings, DM retry policy, analyzer and region registries |
| Secrets | Repeater passwords, backup downloads, diagnostic captures, the server log |
**Still works:**
@@ -41,8 +41,10 @@ lock it.
- Reading everything — messages, channels, contacts, the map, the path analyzer
- **Sending messages**, in channels and as DMs, and resending
- Marking messages read
- Theme, layout, FAB placement and notification permission — these live in the browser,
so a visitor changing them affects nobody else
- Every preference that lives in the visitor's own browser, because changing it affects
nobody else: theme, desktop notification permission, the sidebar layout breakpoint,
whether the quick-access bar is shown, where each item sits (bar or menu), and the
bar's size, spacing and position
- The console, for read-only commands: `infos`, `status`, `stats`, `bat`, `ver`, `help`,
`contacts`, `contacts_all`, `contact_info`, `pending_contacts`, `channels`, `path`, `get`
+2
View File
@@ -18,6 +18,8 @@ For deep technical notes, see [architecture.md](architecture.md). For the full g
- **One corrupted advert no longer empties the contacts map.** Switching *Cache* on over the contacts map could leave you looking at a blank map of the world with not one of your contacts on it, and the Path Analyzer could draw a route as a single line stretching across the globe. Nothing was wrong with the contacts you could not see. Adverts arrive over the radio unchecked, and a packet mangled in flight can carry a position that is not a position at all — a latitude of 1642 degrees, a longitude of -1768. One such entry is enough, because the map fits itself around everything it is given: it zooms out until that impossible point is on screen, and every real contact ends up several world-widths away, outside the window. The tester who reported this had exactly two of them among 2131 cached contacts. Positions outside the range the Earth actually has are now thrown away rather than stored, thrown away again on the way out to the browser so a cache that already holds some heals itself the moment you update, and refused once more by the map itself. The contact is still kept and still listed — it simply no longer claims to be anywhere. The same check now guards every map in the app: contacts, repeaters, a repeater's neighbours and the Path Analyzer, which had its own looser version of the rule and would place a node reporting a longitude of exactly zero off the coast of Africa.
- **Demo mode no longer locks the sidebar layout setting, which was only ever yours.** On an instance running in demo mode the whole **Settings → Interface** tab was greyed out, and that swept up one control that had no business being there: the width at which the sidebar appears. That number is stored in your own browser, exactly like the theme and the quick-access bar, so changing it never touched anybody else's view of the instance — it was locked only because it happened to sit on the same tab as the toast settings, which genuinely are shared and stay locked. The rule the guard was meant to follow is that a preference living in your browser is yours to change: theme, desktop notifications, the quick-access bar and where its items go were all already allowed, and the layout breakpoint now joins them.
- **New messages on the channel you had open no longer arrive in silence, and old unread ones stop announcing themselves as new.** Two separate faults made notifications look unreliable even while the app was awake and connected. The first: a message on whichever channel you last had on screen was quietly excluded from notifications, on the assumption that you were looking at it — which is exactly wrong once the app is in the background, and meant that anyone who left mc-webui on their busiest channel was told about every channel except that one. A channel now counts as open only while somebody is actually looking at it. The second: the first time the app compared its unread counts against the server it treated the entire backlog as having just arrived, so a page that loaded in the background could announce *New: 492 channels* about messages that were days old. That first comparison is now only a measurement, and anything already unread when the app starts is treated as history rather than news.
- **Still unresolved: notifications going quiet after a while on Android.** The changes above fix what a notification says and where it takes you, but not the separate problem of the Android app falling silent some minutes after you switch away from it. That has a different cause — Android freezes apps that have nothing running in the foreground, which stops the connection the notifications depend on — and no setting on the phone can prevent it. Fixing it properly needs a background service in the app itself, which is planned for a later release.