@bobfrankston/rmfmail 1.1.190 → 1.1.192

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.
@@ -407,13 +407,14 @@ function installConsoleCapture() {
407
407
  }
408
408
  };
409
409
  console.log = (...args) => {
410
- forward("log", args);
411
410
  orig.log(...args);
412
411
  };
413
412
  console.info = (...args) => {
414
- forward("info", args);
415
413
  orig.info(...args);
416
414
  };
415
+ console.debug = (...args) => {
416
+ orig.debug(...args);
417
+ };
417
418
  console.warn = (...args) => {
418
419
  forward("warn", args);
419
420
  orig.warn(...args);
@@ -422,10 +423,6 @@ function installConsoleCapture() {
422
423
  forward("error", args);
423
424
  orig.error(...args);
424
425
  };
425
- console.debug = (...args) => {
426
- forward("debug", args);
427
- orig.debug(...args);
428
- };
429
426
  try {
430
427
  window.addEventListener("error", (e) => {
431
428
  try {
@@ -442,8 +439,11 @@ function installConsoleCapture() {
442
439
  window.addEventListener("unhandledrejection", (e) => {
443
440
  try {
444
441
  const r = e.reason;
442
+ const msg = r?.message || String(r);
443
+ if (/logClientEvent|mailxapi timeout/i.test(msg))
444
+ return;
445
445
  logClientEvent("window.unhandledrejection", {
446
- message: r?.message || String(r),
446
+ message: msg,
447
447
  stack: r?.stack || null
448
448
  });
449
449
  } catch {
@@ -457,7 +457,10 @@ function logClientEvent(tag, data) {
457
457
  try {
458
458
  const bridge = typeof globalThis.mailxapi !== "undefined" && globalThis.mailxapi?.isApp ? globalThis.mailxapi : window.opener?.mailxapi?.isApp ? window.opener.mailxapi : window.parent?.mailxapi?.isApp ? window.parent.mailxapi : null;
459
459
  if (bridge?.logClientEvent) {
460
- bridge.logClientEvent(tag, data);
460
+ const p = bridge.logClientEvent(tag, data);
461
+ if (p && typeof p.catch === "function")
462
+ p.catch(() => {
463
+ });
461
464
  delivered = true;
462
465
  }
463
466
  } catch {
@@ -7444,17 +7447,24 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
7444
7447
  const identityDomains = foldDomains(
7445
7448
  explicitDomains.length > 0 ? explicitDomains : accountDomain ? [accountDomain] : []
7446
7449
  );
7450
+ function bareAddress(raw) {
7451
+ if (!raw) return raw;
7452
+ const angle = raw.match(/<([^>]+)>/);
7453
+ if (angle) return angle[1].trim();
7454
+ return raw.trim().replace(/^"+|"+$/g, "");
7455
+ }
7447
7456
  function detectReplyFrom() {
7448
7457
  if (!msg) return void 0;
7449
7458
  if (msg.deliveredTo) {
7450
- console.log(`[compose] reply From \u2192 ${msg.deliveredTo} (Delivered-To)`);
7451
- return msg.deliveredTo;
7459
+ const addr = bareAddress(msg.deliveredTo);
7460
+ console.log(`[compose] reply From \u2192 ${addr} (Delivered-To, bare of "${msg.deliveredTo}")`);
7461
+ return addr;
7452
7462
  }
7453
7463
  if (identityDomains.length === 0) return void 0;
7454
7464
  const candidates = [
7455
7465
  ...(msg.to || []).map((a) => a.address),
7456
7466
  ...(msg.cc || []).map((a) => a.address)
7457
- ].filter(Boolean);
7467
+ ].filter(Boolean).map(bareAddress);
7458
7468
  for (const addr of candidates) {
7459
7469
  const domain = addr.split("@")[1]?.toLowerCase();
7460
7470
  if (domain && identityDomains.some((d) => domain === d || domain.endsWith(`.${d}`))) {