DJ Brake settings move next to remote access

In the apps the page is only reachable through remote access, so it can only be
switched on while that runs. All its addresses are listed there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 18:51:28 +01:00
1 parent 910cf3fc17
commit 28624caead
4 files changed
+16 -13

No files matched your search

+1
View File
@@ -60,6 +60,7 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
* **DJ Brake** (`static/djbrake.html`, `App.dj_stream`) – the only page without a login, off by default. It may only ever learn * **DJ Brake** (`static/djbrake.html`, `App.dj_stream`) – the only page without a login, off by default. It may only ever learn
`{on, ready, room, hint}` from `/djbrake/state`: never add device data or controls there. `dj_margin` moves its limit `{on, ready, room, hint}` from `/djbrake/state`: never add device data or controls there. `dj_margin` moves its limit
down on purpose, so the page must never reveal it. On its own on purpose, without `app.js`. down on purpose, so the page must never reveal it. On its own on purpose, without `app.js`.
Its settings sit in the access section; in the apps it needs remote access, since the app itself only listens on 127.0.0.1.
* **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info), * **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info),
skipping DSPs this app is connected to. skipping DSPs this app is connected to.
* **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and * **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and
+12 -12
View File
@@ -2370,24 +2370,24 @@ function logoCard() {
function djBrakeCard() { function djBrakeCard() {
// the app's own address only works on this computer: other devices come through remote access // the app's own address only works on this computer: other devices come through remote access
const r = S.remote || {}; const r = S.remote || {};
const base = S.isApp ? (r.enabled && r.urls && r.urls[0]) || "" : location.origin; const reachable = !S.isApp || !!r.running;
const url = base ? `${base}/djbrake` : ""; const urls = (S.isApp ? r.urls || [] : [location.origin]).map(u => `${u}/djbrake`);
const box = h("input", { type: "checkbox", checked: !!S.djbrake, onchange: async () => { const box = h("input", { type: "checkbox", checked: !!S.djbrake, disabled: !reachable, onchange: async () => {
try { S.djbrake = (await api("PUT", "/api/djbrake", { enabled: box.checked })).enabled; render(); } try { S.djbrake = (await api("PUT", "/api/djbrake", { enabled: box.checked })).enabled; render(); }
catch (e) { box.checked = !!S.djbrake; toast(t("Error: ") + trMsg(e.message)); } catch (e) { box.checked = !!S.djbrake; toast(t("Error: ") + trMsg(e.message)); }
} }); } });
return h("div", { class: "card" }, h("h3", {}, "DJ Brake"), return h("div", { class: "card" }, h("h3", {}, "DJ Brake"),
h("p", { class: "info" }, t("A page for a tablet at the DJ booth: a big red light comes on when a limiter is working, so turning up more won't help.")), h("p", { class: "info" }, t("A page for a tablet at the DJ booth: a big red light comes on when a limiter is working, so turning up more won't help.")),
h("label", { class: "chk" }, box, t("Share the page /djbrake")), h("label", { class: "chk" }, box, t("Share the page /djbrake")),
S.djbrake && url ? h("div", { class: "row djurl" }, h("code", {}, url), !reachable ? h("p", { class: "info djwarn" }, t("Only reachable while remote access is on.")) : null,
S.djbrake && reachable ? urls.map(url => h("div", { class: "row djurl" }, h("code", {}, url),
h("button", { class: "small", "data-view-ok": "", onclick: async () => { h("button", { class: "small", "data-view-ok": "", onclick: async () => {
try { await navigator.clipboard.writeText(url); toast(t("Address copied")); } catch { toast(url); } try { await navigator.clipboard.writeText(url); toast(t("Address copied")); } catch { toast(url); }
} }, t("Copy"))) : null, } }, t("Copy")))) : null,
S.djbrake && !url ? h("p", { class: "info djwarn" }, t("Switch on remote access below so other devices can reach it.")) : null, S.djbrake && reachable ? djLimiters() : null,
S.djbrake ? djLimiters() : null, S.djbrake && reachable ? djMarginOption() : null,
S.djbrake ? djMarginOption() : null, S.djbrake && reachable ? djHintOptions() : null,
S.djbrake ? djHintOptions() : null, S.djbrake && reachable ? h("p", { class: "info" }, t("Anyone in your network can open it without a PIN. It shows only the light and the distance to the limiter and changes nothing.")) : null);
S.djbrake ? h("p", { class: "info" }, t("Anyone in your network can open it without a PIN. It shows only the light and the distance to the limiter and changes nothing.")) : null);
} }
function djMarginOption() { function djMarginOption() {
@@ -2488,11 +2488,11 @@ function scanCard() {
function viewSettings() { function viewSettings() {
const sections = [ const sections = [
["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard(), djBrakeCard()]], ["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard()]],
["devices", t("Devices"), t("Several DSPs can be connected at the same time – pick one at the top. A DSP accepts only one connection: close the Thomann editor first."), ["devices", t("Devices"), t("Several DSPs can be connected at the same time – pick one at the top. A DSP accepts only one connection: close the Thomann editor first."),
"wide", [...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), scanCard(), addDeviceCard()]], "wide", [...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), scanCard(), addDeviceCard()]],
["access", S.isApp ? t("Remote access") : t("Security"), S.isApp ? t("Let phones and tablets in your network control this computer – they log in with the PIN.") : t("Who may use this web interface."), ["access", S.isApp ? t("Remote access") : t("Security"), S.isApp ? t("Let phones and tablets in your network control this computer – they log in with the PIN.") : t("Who may use this web interface."),
"wide", [S.isApp ? remoteCard() : null, pinCard()]], "wide", [S.isApp ? remoteCard() : null, djBrakeCard(), pinCard()]],
["backup", t("Backup"), t("Save and restore the settings of this app."), "wide", [backupCard()]], ["backup", t("Backup"), t("Save and restore the settings of this app."), "wide", [backupCard()]],
]; ];
const nav = h("nav", { class: "setnav", "aria-label": t("Settings") }, sections.map(([id, title]) => const nav = h("nav", { class: "setnav", "aria-label": t("Settings") }, sections.map(([id, title]) =>
+1 -1
View File
@@ -677,7 +677,7 @@ const DE = {
"A page for a tablet at the DJ booth: a big red light comes on when a limiter is working, so turning up more won't help.": "Eine Seite für ein Tablet am DJ-Pult: Ein großes rotes Licht geht an, wenn ein Limiter arbeitet, mehr Gas also nichts mehr bringt.", "A page for a tablet at the DJ booth: a big red light comes on when a limiter is working, so turning up more won't help.": "Eine Seite für ein Tablet am DJ-Pult: Ein großes rotes Licht geht an, wenn ein Limiter arbeitet, mehr Gas also nichts mehr bringt.",
"Share the page /djbrake": "Seite /djbrake freigeben", "Share the page /djbrake": "Seite /djbrake freigeben",
"Address copied": "Adresse kopiert", "Address copied": "Adresse kopiert",
"Switch on remote access below so other devices can reach it.": "Schalte unten den Fernzugriff ein, damit andere Geräte sie erreichen.", "Only reachable while remote access is on.": "Nur erreichbar, solange der Fernzugriff an ist.",
"Anyone in your network can open it without a PIN. It shows only the light and the distance to the limiter and changes nothing.": "Jeder in deinem Netzwerk kann sie ohne PIN öffnen. Sie zeigt nur das Licht und den Abstand zum Limiter und ändert nichts.", "Anyone in your network can open it without a PIN. It shows only the light and the distance to the limiter and changes nothing.": "Jeder in deinem Netzwerk kann sie ohne PIN öffnen. Sie zeigt nur das Licht und den Abstand zum Limiter und ändert nichts.",
"Limiters that count": "Diese Limiter zählen", "Limiters that count": "Diese Limiter zählen",
"Connect a DSP to choose.": "Verbinde einen DSP, um auszuwählen.", "Connect a DSP to choose.": "Verbinde einen DSP, um auszuwählen.",
+2
View File
@@ -994,3 +994,5 @@ body.dashonly .dlink { cursor: default; }
.djlim label.chk { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; } .djlim label.chk { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.djlim label.chk input { flex: none; margin: 3px 0 0; } .djlim label.chk input { flex: none; margin: 3px 0 0; }
.djlim input[type=range] { width: 100%; margin: 8px 0 4px; } .djlim input[type=range] { width: 100%; margin: 8px 0 4px; }
.row.djurl button.small { flex: 0 0 auto; width: auto; padding-inline: 14px; }
.row.djurl code { flex: 1 1 auto; }