diff --git a/CLAUDE.md b/CLAUDE.md index 8def3a0..b84f053 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -189,8 +189,8 @@ Read this first when picking the project back up. `stop_monitoring_blind`, `_slow_drip`, `_spam`) are exempt: 0x96/0x97 mean the same on both series, and the blind tools must reach a unit too wedged to answer. - ⚠ **Before serial mode is used on a unit that calls home to THOR, run the - ring-path Runs A/B** (spec, *Open questions ... for the bench*): a held line + ⚠ **Before this branch merges, run the ring-path Runs A/B** -- the spec's + prerequisite to a webapp sending `serial` (*Open questions ... for the bench*): a held line holds the modem's single TCP session. The page never polls (every request is a click), SFM hangs up on RADIO RING, and **Hang up** releases the line at once; whether a call-home still reaches THOR is unmeasured. diff --git a/sfm/sfm_webapp.html b/sfm/sfm_webapp.html index 3141c17..327d0e9 100644 --- a/sfm/sfm_webapp.html +++ b/sfm/sfm_webapp.html @@ -1613,6 +1613,18 @@ function settingsRows(st) { return rows; } +// The legacy per-index routes (Load / Save / Download, prev/next, the arrow +// keys) address events by position on the MiniMate path: live only for a list +// loaded without a serial that has events. +function perIndexLive({ bySerial, count }) { return !bySerial && count > 0; } + +// A unit's own string (setup name, project, an error naming a serial) placed +// into markup must stay text. +function escapeHtml(v) { + return String(v ?? '').replace(/[&<>"']/g, + c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); +} + function downloadSummary(body) { if (body.inserted === false) return `already stored — ${body.stored_filename}`; return `stored ${body.stored_filename}, ${body.filesize} bytes, check: ${(body.detail || {}).check}`; @@ -1790,6 +1802,9 @@ function switchTab(name) { // ── Connect ──────────────────────────────────────────────────────────────────── async function connectUnit() { if (!devHost()) { setStatus('Enter a device host first.', 'error'); return; } + // Whatever answered last time no longer counts: only this identify confirms. + unitConfirmed = null; + applyControls(); const btn = document.getElementById('connect-btn'); btn.disabled = true; @@ -1852,14 +1867,15 @@ function setEventButtonsEnabled() { // A list loaded by serial is downloaded row by row (by event_id); these // per-index buttons belong to the legacy list. const bySerial = eventsBySerial; + const live = perIndexLive({ bySerial, count: n }); for (const id of ['load-btn', 'save-btn', 'download-btn']) { const el = document.getElementById(id); if (el.dataset.legacyTitle === undefined) el.dataset.legacyTitle = el.title; - el.disabled = n === 0 || bySerial; + el.disabled = !live; el.title = bySerial ? 'For a list loaded without a serial — use a row\'s Download' : el.dataset.legacyTitle; } document.getElementById('prev-btn').disabled = true; - document.getElementById('next-btn').disabled = n <= 1 || bySerial; + document.getElementById('next-btn').disabled = !live || n <= 1; } // ── Event list (opt-in — this is the slow chain walk) ────────────────────────── @@ -2083,7 +2099,9 @@ function populateDeviceTab() { for (const {label, value} of cardData) { const c = document.createElement('div'); c.className = 'dev-card'; - c.innerHTML = `