@bobfrankston/rmfmail 1.2.178 → 1.2.179

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 (31) hide show
  1. package/client/android-bootstrap.bundle.js +55 -6
  2. package/client/android-bootstrap.bundle.js.map +3 -3
  3. package/client/app.bundle.js +8 -0
  4. package/client/app.bundle.js.map +3 -3
  5. package/package.json +5 -5
  6. package/packages/mailx-imap/package-lock.json +2 -2
  7. package/packages/mailx-imap/package.json +1 -1
  8. package/packages/mailx-service/index.d.ts.map +1 -1
  9. package/packages/mailx-service/index.js +37 -11
  10. package/packages/mailx-service/index.js.map +1 -1
  11. package/packages/mailx-service/index.ts +38 -12
  12. package/packages/mailx-service/package.json +1 -1
  13. package/packages/mailx-settings/package.json +1 -1
  14. package/packages/mailx-store/package.json +1 -1
  15. package/packages/mailx-store-web/package.json +1 -1
  16. package/packages/mailx-store-web/web-service.d.ts.map +1 -1
  17. package/packages/mailx-store-web/web-service.js +30 -7
  18. package/packages/mailx-store-web/web-service.js.map +1 -1
  19. package/packages/mailx-store-web/web-service.ts +31 -8
  20. package/packages/mailx-types/index.d.ts +2 -0
  21. package/packages/mailx-types/index.d.ts.map +1 -1
  22. package/packages/mailx-types/index.js +3 -0
  23. package/packages/mailx-types/index.js.map +1 -1
  24. package/packages/mailx-types/index.ts +5 -0
  25. package/packages/mailx-types/mime-inline-images.d.ts +38 -0
  26. package/packages/mailx-types/mime-inline-images.d.ts.map +1 -0
  27. package/packages/mailx-types/mime-inline-images.js +45 -0
  28. package/packages/mailx-types/mime-inline-images.js.map +1 -0
  29. package/packages/mailx-types/mime-inline-images.ts +55 -0
  30. package/packages/mailx-types/package.json +1 -1
  31. /package/packages/mailx-imap/{node_modules.npmglobalize-stash-7544 → node_modules.npmglobalize-stash-48352}/.package-lock.json +0 -0
@@ -2386,6 +2386,28 @@ var init_reminder_state = __esm({
2386
2386
  }
2387
2387
  });
2388
2388
 
