emailengine-app 2.74.1 → 2.74.2
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/CHANGELOG.md +16 -0
- package/data/google-crawlers.json +1 -1
- package/lib/account.js +23 -45
- package/lib/api-routes/changes-routes.js +51 -0
- package/lib/api-routes/index.js +160 -0
- package/lib/consts.js +15 -0
- package/lib/email-client/gmail/send-request.js +69 -0
- package/lib/email-client/gmail-client.js +4 -41
- package/lib/email-client/imap/detach-client.js +27 -0
- package/lib/email-client/imap/listing-diff.js +165 -0
- package/lib/email-client/imap/mailbox.js +32 -13
- package/lib/email-client/imap/subconnection.js +2 -4
- package/lib/email-client/imap/sync-operations.js +5 -3
- package/lib/email-client/imap-client.js +50 -84
- package/lib/email-client/outlook/send-request.js +48 -0
- package/lib/email-client/outlook-client.js +5 -14
- package/lib/export.js +97 -21
- package/lib/imapproxy/imap-core/lib/imap-connection.js +1 -1
- package/lib/logger.js +14 -6
- package/lib/rate-limit.js +33 -11
- package/lib/response-stream.js +138 -0
- package/lib/sentry.js +8 -0
- package/lib/smtp-message-processor.js +131 -0
- package/lib/tools.js +28 -5
- package/lib/ui-routes/internals-routes.js +32 -0
- package/package.json +6 -6
- package/sbom.json +1 -1
- package/static/licenses.html +22 -12
- package/translations/messages.pot +35 -35
- package/views/internals/index.hbs +8 -0
- package/workers/api.js +20 -216
- package/workers/export.js +29 -15
- package/workers/imap.js +47 -10
- package/workers/smtp.js +50 -91
package/lib/tools.js
CHANGED
|
@@ -37,7 +37,9 @@ const {
|
|
|
37
37
|
FETCH_RETRY_EXPONENTIAL,
|
|
38
38
|
FETCH_RETRY_MAX,
|
|
39
39
|
URL_FETCH_RETRY_MAX,
|
|
40
|
-
MAX_DAYS_STATS
|
|
40
|
+
MAX_DAYS_STATS,
|
|
41
|
+
MAILBOX_RESPONSE_FIELDS,
|
|
42
|
+
MAILBOX_HASH
|
|
41
43
|
} = require('./consts');
|
|
42
44
|
const bullmqPackage = require('bullmq/package.json');
|
|
43
45
|
|
|
@@ -531,6 +533,20 @@ module.exports = {
|
|
|
531
533
|
return path;
|
|
532
534
|
},
|
|
533
535
|
|
|
536
|
+
// Hashed component of a mailbox's per-folder Redis keys: a hash of the normalized path, so an
|
|
537
|
+
// arbitrarily long (or delimiter-heavy) folder name maps to a compact, stable key.
|
|
538
|
+
mailboxPathHash(path) {
|
|
539
|
+
return BigInt('0x' + createHash(MAILBOX_HASH).update(module.exports.normalizePath(path)).digest('hex')).toString(36);
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
// Redis key of a mailbox's status hash (message count, uidNext, ...). Defined here once
|
|
543
|
+
// because the writer (lib/email-client/imap/mailbox.js) and the reader
|
|
544
|
+
// (Account.getMailboxListing) must agree byte for byte or the counters silently go missing.
|
|
545
|
+
// NB: distinct from Account.getMailboxHashKey(), which is the account-wide message-id index.
|
|
546
|
+
getMailboxStatusKey(account, path) {
|
|
547
|
+
return `${REDIS_PREFIX}iam:${account}:h:${module.exports.mailboxPathHash(path)}`;
|
|
548
|
+
},
|
|
549
|
+
|
|
534
550
|
async resolveCredentials(account, proto) {
|
|
535
551
|
let authServer = await settings.get('authServer');
|
|
536
552
|
if (!authServer) {
|
|
@@ -1134,11 +1150,11 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV3QUiYsp13nD9suD1/ZkEXnuMoSg
|
|
|
1134
1150
|
let mailboxList = [];
|
|
1135
1151
|
for (let entry of mailboxes) {
|
|
1136
1152
|
let mailbox = {};
|
|
1137
|
-
|
|
1138
|
-
if (
|
|
1153
|
+
for (let key of MAILBOX_RESPONSE_FIELDS) {
|
|
1154
|
+
if (key in entry) {
|
|
1139
1155
|
mailbox[key] = entry[key];
|
|
1140
1156
|
}
|
|
1141
|
-
}
|
|
1157
|
+
}
|
|
1142
1158
|
if (mailbox.delimiter && mailbox.path.indexOf(mailbox.delimiter) >= 0) {
|
|
1143
1159
|
mailbox.parentPath = mailbox.path.substr(0, mailbox.path.lastIndexOf(mailbox.delimiter));
|
|
1144
1160
|
}
|
|
@@ -2258,6 +2274,7 @@ oPpCZh28fyCPv2TZ
|
|
|
2258
2274
|
t0xCngRgaIZRuD3T
|
|
2259
2275
|
dBb0Tc1IggSKY8dD
|
|
2260
2276
|
exRqrporGRl2rjBf
|
|
2277
|
+
/3wJNVxD2zYMP0pk
|
|
2261
2278
|
r+p1xHpDF4Ct0jfn
|
|
2262
2279
|
QeunHH85jTFcsR7e
|
|
2263
2280
|
kBFI6x6tfC8K1C8E
|
|
@@ -2373,6 +2390,12 @@ mF3GOI+Ev7mJODtG
|
|
|
2373
2390
|
nQNwPlZ+tyx24XVo
|
|
2374
2391
|
olObiSmdzVaMp7lH
|
|
2375
2392
|
SruXHv6plKL9YuAW
|
|
2393
|
+
WVyvxP7wyEaQ/hzD
|
|
2394
|
+
YkdM9t/TzipfB13O
|
|
2395
|
+
LVvUBJQhWMOmq/mt
|
|
2396
|
+
+SJ8ylImwdExbw/8
|
|
2397
|
+
KvUe4HhYDNDXDouN
|
|
2398
|
+
jYfRjAsQtmeJcUTk
|
|
2376
2399
|
cyp1GKV4Cl+eC8G/
|
|
2377
2400
|
Q1y/TzbtUQCqnotR
|
|
2378
2401
|
59Q2qOkuyTLzQDhd
|
|
@@ -2399,7 +2422,7 @@ QodzxvoJ6NPGhCgW
|
|
|
2399
2422
|
b85BMAFRHn10uX8y
|
|
2400
2423
|
vV2RgfFH2YFTYsly
|
|
2401
2424
|
zcmIO3obSzUVHGtF
|
|
2402
|
-
|
|
2425
|
+
Qm55I3Y1yUsDhHBU
|
|
2403
2426
|
DkCU3OpaSa+rIVfU
|
|
2404
2427
|
dcDjqpxVxivT46Rl
|
|
2405
2428
|
QSgNcpNukC9CBNfe
|
|
@@ -20,6 +20,14 @@ const THREAD_TYPE_ORDER = ['main', 'api', 'imap', 'webhooks', 'submit', 'export'
|
|
|
20
20
|
// Severity ranking for the per-group health roll-up (higher wins).
|
|
21
21
|
const STATUS_RANK = { success: 0, neutral: 1, warning: 2, error: 3 };
|
|
22
22
|
|
|
23
|
+
// "Recently restarted" detection. Workers normally come online within seconds of the main
|
|
24
|
+
// process; one that came online much later was respawned after a crash (uncaught exception).
|
|
25
|
+
// A worker is flagged only when it started well after main (RESTART_GRACE, beyond any normal
|
|
26
|
+
// staggered-boot spread) AND that restart is still recent (RECENT_WINDOW), so a long-since
|
|
27
|
+
// recovered worker fades back to healthy while a flapping one stays flagged.
|
|
28
|
+
const WORKER_RESTART_GRACE = 3 * 60 * 1000; // 3 min after main = a restart, not normal boot
|
|
29
|
+
const WORKER_RESTART_RECENT_WINDOW = 30 * 60 * 1000; // keep flagging for 30 min after the restart
|
|
30
|
+
|
|
23
31
|
// Short description of what each worker kind does, shown on the group card header.
|
|
24
32
|
const THREAD_PURPOSE = {
|
|
25
33
|
main: 'Orchestrates everything else: spawns and monitors the other worker threads, assigns email accounts to the sync workers, routes inter-thread calls, and manages the Redis connection and licensing.',
|
|
@@ -67,6 +75,13 @@ function init(args) {
|
|
|
67
75
|
bytesFormatter = new Intl.NumberFormat('en-US', bytesFormatterOpts);
|
|
68
76
|
}
|
|
69
77
|
|
|
78
|
+
// Reference point for "recently restarted" detection: the main thread's online
|
|
79
|
+
// time is the process start, so any worker that came online well after it was
|
|
80
|
+
// respawned after boot rather than started with the fleet.
|
|
81
|
+
let now = Date.now();
|
|
82
|
+
let mainThread = threads.find(threadInfo => threadInfo.isMain || threadInfo.type === 'main');
|
|
83
|
+
let mainOnline = mainThread && typeof mainThread.online === 'number' ? mainThread.online : null;
|
|
84
|
+
|
|
70
85
|
// Process each thread into row data. The per-thread config (expected worker
|
|
71
86
|
// count) is intentionally NOT surfaced per row here - it is a pool-level fact
|
|
72
87
|
// and is shown once on the group header below.
|
|
@@ -105,6 +120,23 @@ function init(args) {
|
|
|
105
120
|
}
|
|
106
121
|
}
|
|
107
122
|
|
|
123
|
+
// A worker that came online well after the main process, recently, was most
|
|
124
|
+
// likely respawned after an uncaught exception. Surface it as a warning even
|
|
125
|
+
// when its health checks are otherwise passing; a real error/warning health
|
|
126
|
+
// status is more specific and takes precedence.
|
|
127
|
+
if (
|
|
128
|
+
!threadInfo.isMain &&
|
|
129
|
+
mainOnline !== null &&
|
|
130
|
+
typeof threadInfo.online === 'number' &&
|
|
131
|
+
threadInfo.online - mainOnline > WORKER_RESTART_GRACE &&
|
|
132
|
+
now - threadInfo.online < WORKER_RESTART_RECENT_WINDOW &&
|
|
133
|
+
STATUS_RANK[threadInfo.statusVariant] < STATUS_RANK.warning
|
|
134
|
+
) {
|
|
135
|
+
threadInfo.statusVariant = 'warning';
|
|
136
|
+
threadInfo.statusLabel = 'Recently restarted';
|
|
137
|
+
threadInfo.recentlyRestarted = true;
|
|
138
|
+
}
|
|
139
|
+
|
|
108
140
|
if (threadInfo.online) {
|
|
109
141
|
threadInfo.timeStr = new Date(threadInfo.online).toISOString();
|
|
110
142
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emailengine-app",
|
|
3
|
-
"version": "2.74.
|
|
3
|
+
"version": "2.74.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"productTitle": "EmailEngine",
|
|
6
6
|
"description": "Email Sync Engine",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"@postalsys/gettext": "4.1.1",
|
|
70
70
|
"@postalsys/joi-messages": "1.0.5",
|
|
71
71
|
"@postalsys/templates": "2.0.1",
|
|
72
|
-
"@sentry/node": "10.
|
|
72
|
+
"@sentry/node": "10.68.0",
|
|
73
73
|
"@simplewebauthn/browser": "13.3.0",
|
|
74
74
|
"@simplewebauthn/server": "13.3.2",
|
|
75
75
|
"@zone-eu/mailsplit": "5.4.14",
|
|
76
76
|
"@zone-eu/wild-config": "1.7.6",
|
|
77
77
|
"ace-builds": "1.44.0",
|
|
78
78
|
"base32.js": "0.1.0",
|
|
79
|
-
"bullmq": "5.81.
|
|
79
|
+
"bullmq": "5.81.2",
|
|
80
80
|
"compare-versions": "6.1.1",
|
|
81
81
|
"dotenv": "17.4.2",
|
|
82
82
|
"encoding-japanese": "2.2.0",
|
|
@@ -115,20 +115,20 @@
|
|
|
115
115
|
"socks": "2.8.9",
|
|
116
116
|
"speakeasy": "2.0.0",
|
|
117
117
|
"timezones-list": "3.1.0",
|
|
118
|
-
"undici": "7.
|
|
118
|
+
"undici": "7.29.0",
|
|
119
119
|
"xml2js": "0.6.2"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@eslint/js": "10.0.1",
|
|
123
123
|
"@iconify-json/tabler": "1.2.37",
|
|
124
124
|
"@iconify/tailwind4": "1.2.3",
|
|
125
|
-
"@playwright/test": "1.
|
|
125
|
+
"@playwright/test": "1.62.0",
|
|
126
126
|
"@tailwindcss/cli": "4.3.3",
|
|
127
127
|
"acorn": "8.17.0",
|
|
128
128
|
"acorn-walk": "8.3.5",
|
|
129
129
|
"chai": "4.5.0",
|
|
130
130
|
"eerawlog": "1.5.5",
|
|
131
|
-
"eslint": "10.
|
|
131
|
+
"eslint": "10.8.0",
|
|
132
132
|
"flyonui": "2.4.1",
|
|
133
133
|
"grunt": "1.6.2",
|
|
134
134
|
"grunt-cli": "1.5.0",
|