Lock option: only show dashboard while locked; Sound Lab only in the desktop apps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 18:23:35 +01:00
1 parent 9203cab4df
commit f043e1a261
10 files changed
+58 -19

No files matched your search

+24 -3
View File
@@ -626,6 +626,7 @@ function renderTabs() {
$("#btn-settings").disabled = testLock;
document.querySelectorAll("#viewtabs button").forEach(b => {
if (b.dataset.view === "fir") b.hidden = !(dev() && dev().fir);
if (b.dataset.view === "lab") b.hidden = !S.isApp;
b.classList.toggle("active", !S.settings && b.dataset.view === S.view);
b.disabled = testLock && b.dataset.view !== "test";
});
@@ -1359,7 +1360,7 @@ function peqCard(d, kind, idx) {
const card = h("div", { class: "card wide" + (ch.peq_bypass ? " eq-off" : "") },
h("h3", {}, h("span", { class: "grow" }, t("Parametric EQ")), modeSeg,
d.fir ? null : toggleBtn("EQ Bypass", kind, idx, "peq_bypass", "small bypass", v => { card.classList.toggle("eq-off", v); renderBand(); redraw(); }),
h("button", { class: "small rewbtn", "data-view-ok": "", title: t("Open this channel in Sound Lab (REW)"), onclick: () => openLab(kind, idx) }, "REW"),
S.isApp ? h("button", { class: "small", "data-view-ok": "", title: t("Open this channel in Sound Lab (REW)"), onclick: () => openLab(kind, idx) }, "REW") : null,
h("button", { class: "small", onclick: async () => {
if (!await askConfirm(t("Reset EQ"), t("Set all PEQ bands of this channel to 0 dB and clear bypass?"), t("All flat"))) return;
chans(dev(), kind)[idx].peq.forEach((bb, i) => {
@@ -2232,6 +2233,16 @@ function backupCard() {
}
// Desktop app only: let phones/tablets on the LAN use this PC as server (they need the PIN)
function lockOptionCard() {
const box = h("input", { type: "checkbox", checked: !!S.lockDash, onchange: async () => {
try { S.lockDash = (await api("POST", "/api/lock-dash", { enabled: box.checked })).enabled; }
catch (e) { box.checked = !!S.lockDash; toast(t("Error: ") + trMsg(e.message)); }
} });
return h("div", { class: "card" }, h("h3", {}, t("Lock")),
h("label", { class: "chk" }, box, t("Only show dashboard while locked")),
h("p", { class: "info" }, t("With the lock on, this window then shows just your dashboard, until it is unlocked with the PIN.")));
}
function remoteCard() {
const r = S.remote || { enabled: false, port: 8080, urls: [] };
const port = h("input", { type: "number", min: 1, max: 65535, value: r.port, class: "short", "aria-label": "Port" });
@@ -2397,7 +2408,7 @@ function viewSettings() {
["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."),
"wide", [S.isApp ? remoteCard() : null, pinCard()]],
"wide", [S.isApp ? remoteCard() : null, S.isApp ? lockOptionCard() : null, pinCard()]],
["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]) =>
@@ -2429,6 +2440,11 @@ function render() {
if (S.busy) { S.dirty = true; return; }
if ($("#app").hidden) return;
if (!S.devices[S.cur]) S.cur = S.order[0] || null;
// locked with "only show dashboard": back to where it was after unlocking
if (dashOnly() && !testOn(S.devices[S.cur])) {
if (S.view !== "dash" || S.settings) { S.beforeLock = S.beforeLock || { view: S.view, settings: S.settings }; S.view = "dash"; S.settings = false; }
} else if (S.beforeLock) { S.view = S.beforeLock.view; S.settings = S.beforeLock.settings; S.beforeLock = null; }
document.body.classList.toggle("dashonly", dashOnly() && !testOn(S.devices[S.cur]));
if (testOn(S.devices[S.cur])) { S.view = "test"; S.settings = false; } // stays in the audio test until the analog input is back
// keep focus on a text field (e.g. while typing a device name) – re-rendering would steal it
const ae = document.activeElement;
@@ -2457,7 +2473,7 @@ function render() {
: d.status === "locked" ? h("div", {}, h("p", {}, t("This DSP is locked with a code.")),
h("button", { class: "on", onclick: () => unlockDialog(d) }, t("Enter code")))
: S.demo.enabled && !d.demo ? t("Disconnected while demo mode is on") : t("Not connected."));
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, fir: d.fir ? viewFir : viewMixer, lab: window.innerWidth < 760 ? viewMixer : viewLab, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, fir: d.fir ? viewFir : viewMixer, lab: S.isApp ? viewLab : viewMixer, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
main.replaceChildren(...[content].flat().filter(Boolean));
main.querySelectorAll(H_SCROLL).forEach((e, i) => { if (xs[i]) e.scrollLeft = xs[i]; });
window.scrollTo(0, y);
@@ -2501,6 +2517,7 @@ new ResizeObserver(() => document.documentElement.style.setProperty("--sb", $("#
// Phones and tablets on the web UI start read-only, so nothing changes by touching it by accident.
// Only a safety catch in this browser tab: it is not stored and the server knows nothing about it.
const viewOnly = () => !!S.locked || !!S.guard;
const dashOnly = () => !!S.locked && !!S.lockDash;
function showGuard() {
const b = $("#btn-guard"), used = !S.isApp && S.guardUsed;
b.hidden = !used;
@@ -2640,6 +2657,9 @@ function connectEvents() {
case "lock":
if (S.isApp) { S.locked = ev.locked; showLock(); render(); }
break;
case "lockdash":
if (S.isApp) { S.lockDash = ev.enabled; render(); }
break;
case "meters":
updateMeters(ev); break;
case "limiter":
@@ -2729,6 +2749,7 @@ async function startApp() {
if (store.get("dsp.lang") === a.lang) return location.reload();
}
S.locked = !!a.locked;
S.lockDash = !!a.lock_dash;
S.guardUsed = !S.isApp && matchMedia("(max-width: 759px), (pointer: coarse)").matches;
S.guard = S.guardUsed;
showGuard();