@bobfrankston/rmfmail 1.2.172 → 1.2.175

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 (55) hide show
  1. package/TODO.md +4 -3
  2. package/bin/build-rmfshare-exe.js +79 -0
  3. package/bin/mailx.js +52 -1
  4. package/bin/mailx.js.map +1 -1
  5. package/bin/mailx.ts +51 -1
  6. package/bin/rmfshare-src/Program.cs +225 -0
  7. package/bin/rmfshare-src/rmfshare.csproj +36 -0
  8. package/bin/rmfshare.exe +0 -0
  9. package/bin/share-target.js +314 -0
  10. package/bin/share-target.js.map +1 -0
  11. package/bin/share-target.ts +331 -0
  12. package/client/app.bundle.js +120 -0
  13. package/client/app.bundle.js.map +3 -3
  14. package/client/app.js +69 -0
  15. package/client/app.js.map +1 -1
  16. package/client/app.ts +72 -0
  17. package/client/components/message-viewer.js +60 -0
  18. package/client/components/message-viewer.js.map +1 -1
  19. package/client/components/message-viewer.ts +60 -0
  20. package/client/compose/compose.bundle.js +11 -0
  21. package/client/compose/compose.bundle.js.map +2 -2
  22. package/client/lib/api-client.js +16 -0
  23. package/client/lib/api-client.js.map +1 -1
  24. package/client/lib/api-client.ts +21 -0
  25. package/client/lib/mailxapi.js +6 -0
  26. package/client/package.json +1 -1
  27. package/package.json +6 -6
  28. package/packages/mailx-imap/index.d.ts.map +1 -1
  29. package/packages/mailx-imap/index.js +22 -0
  30. package/packages/mailx-imap/index.js.map +1 -1
  31. package/packages/mailx-imap/index.ts +22 -0
  32. package/packages/mailx-imap/package-lock.json +2 -2
  33. package/packages/mailx-imap/package.json +1 -1
  34. package/packages/mailx-service/index.d.ts +45 -0
  35. package/packages/mailx-service/index.d.ts.map +1 -1
  36. package/packages/mailx-service/index.js +288 -0
  37. package/packages/mailx-service/index.js.map +1 -1
  38. package/packages/mailx-service/index.ts +274 -0
  39. package/packages/mailx-service/jsonrpc.js +4 -0
  40. package/packages/mailx-service/jsonrpc.js.map +1 -1
  41. package/packages/mailx-service/jsonrpc.ts +4 -0
  42. package/packages/mailx-service/package.json +1 -1
  43. package/packages/mailx-settings/package.json +1 -1
  44. package/packages/mailx-store/db.d.ts +3 -0
  45. package/packages/mailx-store/db.d.ts.map +1 -1
  46. package/packages/mailx-store/db.js +5 -0
  47. package/packages/mailx-store/db.js.map +1 -1
  48. package/packages/mailx-store/db.ts +8 -0
  49. package/packages/mailx-store/package.json +1 -1
  50. package/packages/mailx-store-web/package.json +1 -1
  51. package/packages/mailx-types/mailx-api.d.ts +11 -0
  52. package/packages/mailx-types/mailx-api.d.ts.map +1 -1
  53. package/packages/mailx-types/mailx-api.ts +7 -0
  54. package/packages/mailx-types/package.json +1 -1
  55. /package/packages/mailx-imap/{node_modules.npmglobalize-stash-74140 → node_modules.npmglobalize-stash-33656}/.package-lock.json +0 -0
package/client/app.js CHANGED
@@ -3671,6 +3671,19 @@ onWsEvent((event) => {
3671
3671
  }).catch((e) => console.error("openComposeFromMailto failed:", e?.message || e));
3672
3672
  break;
3673
3673
  }