2389
+ // packages/mailx-types/mime-inline-images.js
2390
+ function extractInlineImages(html, idDomain) {
2391
+ const images = [];
2392
+ const byDataUri = /* @__PURE__ */ new Map();
2393
+ const stamp = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
2394
+ const out = html.replace(/(<img\b[^>]*?\ssrc=)(["'])(data:(image\/[\w.+-]+);base64,([A-Za-z0-9+/=\s]+))\2/gi, (_m, prefix, quote, dataUri, mime, b64) => {
2395
+ let cid = byDataUri.get(dataUri);
2396
+ if (!cid) {
2397
+ cid = `img${images.length + 1}.${stamp}@${idDomain}`;
2398
+ byDataUri.set(dataUri, cid);
2399
+ images.push({ contentId: cid, mime, base64: b64.replace(/\s+/g, "") });
2400
+ }
2401
+ return `${prefix}${quote}cid:${cid}${quote}`;
2402
+ });
2403
+ return { html: out, images };
2404
+ }
2405
+ var init_mime_inline_images = __esm({
2406
+ "packages/mailx-types/mime-inline-images.js"() {
2407
+ "use strict";
2408
+ }
2409
+ });
2410
+
2389
2411
  // packages/mailx-types/index.js
2390
2412
  var mailx_types_exports = {};
2391
2413
  __export(mailx_types_exports, {
@@ -2399,6 +2421,7 @@ __export(mailx_types_exports, {
2399
2421
  encodeQuotedPrintable: () => encodeQuotedPrintable,
2400
2422
  expandRecipients: () => expandRecipients,
2401
2423
  extractAddress: () => extractAddress,
2424
+ extractInlineImages: () => extractInlineImages,
2402
2425
  flaggedOf: () => flaggedOf,
2403
2426
  htmlToPlainText: () => htmlToPlainText,
2404
2427
  isAddressToken: () => isAddressToken,
@@ -2607,6 +2630,7 @@ var init_mailx_types = __esm({
2607
2630
  init_contacts_config();
2608
2631
  init_groups();
2609
2632
  init_reminder_state();
2633
+ init_mime_inline_images();
2610
2634
  _SEEN = "\\Seen";
2611
2635
  _FLAGGED = "\\Flagged";
2612
2636
  _ANSWERED = "\\Answered";
@@ -6170,12 +6194,14 @@ var WebMailxService = class _WebMailxService {
6170
6194
  const cc = msg.cc?.map((a) => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
6171
6195
  const bcc = msg.bcc?.map((a) => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
6172
6196
  const hasHtml = !!msg.bodyHtml;
6173
- const htmlBody = msg.bodyHtml || "";
6197
+ const domain = account.email.split("@")[1] || "mailx.local";
6198
+ const messageId = `<${Date.now()}.${Math.random().toString(36).slice(2)}@${domain}>`;
6199
+ const extracted = hasHtml ? extractInlineImages(msg.bodyHtml, domain) : { html: "", images: [] };
6200
+ const htmlBody = extracted.html;
6201
+ const inlineImages = extracted.images;
6174
6202
  const textBody = msg.bodyText || (hasHtml ? htmlToPlainText(htmlBody) : "");
6175
6203
  const htmlEncoded = hasHtml ? encodeQuotedPrintable(htmlBody) : "";
6176
6204
  const textEncoded = encodeQuotedPrintable(textBody);
6177
- const domain = account.email.split("@")[1] || "mailx.local";
6178
- const messageId = `<${Date.now()}.${Math.random().toString(36).slice(2)}@${domain}>`;
6179
6205
  const envelope = [
6180
6206
  `From: ${fromHeader}`,
6181
6207
  `To: ${to}`,
@@ -6188,9 +6214,11 @@ var WebMailxService = class _WebMailxService {
6188
6214
  msg.references?.length ? `References: ${msg.references.join(" ")}` : null,
6189
6215
  `MIME-Version: 1.0`
6190
6216
  ].filter((h) => h !== null);
6217
+ const newBoundary = () => `mailx_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
6218
+ const wrap76 = (s) => s.match(/.{1,76}/g)?.join("\r\n") || s;
6191
6219
  const makeInner = () => {
6192
6220
  if (hasHtml) {
6193
- const altBoundary = `mailx_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
6221
+ const altBoundary = newBoundary();
6194
6222
  const body = `--${altBoundary}\r
6195
6223
  Content-Type: text/plain; charset=UTF-8\r
6196
6224
  Content-Transfer-Encoding: quoted-printable\r
@@ -6203,7 +6231,29 @@ Content-Transfer-Encoding: quoted-printable\r
6203
6231
  ${htmlEncoded}\r
6204
6232
  --${altBoundary}--\r
6205
6233
  `;
6206
- return { headers: [`Content-Type: multipart/alternative; boundary="${altBoundary}"`], body };
6234
+ const alt = { headers: [`Content-Type: multipart/alternative; boundary="${altBoundary}"`], body };
6235
+ if (inlineImages.length === 0)
6236
+ return alt;
6237
+ const relBoundary = newBoundary();
6238
+ const relParts = [
6239
+ `--${relBoundary}\r
6240
+ ` + alt.headers.join("\r\n") + `\r
6241
+ \r
6242
+ ` + alt.body,
6243
+ ...inlineImages.map((im) => `--${relBoundary}\r
6244
+ Content-Type: ${im.mime}\r
6245
+ Content-ID: <${im.contentId}>\r
6246
+ Content-Disposition: inline\r
6247
+ Content-Transfer-Encoding: base64\r
6248
+ \r
6249
+ ${wrap76(im.base64)}\r
6250
+ `)
6251
+ ];
6252
+ return {
6253
+ headers: [`Content-Type: multipart/related; boundary="${relBoundary}"; type="multipart/alternative"`],
6254
+ body: relParts.join("") + `--${relBoundary}--\r
6255
+ `
6256
+ };
6207
6257
  }
6208
6258
  return {
6209
6259
  headers: [`Content-Type: text/plain; charset=UTF-8`, `Content-Transfer-Encoding: quoted-printable`],
@@ -6213,7 +6263,6 @@ ${htmlEncoded}\r
6213
6263
  const atts = Array.isArray(msg.attachments) ? msg.attachments : [];
6214
6264
  let rawMessage;
6215
6265
  if (atts.length > 0) {
6216
- const wrap76 = (s) => s.match(/.{1,76}/g)?.join("\r\n") || s;
6217
6266
  const mixedBoundary = `mailxmix_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
6218
6267
  const inner = makeInner();
6219
6268
  const parts = [];