@bobfrankston/mailx-imap 0.1.63 → 0.1.65
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/index.js +25 -3
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -113,8 +113,20 @@ async function extractPreview(source) {
|
|
|
113
113
|
const parsed = await parseSerial(fixCharsetDeclString(source), "background");
|
|
114
114
|
const bodyText = parsed.text || "";
|
|
115
115
|
const bodyHtml = parsed.html || "";
|
|
116
|
-
//
|
|
117
|
-
|
|
116
|
+
// Prefer HTML so we can replace <img> with [image] before tag-strip;
|
|
117
|
+
// fall back to text if no HTML part. Either source then gets any
|
|
118
|
+
// remaining base64 data: URIs (rare: text/plain copies generated
|
|
119
|
+
// from a Quill compose pasted-image HTML) collapsed to [image] too.
|
|
120
|
+
let raw;
|
|
121
|
+
if (bodyHtml) {
|
|
122
|
+
raw = bodyHtml
|
|
123
|
+
.replace(/<img\b[^>]*>/gi, " [image] ")
|
|
124
|
+
.replace(/<[^>]+>/g, " ");
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
raw = bodyText;
|
|
128
|
+
}
|
|
129
|
+
raw = raw.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=\s]+/gi, "[image]");
|
|
118
130
|
const preview = decodeEntities(raw).replace(/\s+/g, " ").trim().slice(0, 200);
|
|
119
131
|
const hasAttachments = (parsed.attachments?.length || 0) > 0;
|
|
120
132
|
return { bodyHtml, bodyText, preview, hasAttachments };
|
|
@@ -4224,7 +4236,17 @@ export class ImapManager extends EventEmitter {
|
|
|
4224
4236
|
}, { slow: true });
|
|
4225
4237
|
}
|
|
4226
4238
|
catch { /* best-effort */ }
|
|
4227
|
-
|
|
4239
|
+
// Suppress the banner for transient network errors. ETIMEDOUT
|
|
4240
|
+
// on a Dovecot send is the server being slow / a TCP idle
|
|
4241
|
+
// drop, NOT a user-actionable failure — the next outbox tick
|
|
4242
|
+
// retries with exponential backoff. Surfacing it as a sticky
|
|
4243
|
+
// "Send failed: ETIMEDOUT" banner trains the user to ignore
|
|
4244
|
+
// banners (Bob 2026-05-26 "timeout??"). handleSyncError uses
|
|
4245
|
+
// the same classifier; keep the two paths in sync.
|
|
4246
|
+
const isTransient = /timeout|ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENETUNREACH|Too many|socket hang up|EPIPE|write after end/i.test(errMsg);
|
|
4247
|
+
if (!isTransient) {
|
|
4248
|
+
this.emit("accountError", accountId, `Send failed: ${errMsg}`, "Message kept in Outbox", false);
|
|
4249
|
+
}
|
|
4228
4250
|
if (/auth|login|credential|invalid/i.test(errMsg)) {
|
|
4229
4251
|
this.outboxBackoff.set(accountId, Date.now() + 3600000); // 1 hour
|
|
4230
4252
|
console.error(` [outbox] Auth failure for ${accountId} — outbox paused for 1 hour`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
13
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
13
|
+
"@bobfrankston/mailx-settings": "^0.1.24",
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.38",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.50",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
".transformedSnapshot": {
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
41
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
41
|
+
"@bobfrankston/mailx-settings": "^0.1.24",
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.38",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.50",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.8",
|