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:
1 parent
3ce0334aea
commit
e56524a8cd
7 files changed
+179
-6
No files matched your search
+35
-3
@@ -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":
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>DJ Brake</title>
|
||||
<style>
|
||||
html, body { height: 100%; margin: 0; background: #050608; color: #fff; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
|
||||
body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5vmin; text-align: center; -webkit-user-select: none; user-select: none; }
|
||||
|
||||
/* comes on fast, goes out slowly: the eye catches it and it never flickers */
|
||||
#wash, #halo, #core { transition: opacity .7s ease-out; opacity: 0; }
|
||||
body.on #wash, body.on #halo, body.on #core { transition: opacity .09s ease-out; opacity: 1; }
|
||||
|
||||
#wash { position: fixed; inset: 0; background: radial-gradient(circle at 50% 46%, #6e0a0a 0%, #2a0505 42%, #050608 78%); }
|
||||
#lamp { position: relative; width: 66vmin; height: 66vmin; display: grid; place-items: center; }
|
||||
#halo, #core, #glass, #ring { position: absolute; inset: 0; border-radius: 50%; }
|
||||
#glass { background: radial-gradient(circle at 50% 38%, #171a20, #0b0d11 70%); box-shadow: inset 0 0 0 1px #ffffff14; }
|
||||
#core { background: radial-gradient(circle at 50% 36%, #ff6a5c 0%, #f4201c 46%, #b80c0f 100%); box-shadow: inset 0 0 0 1px #ffb3a8, inset 0 -3vmin 7vmin #5e000380; }
|
||||
#halo { inset: -7vmin; background: radial-gradient(circle, #ff2a1f 44%, #ff2a1f00 70%); filter: blur(3vmin); }
|
||||
#ring { border: .5vmin solid #ff5a4c; opacity: 0; pointer-events: none; }
|
||||
#word { position: relative; font-size: 10.5vmin; font-weight: 800; letter-spacing: .03em; line-height: 1; color: #4b5260; transition: color .5s; }
|
||||
#sub { position: relative; min-height: 1.3em; font-size: 4.4vmin; font-weight: 500; color: #6b7280; transition: color .5s; }
|
||||
body.on #word { color: #fff; transition: color .09s; }
|
||||
body.on #sub { color: #ffd9d4; transition: color .09s; }
|
||||
|
||||
/* while it lasts: slow breathing, one ring on each new hit, no hard flashing */
|
||||
body.on #halo { animation: breathe 2.2s ease-in-out infinite; }
|
||||
body.on #ring { animation: ripple .9s cubic-bezier(.2, .6, .3, 1); }
|
||||
@keyframes breathe { 50% { transform: scale(.94); filter: blur(4.5vmin); } }
|
||||
@keyframes ripple { from { transform: scale(1); opacity: .75; } to { transform: scale(1.32); opacity: 0; } }
|
||||
@media (prefers-reduced-motion: reduce) { body.on #halo, body.on #ring { animation: none; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wash"></div>
|
||||
<div id="lamp">
|
||||
<div id="halo"></div>
|
||||
<div id="ring"></div>
|
||||
<div id="glass"></div>
|
||||
<div id="core"></div>
|
||||
<div id="word">—</div>
|
||||
</div>
|
||||
<div id="sub"></div>
|
||||
<script>
|
||||
// Red light for the DJ: comes on while a limiter of a connected DSP is working.
|
||||
// On its own on purpose: this page needs no PIN and gets nothing but this one state from the server.
|
||||
(function () {
|
||||
var de = /^de/i.test(navigator.language || "");
|
||||
var text = de
|
||||
? { on: "LIMITER", more: "Mehr Gas bringt nichts", lost: "Keine Verbindung", none: "Kein DSP verbunden" }
|
||||
: { on: "LIMITER", more: "More gain won't help", lost: "No connection", none: "No DSP connected" };
|
||||
var word = document.getElementById("word"), sub = document.getElementById("sub");
|
||||
document.documentElement.lang = de ? "de" : "en";
|
||||
|
||||
function show(on, main, small) {
|
||||
document.body.className = on ? "on" : "";
|
||||
word.textContent = main;
|
||||
sub.textContent = small;
|
||||
}
|
||||
|
||||
var es = new EventSource("/djbrake/state");
|
||||
es.onmessage = function (e) {
|
||||
var s = JSON.parse(e.data);
|
||||
if (s.on) show(true, text.on, text.more);
|
||||
else if (s.ready) show(false, "OK", "");
|
||||
else show(false, "—", text.none);
|
||||
};
|
||||
es.onerror = function () { show(false, "—", text.lost); };
|
||||
|
||||
// keep the screen on where the browser allows it
|
||||
function awake() { if (navigator.wakeLock) navigator.wakeLock.request("screen").catch(function () {}); }
|
||||
awake();
|
||||
document.addEventListener("visibilitychange", function () { if (!document.hidden) awake(); });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -674,6 +674,11 @@ const DE = {
|
||||
"Check the result by ear or with a measurement: temperature, reflections and real speakers differ from the model.": "Das Ergebnis mit dem Ohr oder per Messung prüfen: Temperatur, Reflexionen und echte Lautsprecher weichen vom Modell ab.",
|
||||
"Only show dashboard while locked": "Während der Sperre nur das Dashboard zeigen",
|
||||
"With the lock on, this window then shows just your dashboard, until it is unlocked with the PIN.": "Bei aktiver Sperre zeigt dieses Fenster dann nur dein Dashboard, bis es mit der PIN entsperrt wird.",
|
||||
"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",
|
||||
"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.",
|
||||
"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.": "Jeder in deinem Netzwerk kann sie ohne PIN öffnen. Sie zeigt nur das Licht, beobachtet alle Ausgänge aller verbundenen DSPs und ändert nichts.",
|
||||
};
|
||||
|
||||
const DE_PATTERNS = [
|
||||
|
||||
@@ -979,3 +979,8 @@ body.dashonly .dlink { cursor: default; }
|
||||
@keyframes xptext { from { opacity: 0; } }
|
||||
@media (prefers-reduced-motion: reduce) { .xp.fx .node, .xp.fx .node::after, .xp.fx.on small { animation: none; } }
|
||||
.lockopt { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
|
||||
/* ---- DJ Brake setting */
|
||||
.djurl { margin-top: 8px; align-items: center; flex-wrap: nowrap; }
|
||||
.djurl code { flex: 1; min-width: 0; padding: 5px 8px; border-radius: 6px; background: var(--bg2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.djwarn { color: var(--warn); }
|
||||
.djurl button { flex: none; }
|
||||
Reference in new issue
Block a user