@bobfrankston/mailx 1.0.303 → 1.0.305

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/bin/mailx.js CHANGED
@@ -21,7 +21,8 @@ import path from "node:path";
21
21
  import os from "node:os";
22
22
  import net from "node:net";
23
23
  import { ports } from "@bobfrankston/miscinfo";
24
- import { showMessageBox, showService } from "@bobfrankston/msger";
24
+ import { showMessageBox, showService, setAppName } from "@bobfrankston/msger";
25
+ setAppName("mailx");
25
26
  const PORT = ports.mailx;
26
27
  const args = process.argv.slice(2);
27
28
  // Normalize: accept both -flag and --flag
@@ -905,15 +906,18 @@ async function main() {
905
906
  if (req._action === "performUpdate") {
906
907
  handle.send({ _cbid: req._cbid, ok: true, status: "updating" });
907
908
  try {
908
- const { execSync } = await import("child_process");
909
+ const { execSync, spawn: spawnChild } = await import("child_process");
909
910
  console.log(" [update] Installing latest version...");
910
911
  execSync("npm install -g @bobfrankston/mailx", { encoding: "utf-8", timeout: 120_000, stdio: "inherit" });
911
- console.log(" [update] Install complete — restarting");
912
+ console.log(" [update] Install complete — relaunching");
913
+ // Spawn the new version detached so it outlives this process
914
+ const child = spawnChild("mailx", [], { detached: true, stdio: "ignore", shell: true });
915
+ child.unref();
912
916
  }
913
917
  catch (e) {
914
918
  console.error(` [update] Install failed: ${e.message}`);
915
919
  }
916
- gracefulShutdown("Update complete — restarting");
920
+ gracefulShutdown("Update applied");
917
921
  return;
918
922
  }
919
923
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.303",
3
+ "version": "1.0.305",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -24,7 +24,7 @@
24
24
  "@bobfrankston/iflow-node": "^0.1.7",
25
25
  "@bobfrankston/miscinfo": "^1.0.8",
26
26
  "@bobfrankston/oauthsupport": "^1.0.24",
27
- "@bobfrankston/msger": "^0.1.325",
27
+ "@bobfrankston/msger": "^0.1.327",
28
28
  "@capacitor/android": "^8.3.0",
29
29
  "@capacitor/cli": "^8.3.0",
30
30
  "@capacitor/core": "^8.3.0",
@@ -86,7 +86,7 @@
86
86
  "@bobfrankston/iflow-node": "^0.1.7",
87
87
  "@bobfrankston/miscinfo": "^1.0.8",
88
88
  "@bobfrankston/oauthsupport": "^1.0.24",
89
- "@bobfrankston/msger": "^0.1.325",
89
+ "@bobfrankston/msger": "^0.1.327",
90
90
  "@capacitor/android": "^8.3.0",
91
91
  "@capacitor/cli": "^8.3.0",
92
92
  "@capacitor/core": "^8.3.0",
@@ -464,9 +464,11 @@ export class ImapManager extends EventEmitter {
464
464
  }
465
465
  const tokenDir = path.join(getConfigDir(), "tokens", account.imap.user.replace(/[@.]/g, "_"));
466
466
  tokenProvider = async () => {
467
- // Wrap authenticateOAuth with a 30s wall-clock timeout. Without this,
468
- // a hung OAuth server could block the entire sync thread indefinitely.
469
- const TOKEN_FETCH_TIMEOUT_MS = 30000;
467
+ // Wall-clock timeout on OAuth. Use a longer timeout when no
468
+ // cached token exists (first auth needs user to click through
469
+ // the browser consent screen — 30s is too tight).
470
+ const hasToken = fs.existsSync(path.join(tokenDir, "oauth-token.json"));
471
+ const TOKEN_FETCH_TIMEOUT_MS = hasToken ? 30_000 : 120_000;
470
472
  const authPromise = authenticateOAuth(credPath, {
471
473
  scope: "https://mail.google.com/ https://www.googleapis.com/auth/contacts.readonly https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive",
472
474
  tokenDirectory: tokenDir,