@bobfrankston/rmfmail 1.2.10 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.ts CHANGED
@@ -2941,14 +2941,27 @@ onWsEvent((event) => {
2941
2941
  banner.style.background = "oklch(0.52 0.14 150)";
2942
2942
  // Stash the update banner contents so updateFailed can restore
2943
2943
  // it (offering a retry) instead of leaving "Updating..." pinned.
2944
- const restoreHtml = `${APP_NAME} ${event.latest} available (you have ${event.current}) <button id="btn-do-update" style="background:none;border:1px solid #fff;color:#fff;padding:0.15em 0.5em;border-radius:3px;cursor:pointer;margin-left:0.5em">Update now</button>`;
2944
+ // `local:true` means a newer build is ALREADY installed on disk
2945
+ // (npmglobalize finished) — we just need to restart onto it, no
2946
+ // npm install. That path is network-free and does a clean
2947
+ // daemon handoff (the fresh daemon kills this one). The remote
2948
+ // path (a published version not yet installed) still runs
2949
+ // performUpdate (npm install + restart).
2950
+ const isLocal = !!(event as any).local;
2951
+ const verb = isLocal ? "installed" : "available";
2952
+ const label = isLocal ? "Restart to apply" : "Update now";
2953
+ const restoreHtml = `${APP_NAME} ${event.latest} ${verb} (you have ${event.current}) — <button id="btn-do-update" style="background:none;border:1px solid #fff;color:#fff;padding:0.15em 0.5em;border-radius:3px;cursor:pointer;margin-left:0.5em">${label}</button>`;
2945
2954
  (window as any).__mailxUpdateBannerHtml = restoreHtml;
2946
2955
  text.innerHTML = restoreHtml;
2947
2956
  document.getElementById("btn-do-update")?.addEventListener("click", () => {
2948
- text.textContent = "Updating... mailx will restart when done";
2949
- // performUpdate runs npm install then restarts the service
2950
2957
  const ipc = (window as any).mailxapi || (window as any).opener?.mailxapi;
2951
- if (ipc?.performUpdate) ipc.performUpdate();
2958
+ if (isLocal && ipc?.restartDaemon) {
2959
+ text.textContent = "Restarting onto the new version...";
2960
+ ipc.restartDaemon();
2961
+ } else {
2962
+ text.textContent = "Updating... mailx will restart when done";
2963
+ if (ipc?.performUpdate) ipc.performUpdate();
2964
+ }
2952
2965
  });
2953
2966
  }
2954
2967
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",