@bobfrankston/rmfmail 1.2.200 → 1.2.202

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.
Files changed (38) hide show
  1. package/bin/mailx.js +42 -0
  2. package/bin/mailx.js.map +1 -1
  3. package/bin/mailx.ts +34 -0
  4. package/bin/rmfshare-src/Program.cs +14 -2
  5. package/bin/rmfshare.exe +0 -0
  6. package/client/android-bootstrap.bundle.js +6 -3
  7. package/client/android-bootstrap.bundle.js.map +2 -2
  8. package/client/app.bundle.js +3 -0
  9. package/client/app.bundle.js.map +2 -2
  10. package/client/components/message-viewer.js +5 -0
  11. package/client/components/message-viewer.js.map +1 -1
  12. package/client/components/message-viewer.ts +5 -0
  13. package/client/compose/compose.bundle.js +3 -0
  14. package/client/compose/compose.bundle.js.map +2 -2
  15. package/client/compose/compose.js +3 -0
  16. package/client/compose/compose.js.map +1 -1
  17. package/client/compose/compose.ts +3 -0
  18. package/client/package.json +1 -1
  19. package/package.json +3 -3
  20. package/packages/mailx-service/index.d.ts +1 -1
  21. package/packages/mailx-service/index.d.ts.map +1 -1
  22. package/packages/mailx-service/index.js +8 -2
  23. package/packages/mailx-service/index.js.map +1 -1
  24. package/packages/mailx-service/index.ts +8 -2
  25. package/packages/mailx-service/jsonrpc.js +1 -1
  26. package/packages/mailx-service/jsonrpc.js.map +1 -1
  27. package/packages/mailx-service/jsonrpc.ts +1 -1
  28. package/packages/mailx-service/package.json +1 -1
  29. package/packages/mailx-store-web/android-bootstrap.js +1 -1
  30. package/packages/mailx-store-web/android-bootstrap.js.map +1 -1
  31. package/packages/mailx-store-web/android-bootstrap.ts +1 -1
  32. package/packages/mailx-store-web/package.json +1 -1
  33. package/packages/mailx-store-web/web-service.d.ts +1 -1
  34. package/packages/mailx-store-web/web-service.d.ts.map +1 -1
  35. package/packages/mailx-store-web/web-service.js +5 -3
  36. package/packages/mailx-store-web/web-service.js.map +1 -1
  37. package/packages/mailx-store-web/web-service.ts +5 -3
  38. /package/packages/mailx-imap/{node_modules.npmglobalize-stash-13740 → node_modules.npmglobalize-stash-57816}/.package-lock.json +0 -0
package/bin/mailx.js CHANGED
@@ -518,7 +518,47 @@ const __isCommandInvocation = process.argv.slice(2).some(a => __commandFlags.inc
518
518
  // Without it, every launch kills any existing rmfmail daemon — including
519
519
  // ones started earlier with --another, since we don't tag them.
520
520
  const __keepOthers = hasFlag("another");
521
+ /** Handoff-launch stamp: the daemon touches this whenever its fs.watch
522
+ * consumes a pending mailto/share file, so a handoff-spawned `node mailx.js`
523
+ * can tell "the running daemon already took the job" even though the pending
524
+ * file itself is long gone (the daemon consumes in ~50 ms; node boot takes
525
+ * ~500 ms — the spawned process NEVER sees the file it was launched for). */
526
+ const __handoffStamp = path.join(path.dirname(__instanceFile), "last-handoff.stamp");
527
+ function touchHandoffStamp() {
528
+ try {
529
+ fs.writeFileSync(__handoffStamp, String(Date.now()));
530
+ }
531
+ catch { /* */ }
532
+ }
521
533
  if (!isDaemon && !__isCommandInvocation && !__keepOthers) {
534
+ // Handoff launches must NOT replace a live daemon. rmfshare.exe (share
535
+ // sheet) and rmfmailto.exe (mailto links) write a pending file and spawn
536
+ // a bare `node mailx.js`, relying on the documented "exits if a daemon is
537
+ // already running" — but replace-on-launch made that spawn KILL and
538
+ // RESTART the app instead of opening compose (Bob 2026-07-30, share
539
+ // sheet screenshot). Detection: the explicit --handoff/--mailto flags,
540
+ // a still-unconsumed pending-share.json, or the consume stamp above.
541
+ {
542
+ const inst0 = readInstanceFile();
543
+ const daemonAlive = !!(inst0 && pidIsMailx(inst0.pid) && inst0.pid !== process.pid);
544
+ if (daemonAlive) {
545
+ const fresh = (p) => {
546
+ try {
547
+ return Date.now() - fs.statSync(p).mtimeMs < 30_000;
548
+ }
549
+ catch {
550
+ return false;
551
+ }
552
+ };
553
+ const handoff = hasFlag("handoff") || hasFlag("mailto")
554
+ || fresh(path.join(path.dirname(__instanceFile), "pending-share.json"))
555
+ || fresh(__handoffStamp);
556
+ if (handoff) {
557
+ console.log(`rmfmail: handoff to running daemon (PID ${inst0.pid}) — not restarting`);
558
+ process.exit(0);
559
+ }
560
+ }
561
+ }
522
562
  // Replace-on-launch: any rmfmail daemon already running gets killed and
523
563
  // the new one takes over. instance.json only tracks ONE PID — older or
524
564
  // orphaned daemons can survive a partial upgrade and leave the user with
@@ -2844,6 +2884,7 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2844
2884
  const data = consumePendingMailto();
2845
2885
  if (!data)
2846
2886
  return;
2887
+ touchHandoffStamp();
2847
2888
  handle.send({ _event: "openMailto", type: "openMailto",
2848
2889
  to: data.to, cc: data.cc, bcc: data.bcc,
2849
2890
  subject: data.subject, body: data.body, inReplyTo: data.inReplyTo });
@@ -2876,6 +2917,7 @@ RFC 5322 with CRLF line endings. Bodies are quoted-printable encoded (readable i
2876
2917
  const data = consumePendingShare();
2877
2918
  if (!data)
2878
2919
  return;
2920
+ touchHandoffStamp();
2879
2921
  const { attachments, skipped } = loadShareAttachments(data.files);
2880
2922
  handle.send({ _event: "openShare", type: "openShare",
2881
2923
  title: data.title, text: data.text, url: data.url,