@bobfrankston/mailx-imap 0.1.152 → 0.1.155
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 +17 -1
- package/package.json +9 -9
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { createAutoImapConfig, CompatImapClient } from "@bobfrankston/iflow-dire
|
|
|
7
7
|
import { authenticateOAuth, clearReauthBackoff } from "@bobfrankston/oauthsupport";
|
|
8
8
|
import { parseSerial, fixCharsetDeclString, storeBus } from "@bobfrankston/mailx-store";
|
|
9
9
|
import { loadSettings, getConfigDir, getHistoryDays, getPrefetch, tokenDirName } from "@bobfrankston/mailx-settings";
|
|
10
|
+
import { isJunkPreviewText } from "@bobfrankston/mailx-types";
|
|
10
11
|
import { EventEmitter } from "node:events";
|
|
11
12
|
import * as fs from "node:fs";
|
|
12
13
|
import * as path from "node:path";
|
|
@@ -146,8 +147,15 @@ async function extractPreview(source) {
|
|
|
146
147
|
// present, otherwise a tags-and-images-stripped rendering of the HTML,
|
|
147
148
|
// i.e. the actual words. Only fall back to HTML when there's no usable
|
|
148
149
|
// text at all (genuinely image-only mail).
|
|
150
|
+
// …but a text part is only usable if it contains actual words. Some
|
|
151
|
+
// senders (Adobe Firefly / Creative Cloud, Xfinity) build the
|
|
152
|
+
// text/plain alternative in JavaScript and stringify a missing value
|
|
153
|
+
// into it, so the whole part is the word "undefined" — which sailed
|
|
154
|
+
// past the length check below and became the row summary
|
|
155
|
+
// (Bob 2026-08-19: "undefined?"). 40 such messages in the bobma store,
|
|
156
|
+
// 33 of them with a perfectly good HTML part to summarize instead.
|
|
149
157
|
const textCandidate = (bodyText || "").replace(/\s+/g, " ").trim();
|
|
150
|
-
if (textCandidate.length >= 3) {
|
|
158
|
+
if (textCandidate.length >= 3 && !isJunkPreviewText(textCandidate)) {
|
|
151
159
|
raw = bodyText;
|
|
152
160
|
}
|
|
153
161
|
else if (bodyHtml) {
|
|
@@ -168,6 +176,14 @@ async function extractPreview(source) {
|
|
|
168
176
|
raw = bodyText;
|
|
169
177
|
}
|
|
170
178
|
raw = raw.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=\s]+/gi, "[image]");
|
|
179
|
+
// Strip zero-width padding BEFORE the 200-char slice. Marketing mail
|
|
180
|
+
// pads its preheader with long runs of U+200C so an inbox preview
|
|
181
|
+
// shows only the intended line — but those runs are not whitespace, so
|
|
182
|
+
// the \s+ collapse below left them in and they ate most of the budget
|
|
183
|
+
// (Adobe/Xfinity summaries were one sentence then ~120 invisible chars).
|
|
184
|
+
// Escapes on purpose here: literal zero-width characters in source are
|
|
185
|
+
// unreadable and editors silently eat them.
|
|
186
|
+
raw = raw.replace(/[\u200B-\u200D\u2060\uFEFF]/g, "");
|
|
171
187
|
const preview = decodeEntities(raw).replace(/\s+/g, " ").trim().slice(0, 200);
|
|
172
188
|
const hasAttachments = (parsed.attachments?.length || 0) > 0;
|
|
173
189
|
return { bodyHtml, bodyText, preview, hasAttachments };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.155",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bobfrankston/mailx-types": "^0.1.
|
|
13
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
12
|
+
"@bobfrankston/mailx-types": "^0.1.53",
|
|
13
|
+
"@bobfrankston/mailx-settings": "^0.1.54",
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.87",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.65",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.8",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.9",
|
|
18
18
|
"@bobfrankston/mailx-sync": "^0.1.29",
|
|
19
|
-
"@bobfrankston/oauthsupport": "^1.0.
|
|
19
|
+
"@bobfrankston/oauthsupport": "^1.0.35"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
},
|
|
38
38
|
".transformedSnapshot": {
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@bobfrankston/mailx-types": "^0.1.
|
|
41
|
-
"@bobfrankston/mailx-settings": "^0.1.
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
40
|
+
"@bobfrankston/mailx-types": "^0.1.53",
|
|
41
|
+
"@bobfrankston/mailx-settings": "^0.1.54",
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.87",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.65",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.8",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.9",
|
|
46
46
|
"@bobfrankston/mailx-sync": "^0.1.29",
|
|
47
|
-
"@bobfrankston/oauthsupport": "^1.0.
|
|
47
|
+
"@bobfrankston/oauthsupport": "^1.0.35"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|