Reset all app settings, dashboard starts empty
The reset disconnects all DSPs first and sends them nothing, asks for two random letters (and the PIN on the web), keeps a copy of the old config and reloads a fresh app. Refused during an audio test or mute all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d53069380
commit
29a89af562
8 files changed
+117
-7
No files matched your search
+32
-1
@@ -2220,6 +2220,34 @@ function deviceForm(d) {
|
||||
}
|
||||
|
||||
// App settings backup: devices, amplifiers/limiter data, PIN, remote access (not the DSP presets)
|
||||
// a fresh app: what this browser remembers goes as well
|
||||
function appWasReset() {
|
||||
try { Object.keys(localStorage).filter(k => k.startsWith("dsp.")).forEach(k => localStorage.removeItem(k)); sessionStorage.clear(); } catch { /* private mode */ }
|
||||
location.replace(S.isApp ? "/?start=app&lang=en" : "/");
|
||||
}
|
||||
|
||||
async function resetDialog() {
|
||||
const letters = "ABCDEFGHJKMNPQRSTUVWXYZ"; // no I, L and O: easy to mistake
|
||||
const code = [0, 1].map(() => letters[Math.floor(Math.random() * letters.length)]).join("");
|
||||
const matches = () => input.value.trim().toUpperCase() === code;
|
||||
const input = h("input", { type: "text", class: "code resetcode", maxlength: 2, autocomplete: "off", autocapitalize: "characters", spellcheck: "false", "aria-label": t("Letters"),
|
||||
oninput: () => { document.querySelector("#modal .dlg-actions button:last-child").disabled = !matches(); } });
|
||||
const pin = h("input", { type: "password", inputmode: "numeric", maxlength: 4, autocomplete: "off", placeholder: "••••" });
|
||||
const stuck = S.order.map(id => S.devices[id]).filter(d => !d.demo && d.test_saved && d.status !== "online").map(d => d.name);
|
||||
const open = modal({ title: t("Reset all app settings?"),
|
||||
body: h("div", { class: "form" },
|
||||
h("p", { class: "dlg-text" }, t("All DSPs are disconnected at once, then this app starts fresh: DSP list, colours and group names, amplifiers, SoundField plan, dashboard, DJ Brake, remote access and language are gone, and the PIN is 1234 again.")),
|
||||
h("p", { class: "dlg-text" }, h("b", {}, t("Nothing changes on the DSPs: their settings and presets stay as they are."))),
|
||||
stuck.length ? h("p", { class: "dlg-text resetwarn" }, t("{names} still has the lowered levels of an interrupted audio test. The app can no longer undo that after the reset.", { names: stuck.join(", ") })) : null,
|
||||
S.isApp ? null : h("label", {}, t("Current PIN"), pin),
|
||||
h("div", { class: "resetcheck" }, h("span", {}, t("To confirm, type these letters:")), h("b", { class: "resetletters", "aria-label": code }, code), input)),
|
||||
actions: [{ label: t("Cancel") }, { label: t("Reset"), primary: true, cls: "danger-on", value: () => matches() ? true : undefined }] });
|
||||
document.querySelector("#modal .dlg-actions button:last-child").disabled = true;
|
||||
if (!await open) return;
|
||||
try { await api("POST", "/api/reset", { pin: pin.value }); appWasReset(); }
|
||||
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
|
||||
}
|
||||
|
||||
function backupCard() {
|
||||
const exportCfg = async () => {
|
||||
try { if (await saveFile(`DSP-Control-${t("Settings")}_${today()}.json`, await api("GET", "/api/backup"))) toast(t("Settings backed up")); }
|
||||
@@ -2248,7 +2276,8 @@ function backupCard() {
|
||||
return h("div", { class: "card" }, h("h3", {}, t("App settings")),
|
||||
h("p", { class: "info" }, t("Saves devices, amplifiers & limiter calculator, PIN and remote access to a file. ") +
|
||||
t("The settings inside the DSPs are saved per device via “File…” at the top.")),
|
||||
h("div", { class: "row" }, h("button", { onclick: exportCfg }, t("Back up…")), h("button", { onclick: restore }, t("Restore…"))));
|
||||
h("div", { class: "row" }, h("button", { onclick: exportCfg }, t("Back up…")), h("button", { onclick: restore }, t("Restore…")),
|
||||
h("button", { class: "danger", onclick: resetDialog }, t("Reset all app settings…"))));
|
||||
}
|
||||
|
||||
// Desktop app only: let phones/tablets on the LAN use this PC as server (they need the PIN)
|
||||
@@ -2727,6 +2756,8 @@ function connectEvents() {
|
||||
sfOnRemote(ev.data); break;
|
||||
case "dashboard":
|
||||
dashRemote(ev.data); break;
|
||||
case "reset":
|
||||
appWasReset(); break;
|
||||
case "djbrake":
|
||||
S.djbrake = ev.enabled; S.djIgnore = ev.ignore; S.djHint = ev.hint; S.djHintEn = ev.hint_en; S.djMargin = ev.margin; if (S.settings && !S.busy) render(); break;
|
||||
case "logo":
|
||||
|
||||
+2
-6
@@ -4,17 +4,13 @@
|
||||
// Every module only looks: nothing here changes a DSP. Browsing (channel, EQ band) stays in this session.
|
||||
|
||||
const DASH_ROW = 40; // grid row + gap in px, see .dash
|
||||
const DASH_DEFAULT = () => [
|
||||
{ type: "status", w: 4 }, { type: "meters", w: 8 },
|
||||
{ type: "curve", w: 8 }, { type: "mixer", w: 4 },
|
||||
].map((m, i) => ({ id: `m${i}`, cfg: {}, ...m }));
|
||||
|
||||
let dashEdit = false, dashTimer = 0, dashSaveTimer = 0;
|
||||
// dragging modules around is no good on a touchscreen: there only their settings can be changed
|
||||
const dashTouch = () => matchMedia("(pointer: coarse)").matches;
|
||||
const dashBrowse = new Map(); // module id -> { kind, idx, band }
|
||||
|
||||
const dashMods = () => S.dash || (S.dash = DASH_DEFAULT());
|
||||
const dashMods = () => S.dash || (S.dash = []);
|
||||
const dashDevs = () => S.order.map(id => S.devices[id]).filter(d => d && (!d.demo || S.demo.enabled));
|
||||
// the chosen DSP, or the first one if it is gone (e.g. while demo mode is on)
|
||||
const dashDev = m => S.devices[m.cfg.device] && dashDevs().includes(S.devices[m.cfg.device]) ? S.devices[m.cfg.device] : dashDevs()[0];
|
||||
@@ -408,7 +404,7 @@ function viewDash() {
|
||||
viewOnly() ? null : h("button", { class: dashEdit ? "on" : "", onclick: () => { dashEdit = !dashEdit; render(); } }, dashEdit ? t("Done") : dashTouch() ? t("Widget settings") : t("Customise"))),
|
||||
dashEdit && !dashTouch() ? dashPalette() : null,
|
||||
mods.length ? h("div", { class: "dash" + (dashEdit && !dashTouch() ? " editing" : "") }, mods.map(dashModule))
|
||||
: h("div", { class: "dash" + (dashEdit ? " editing" : "") }, h("div", { class: "dmod dblank", style: dashSizeStyle(12, 4) }, t("Nothing here yet – press “Customise” and add modules."))),
|
||||
: h("div", { class: "dash" + (dashEdit ? " editing" : "") }, h("div", { class: "dmod dblank", style: dashSizeStyle(12, 4) }, dashTouch() ? t("Nothing here yet – you can add modules on a computer.") : t("Nothing here yet – press “Customise” and add modules."))),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -707,6 +707,16 @@ const DE = {
|
||||
"Forget learned levels": "Gelernte Pegel vergessen",
|
||||
"Colours and group names belong to the loaded preset (by its name) and come back when you load it.": "Farben und Gruppennamen gehören zum geladenen Preset (über seinen Namen) und kommen beim Laden wieder.",
|
||||
"Widget settings": "Widget-Einstellungen",
|
||||
"Reset all app settings…": "Alle App-Einstellungen zurücksetzen…",
|
||||
"Reset all app settings?": "Alle App-Einstellungen zurücksetzen?",
|
||||
"All DSPs are disconnected at once, then this app starts fresh: DSP list, colours and group names, amplifiers, SoundField plan, dashboard, DJ Brake, remote access and language are gone, and the PIN is 1234 again.": "Alle DSPs werden sofort getrennt, dann startet die App frisch: DSP-Liste, Farben und Gruppennamen, Verstärker, SoundField-Plan, Dashboard, DJ Brake, Fernzugriff und Sprache sind weg, und die PIN ist wieder 1234.",
|
||||
"Nothing changes on the DSPs: their settings and presets stay as they are.": "An den DSPs ändert sich nichts: Ihre Einstellungen und Presets bleiben, wie sie sind.",
|
||||
"{names} still has the lowered levels of an interrupted audio test. The app can no longer undo that after the reset.": "{names} hat noch die abgesenkten Pegel eines abgebrochenen Audiotests. Nach dem Zurücksetzen kann die App das nicht mehr rückgängig machen.",
|
||||
"To confirm, type these letters:": "Zum Bestätigen diese Buchstaben eingeben:",
|
||||
"Letters": "Buchstaben",
|
||||
"Nothing here yet – you can add modules on a computer.": "Noch nichts da – Module kannst du am Computer hinzufügen.",
|
||||
"End the audio test first: the DSP would stay at the lowered level": "Beende zuerst den Audiotest: Der DSP würde sonst auf dem abgesenkten Pegel bleiben",
|
||||
"Release mute all first: the DSPs would stay muted": "Hebe zuerst „Alle stumm“ auf: Die DSPs würden sonst stumm bleiben",
|
||||
};
|
||||
|
||||
const DE_PATTERNS = [
|
||||
|
||||
@@ -1045,3 +1045,8 @@ label.chk input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent
|
||||
.docui { padding: 0 4px; }
|
||||
html { touch-action: pan-x pan-y; }
|
||||
.djlim > button.small { margin-top: 8px; }
|
||||
.resetcheck { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
|
||||
.resetcheck > span { flex: 1 1 100%; color: var(--dim); }
|
||||
.resetletters { padding: 6px 14px; border-radius: 8px; font: 700 22px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .25em; color: var(--text); background: var(--panel3); user-select: none; -webkit-user-select: none; }
|
||||
input.resetcode { width: 4.5em; font-size: 20px; text-transform: uppercase; }
|
||||
.resetwarn { color: var(--warn); }
|
||||
Reference in new issue
Block a user