| … | … | @@ -1518,6 +1518,10 @@ export function updateSettings (u) { |
| 1518 | 1518 | if (!u) return '' |
| 1519 | 1519 | const short = (h) => (h ? esc(String(h).slice(0, 12)) + '…' : '<span class="who">unknown</span>') |
| 1520 | 1520 | const checked = u.checkedAt ? '<p class="who">Last checked ' + esc(u.checkedAt) + '</p>' : '' |
| 1521 | // ⚠ The node's own last OTA line, verbatim. It says things no derived field can — "no swarm |
| 1522 | // fetcher", "downloading 0.0.6", "previously failed to boot" — and without it a device could only |
| 1523 | // report that nothing happened. |
| 1524 | const note = u.note ? '<p class="who">' + esc(u.note) + '</p>' : '' |
| 1521 | 1525 | // ⛔ THE VERSION FIRST, because it is the only line here a person can compare against a release |
| 1522 | 1526 | // page. Two tree hashes say something differs; they do not answer "is my update installed?", which |
| 1523 | 1527 | // is the question anyone opening this section actually has. |
| … | … | @@ -1530,13 +1534,20 @@ export function updateSettings (u) { |
| 1530 | 1534 | // is the ordinary case — the node re-verified the bundle it is already running — and calling that |
| 1531 | 1535 | // "update available" is what makes a restart button lie. |
| 1532 | 1536 | const waiting = updateWaiting(u) |
| 1537 | // ⛔ ALWAYS SHOWN, BOTH VALUES, IN EVERY STATE. This used to print `running` alone when it judged |
| 1538 | // itself up to date — so when that judgement was WRONG (it required `running`, which is null on a |
| 1539 | // fresh install) there was no way to see that a bundle had in fact been staged. A page that shows |
| 1540 | // its inputs only when it already agrees with you cannot be used to find out that it is wrong, |
| 1541 | // and several hours went into guessing at a state this line could have printed. |
| 1542 | const facts = '<p class="who">running ' + short(u.running) + |
| 1543 | ' · staged ' + short(u.staged) + '</p>' |
| 1544 | |
| 1533 | 1545 | const body = waiting |
| 1534 | | ? '<p class="warn">An update is downloaded and will apply on the next start.</p>' + |
| 1535 | | '<p class="who">running ' + short(u.running) + ' → staged ' + short(u.staged) + '</p>' + |
| 1546 | ? '<p class="warn">An update is downloaded and will apply on the next start.</p>' + facts + |
| 1536 | 1547 | (u.ota ? '<p><button id="app-restart">restart now</button></p>' : '<p class="who">This app cannot restart itself; close and reopen it.</p>') |
| 1537 | | : '<p>Up to date.</p><p class="who">running ' + short(u.running) + '</p>' |
| 1548 | : '<p>Up to date.</p>' + facts |
| 1538 | 1549 | |
| 1539 | | return '<h2>App updates</h2>' + version + body + checked + |
| 1550 | return '<h2>App updates</h2>' + version + body + checked + note + |
| 1540 | 1551 | (u.ota ? '<p><button id="app-check">check now</button> <span id="app-msg" class="who"></span></p>' : '') + |
| 1541 | 1552 | (u.ota ? '<script type="module">\n' + UPDATE_JS + '\n</script>' : '') |
| 1542 | 1553 | } |