3674
+ case "openShare": {
3675
+ // C46: Windows Share sheet → rmfmail. rmfshare.exe staged the
3676
+ // shared content; the daemon base64'd any files and pushed this
3677
+ // event. Open compose with the content attached/inlined.
3678
+ openComposeFromShare({
3679
+ title: event.title || "",
3680
+ text: event.text || "",
3681
+ url: event.url || "",
3682
+ attachments: Array.isArray(event.attachments) ? event.attachments : [],
3683
+ skipped: Array.isArray(event.skipped) ? event.skipped : [],
3684
+ }).catch((e) => console.error("openComposeFromShare failed:", e?.message || e));
3685
+ break;
3686
+ }
3674
3687
  case "debugEval": {
3675
3688
  // --debug-server /api/eval: the daemon pushes {id, code}; we
3676
3689
  // evaluate in the live page and answer via debugEvalResult. This
@@ -3784,6 +3797,47 @@ async function openComposeFromMailto(m) {
3784
3797
  }
3785
3798
  catch { /* */ }
3786
3799
  }
3800
+ /** C46: open compose from a Windows Share sheet drop. Shared files become
3801
+ * attachments; shared text/links become the body; a shared page title (or
3802
+ * the first filename) seeds the subject. Skipped files (oversize or
3803
+ * unreadable) are called out in the body — the user must see that a file
3804
+ * they shared is NOT on the outgoing message. */
3805
+ async function openComposeFromShare(s) {
3806
+ const accountsP = getAccounts();
3807
+ let subject = s.title;
3808
+ if (!subject && s.attachments.length) {
3809
+ subject = s.attachments[0].filename +
3810
+ (s.attachments.length > 1 ? ` (+${s.attachments.length - 1} more)` : "");
3811
+ }
3812
+ const frame = showComposeOverlay(subject ? `Compose: ${subject}` : "Compose");
3813
+ const accounts = await accountsP;
3814
+ const escape = (str) => str.replace(/[&<>]/g, c => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" }[c]));
3815
+ const paras = [];
3816
+ if (s.text && s.text !== s.url) {
3817
+ paras.push("<p>" + escape(s.text).replace(/\r?\n/g, "</p><p>") + "</p>");
3818
+ }
3819
+ if (s.url) {
3820
+ const u = escape(s.url);
3821
+ paras.push(`<p><a href="${u}">${u}</a></p>`);
3822
+ }
3823
+ for (const sk of s.skipped) {
3824
+ paras.push(`<p>[Attachment "${escape(sk.name)}" was not added — ${escape(sk.reason)}]</p>`);
3825
+ }
3826
+ const init = {
3827
+ mode: "new",
3828
+ accountId: accounts[0]?.id || "",
3829
+ to: [], cc: [], bcc: [],
3830
+ subject,
3831
+ bodyHtml: paras.join(""),
3832
+ attachments: s.attachments,
3833
+ accounts: accounts.map((a) => ({ id: a.id, name: a.name, email: a.email, signature: a.signature, sig: a.sig })),
3834
+ };
3835
+ sessionStorage.setItem("composeInit", JSON.stringify(init));
3836
+ try {
3837
+ frame?.contentWindow?.postMessage({ type: "compose-init-ready" }, "*");
3838
+ }
3839
+ catch { /* */ }
3840
+ }
3787
3841
  // ── Keyboard shortcuts ──
3788
3842
  // Capture-phase pre-handler: intercept WebView accelerator keys that would
3789
3843
  // otherwise trigger a browser action (Ctrl+R / Ctrl+Shift+R = reload). Call
@@ -4721,6 +4775,21 @@ function applyThreadFilter() {
4721
4775
  console.error("pending mailto pickup failed:", e?.message || e);
4722
4776
  }
4723
4777
  })();
4778
+ // C46: same startup pickup for a pending Windows-share drop (rmfshare.exe
4779
+ // spawned the daemon before its fs.watch armed). Live shares during this
4780
+ // session arrive via the `openShare` event handled in onEvent above.
4781
+ (async () => {
4782
+ try {
4783
+ const { consumePendingShare } = await import("./lib/api-client.js");
4784
+ const data = await consumePendingShare();
4785
+ if (data && (data.attachments.length || data.text || data.url || data.title || data.skipped.length)) {
4786
+ await openComposeFromShare(data);
4787
+ }
4788
+ }
4789
+ catch (e) {
4790
+ console.error("pending share pickup failed:", e?.message || e);
4791
+ }
4792
+ })();
4724
4793
  // Two-line toggle
4725
4794
  optTwoLine?.addEventListener("change", () => {
4726
4795
  const list = document.getElementById("message-list");