feat: control several drivers from one web UI

- Device dropdown: All devices, this device by name, then drivers found by
  mDNS (tagged app=led-strip) and any added by hand.
- POST /api/relay: a driver calls another driver's API for the page, so the
  browser only talks to its own board. Limited to /api/*, /ota and /reboot.
- All devices sends brightness and preset plays to every device.
- Settings: sync this device's presets, order and startup to the others.
- CORS for LAN and localhost origins, and an OPTIONS handler for /ota.
- Header labels are removed; the controls keep aria-labels.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-11 02:48:48 +13:00
1 parent 4b623bb156
commit d32f3d69cf
8 files changed
+525 -11

No files matched your search

+22 -3
View File
@@ -17,10 +17,13 @@
<button class="tab" data-tab="settings">Settings</button>
<button id="modeToggle" type="button" class="mode-toggle" aria-pressed="false">Edit mode</button>
<button id="newPreset" type="button" class="tab-action" hidden>+ New preset</button>
<label class="header-bright">Brightness
<input type="range" id="globalBright" min="0" max="255" step="1">
<div class="header-device">
<select id="deviceSelect" aria-label="Device"></select>
</div>
<div class="header-bright">
<input type="range" id="globalBright" min="0" max="255" step="1" aria-label="Brightness">
<output id="globalOut"></output>
</label>
</div>
</nav>
</header>
@@ -32,11 +35,27 @@
</section>
<section id="settings" hidden>
<h2>Devices</h2>
<p class="muted">Control other LED drivers from this page. Add each one by its address, such as 10.1.1.50 or led-desk.local. The list is kept in this browser.</p>
<ul id="devList" class="list"></ul>
<form id="devAdd">
<label>Address
<input id="devHost" maxlength="80" autocomplete="off" placeholder="10.1.1.50">
</label>
<button type="submit">Add device</button>
</form>
<p id="devMsg" class="muted" role="status"></p>
<h2>Presets</h2>
<p class="muted">Adds the default presets (Rainbow, Chase, Aurora, Candle, Twinkle, Flame, Sweep, Off) that are not in the list yet. Your own presets are kept.</p>
<button id="addDefaults" type="button">Add default presets</button>
<p id="defaultsMsg" class="muted" role="status"></p>
<h2>Sync presets</h2>
<p class="muted">Copy this device's presets, their order and its startup preset to every other device. A preset with the same name is replaced. Presets that only the other devices have are kept.</p>
<button id="syncPresets" type="button">Sync presets to other devices</button>
<p id="syncMsg" class="muted" role="status"></p>
<h2>LED strip</h2>
<form id="hwForm">
<label>Number of LEDs