diff --git a/theseus/index.js b/theseus/index.js index 16af122..4fa090c 100644 --- a/theseus/index.js +++ b/theseus/index.js @@ -131,6 +131,12 @@ module.exports = { // Theseus asks the user before restarting. Older Theseus builds lack // these hooks; the panel then points to Settings > Extensions. api.onMessage("update", async ({ step = "stage" } = {}) => { + // In place, no restart (Theseus 0.3.77+): Theseus swaps the new version in, + // restarts the add-on and reloads this panel. + if (step === "apply-now") { + if (typeof api.applySelfUpdate !== "function") return { ok: false, reason: "needs a restart" }; + return await api.applySelfUpdate(); + } if (step === "apply") { if (typeof api.restartApp !== "function") return { fallback: "settings" }; return await api.restartApp(); @@ -138,7 +144,7 @@ module.exports = { if (typeof api.checkAndStageSelfUpdate !== "function") return { fallback: "settings" }; const r = await api.checkAndStageSelfUpdate(); const staged = r?.status === "staged" || r?.status === "already-staged"; - return { staged, status: r?.status || "unknown", detail: r?.detail || null, current: r?.current || null, next: r?.next || null }; + return { staged, status: r?.status || "unknown", detail: r?.detail || null, current: r?.current || null, next: r?.next || null, inPlace: typeof api.applySelfUpdate === "function" }; }); api.onMessage("open-settings", ({ section = "" } = {}) => { api.openSettings?.(String(section)); return { ok: true }; }); diff --git a/ui/app.js b/ui/app.js index 55f37f3..26305c3 100644 --- a/ui/app.js +++ b/ui/app.js @@ -2482,6 +2482,12 @@ function setupFooter() { return r?.status === 'up-to-date' ? flash('✓ Up to date', 'ok', '') : flash('⚠ Update failed', 'err', r?.detail || r?.status || ''); } const next = r.next ? ` v${r.next}` : ''; + // Newer Theseus applies it in place: the panel reloads on the new version. + if (r.inPlace) { + showChip(`Updating to${next}…`, 'wait', 'Pithos reloads on the new version in a moment', null); + const a = await bridge.invoke('update', { step: 'apply-now' }).catch(() => null); + if (a?.ok) return; + } showChip(`↻ Restart to apply${next}`, '', `Pithos${next} is ready. Theseus restarts to apply it and reopens your tabs.`, async () => { try { const a = await bridge.invoke('update', { step: 'apply' });