From 1f63b5b78812b3558320829fbbcbe9d214c51f55 Mon Sep 17 00:00:00 2001 From: Local Dev Date: Tue, 8 Sep 2026 18:26:58 +0200 Subject: [PATCH] fix(theseus/settings): Aegis card reads correct IPC shapes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CDP test surfaced two shape mismatches: - cfg.listAddons() returns {installed:[...], sidebarPanels:[...]} — my destructure treated it as a plain array, so .find() blew up with 'installed || []).find is not a function'. - cfg.checkAddonUpdates() returns {report, skipped, staged:[...]} — same problem, .find on an object. Both call sites now normalise (installed = listRes.installed || [], staged = res.staged || []) before finding the aegis entry. Verified via CDP against a fresh install: card renders 'You're on v0.4.0. Updates arrive over-the-air…'; clicking Check for updates keeps that status (no staged update live); Restart-to-apply stays hidden. --- settings.html | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/settings.html b/settings.html index 8749f12..b475427 100644 --- a/settings.html +++ b/settings.html @@ -1009,15 +1009,20 @@ const aegisCheck = document.getElementById("aegisCheck"); const aegisApply = document.getElementById("aegisApply"); const isAegis = (a) => a && (a.id === "aegis" || a.id === "bchwallet"); + // addons-list returns {installed:[...], sidebarPanels:[...]} + // addons-check-updates returns {report, skipped, staged:[...]} + // addons-list-staged returns a flat [...]. Normalise both call sites. async function refreshAegis() { aegisApply.hidden = true; try { - const [installed, staged] = await Promise.all([ - C.listAddons ? C.listAddons() : Promise.resolve([]), + const [listRes, stagedRes] = await Promise.all([ + C.listAddons ? C.listAddons() : Promise.resolve({}), C.listStagedAddonUpdates ? C.listStagedAddonUpdates() : Promise.resolve([]), ]); - const cur = (installed || []).find(isAegis); - const upd = (staged || []).find(isAegis); + const installed = (listRes && listRes.installed) || []; + const staged = Array.isArray(stagedRes) ? stagedRes : []; + const cur = installed.find(isAegis); + const upd = staged.find(isAegis); if (!cur) { aegisStatus.textContent = "Aegis isn't installed. Reinstall Theseus to add it back, or open Settings > Extensions to load it manually."; return; } const curVer = cur.version || "?"; if (upd && upd.version) { @@ -1033,8 +1038,9 @@ aegisCheck.disabled = true; aegisCheck.textContent = "Checking…"; aegisStatus.textContent = "Checking…"; try { - const staged = await (C.checkAddonUpdates ? C.checkAddonUpdates() : Promise.resolve([])); - const upd = (staged || []).find(isAegis); + const res = await (C.checkAddonUpdates ? C.checkAddonUpdates() : Promise.resolve({})); + const staged = (res && Array.isArray(res.staged)) ? res.staged : []; + const upd = staged.find(isAegis); if (!upd) { aegisStatus.textContent = "You're on the latest Aegis."; } // refresh will populate everything else + toggle the Apply button refreshAegis();