@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.
package/client/app.ts CHANGED
@@ -858,6 +858,18 @@ async function openCompose(mode: ComposeMode, overrideMsg?: any, overrideAccount
858
858
  ? explicitDomains
859
859
  : (accountDomain ? [accountDomain] : []),
860
860
  );
861
+ // Extract the bare email address from a header value that may be a full
862
+ // `"Display Name" <addr@host>` form. detectReplyFrom must return a BARE
863
+ // address because the compose side wraps it as `${accountName} <${addr}>`
864
+ // — passing a full name+addr there produced the nested garbage
865
+ // `Bob Frankston <"mailing list" <multicians@groups.io>>` (Bob 2026-05-28).
866
+ // Delivered-To on mailing-list mail commonly carries a display name.
867
+ function bareAddress(raw: string): string {
868
+ if (!raw) return raw;
869
+ const angle = raw.match(/<([^>]+)>/);
870
+ if (angle) return angle[1].trim();
871
+ return raw.trim().replace(/^"+|"+$/g, "");
872
+ }
861
873
  function detectReplyFrom(): string | undefined {
862
874
  if (!msg) return undefined;
863
875
  // Delivered-To is set by the receiving server — it IS an identity at this
@@ -866,14 +878,15 @@ async function openCompose(mode: ComposeMode, overrideMsg?: any, overrideAccount
866
878
  // when their domain matches the account's identityDomains, since To/Cc
867
879
  // can be set by the sender and aren't authoritative.
868
880
  if (msg.deliveredTo) {
869
- console.log(`[compose] reply From → ${msg.deliveredTo} (Delivered-To)`);
870
- return msg.deliveredTo;
881
+ const addr = bareAddress(msg.deliveredTo);
882
+ console.log(`[compose] reply From → ${addr} (Delivered-To, bare of "${msg.deliveredTo}")`);
883
+ return addr;
871
884
  }
872
885
  if (identityDomains.length === 0) return undefined;
873
886
  const candidates: string[] = [
874
887
  ...((msg.to || []).map((a: any) => a.address)),
875
888
  ...((msg.cc || []).map((a: any) => a.address)),
876
- ].filter(Boolean);
889
+ ].filter(Boolean).map(bareAddress);
877
890
  for (const addr of candidates) {
878
891
  const domain = addr.split("@")[1]?.toLowerCase();
879
892
  if (domain && identityDomains.some(d => domain === d || domain.endsWith(`.${d}`))) {
@@ -1400,13 +1400,14 @@ function installConsoleCapture() {
1400
1400
  }
1401
1401
  };
1402
1402
  console.log = (...args) => {
1403
- forward("log", args);
1404
1403
  orig.log(...args);
1405
1404
  };
1406
1405
  console.info = (...args) => {
1407
- forward("info", args);
1408
1406
  orig.info(...args);
1409
1407
  };
1408
+ console.debug = (...args) => {
1409
+ orig.debug(...args);
1410
+ };
1410
1411
  console.warn = (...args) => {
1411
1412
  forward("warn", args);
1412
1413
  orig.warn(...args);
@@ -1415,10 +1416,6 @@ function installConsoleCapture() {
1415
1416
  forward("error", args);
1416
1417
  orig.error(...args);
1417
1418
  };
1418
- console.debug = (...args) => {
1419
- forward("debug", args);
1420
- orig.debug(...args);
1421
- };
1422
1419
  try {
1423
1420
  window.addEventListener("error", (e) => {
1424
1421
  try {
@@ -1435,8 +1432,11 @@ function installConsoleCapture() {
1435
1432
  window.addEventListener("unhandledrejection", (e) => {
1436
1433
  try {
1437
1434
  const r = e.reason;
1435
+ const msg = r?.message || String(r);
1436
+ if (/logClientEvent|mailxapi timeout/i.test(msg))
1437
+ return;
1438
1438
  logClientEvent("window.unhandledrejection", {
1439
- message: r?.message || String(r),
1439
+ message: msg,
1440
1440
  stack: r?.stack || null
1441
1441
  });
1442
1442
  } catch {
@@ -1450,7 +1450,10 @@ function logClientEvent(tag, data) {
1450
1450
  try {
1451
1451
  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;
1452
1452
  if (bridge?.logClientEvent) {
1453
- bridge.logClientEvent(tag, data);
1453
+ const p = bridge.logClientEvent(tag, data);
1454
+ if (p && typeof p.catch === "function")
1455
+ p.catch(() => {
1456
+ });
1454
1457
  delivered = true;
1455
1458
  }
1456
1459
  } catch {