DJ Brake page without login; routing level text follows the slider live

Optional page /djbrake (off by default) with a red light while a limiter works.
It needs no PIN and only ever gets {on, ready} from /djbrake/state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 18:38:36 +01:00
1 parent 3ce0334aea
commit e56524a8cd
7 files changed
+179 -6

No files matched your search

+35 -3
View File
@@ -1506,7 +1506,8 @@ function mixList(d, o) {
const m = chans(dev(), "out")[o].matrix ^ (1 << i);
setParam("out", o, "matrix", m); render();
} }, h("span", { class: "sw" }), chTitle(d, "in", i));
return h("div", { class: "mixrow" + (on ? "" : " off") }, btn, paramSlider(t("Level"), "out", o, `mix.${i}`, "mix"));
return h("div", { class: "mixrow" + (on ? "" : " off") }, btn, paramSlider(t("Level"), "out", o, `mix.${i}`, "mix",
v => showLive(`${d.id}|out|${o}|mix.${i}`, v)));
});
}
@@ -1516,6 +1517,14 @@ function routingCard(d, o) {
// ------------------------------------------------------------------ routing view
function xpLevel(o, i, raw) {
const el = h("small");
const show = v => { const db = gainDb(v); el.textContent = db === 0 ? "0" : sign(db); el.title = `${sign(db)} dB`; };
show(raw);
onLive("out", o, `mix.${i}`, show);
return el;
}
function viewRouting(d) {
const ins = chans(d, "in"), outs = chans(d, "out");
const grid = h("div", { class: "xmatrix", style: `--n:${ins.length}` });
@@ -1540,7 +1549,7 @@ function viewRouting(d) {
const m = chans(dev(), "out")[o].matrix ^ (1 << i);
S.xpFx = `${d.id}|${o}|${i}`;
setParam("out", o, "matrix", m); render();
} }, h("span", { class: "node" }), on ? h("small", { title: `${sign(gainDb(oc.mix[i]))} dB` }, gainDb(oc.mix[i]) === 0 ? "0" : sign(gainDb(oc.mix[i]))) : null));
} }, h("span", { class: "node" }), on ? xpLevel(o, i, oc.mix[i]) : null));
});
if (open) grid.append(h("div", { class: "xpanel" }, h("div", { class: "xpanel-h" }, t("Level for {ch}", { ch: chTitle(d, "out", o) }),
h("button", { class: "small", onclick: () => openChannel("out", o) }, t("Open channel"))), mixList(d, o)));
@@ -2358,6 +2367,26 @@ function logoCard() {
}
// Language per device (stored in the browser); the desktop app also tells the server, for its own dialogs
function djBrakeCard() {
// the app's own address only works on this computer: other devices come through remote access
const r = S.remote || {};
const base = S.isApp ? (r.enabled && r.urls && r.urls[0]) || "" : location.origin;
const url = base ? `${base}/djbrake` : "";
const box = h("input", { type: "checkbox", checked: !!S.djbrake, onchange: async () => {
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)); }
} });
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("label", { class: "chk" }, box, t("Share the page /djbrake")),
S.djbrake && url ? h("div", { class: "row djurl" }, h("code", {}, url),
h("button", { class: "small", "data-view-ok": "", onclick: async () => {
try { await navigator.clipboard.writeText(url); toast(t("Address copied")); } catch { toast(url); }
} }, 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 ? h("p", { class: "info" }, t("Anyone in your network can open it without a PIN. It shows only the light, watches all outputs of all connected DSPs and changes nothing.")) : null);
}
function langCard() {
const set = async lang => {
if (lang === LANG) return;
@@ -2413,7 +2442,7 @@ function scanCard() {
function viewSettings() {
const sections = [
["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard()]],
["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard(), djBrakeCard()]],
["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()]],
["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."),
@@ -2608,6 +2637,7 @@ function connectEvents() {
if (ev.muteall) { S.muteAll = ev.muteall.active; showMuteAll(); }
if (ev.soundfield) S.sf = ev.soundfield;
if ("dashboard" in ev) S.dash = ev.dashboard && ev.dashboard.modules;
S.djbrake = !!ev.djbrake;
if ("logo" in ev) { S.logo = ev.logo; showLogo(); }
if (S.demo.enabled && S.devices.demo && !S.devices[S.cur]?.demo) S.cur = "demo";
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
@@ -2642,6 +2672,8 @@ function connectEvents() {
sfOnRemote(ev.data); break;
case "dashboard":
dashRemote(ev.data); break;
case "djbrake":
S.djbrake = ev.enabled; if (S.settings) render(); break;
case "logo":
S.logo = ev.data; showLogo(); if (S.settings) render(); break;
case "muteall":