@bobfrankston/mailx 1.0.223 → 1.0.224
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/package.json +5 -5
- package/packages/mailx-imap/index.js +15 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.224",
|
|
4
4
|
"description": "Local-first email client with IMAP sync and standalone native app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/mailx.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"postinstall": "node bin/postinstall.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@bobfrankston/iflow-direct": "^0.1.
|
|
23
|
+
"@bobfrankston/iflow-direct": "^0.1.10",
|
|
24
24
|
"@bobfrankston/iflow-node": "^0.1.2",
|
|
25
25
|
"@bobfrankston/miscinfo": "^1.0.8",
|
|
26
26
|
"@bobfrankston/oauthsupport": "^1.0.22",
|
|
27
|
-
"@bobfrankston/msger": "^0.1.
|
|
27
|
+
"@bobfrankston/msger": "^0.1.286",
|
|
28
28
|
"@capacitor/android": "^8.3.0",
|
|
29
29
|
"@capacitor/cli": "^8.3.0",
|
|
30
30
|
"@capacitor/core": "^8.3.0",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
},
|
|
75
75
|
".transformedSnapshot": {
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@bobfrankston/iflow-direct": "^0.1.
|
|
77
|
+
"@bobfrankston/iflow-direct": "^0.1.10",
|
|
78
78
|
"@bobfrankston/iflow-node": "^0.1.2",
|
|
79
79
|
"@bobfrankston/miscinfo": "^1.0.8",
|
|
80
80
|
"@bobfrankston/oauthsupport": "^1.0.22",
|
|
81
|
-
"@bobfrankston/msger": "^0.1.
|
|
81
|
+
"@bobfrankston/msger": "^0.1.286",
|
|
82
82
|
"@capacitor/android": "^8.3.0",
|
|
83
83
|
"@capacitor/cli": "^8.3.0",
|
|
84
84
|
"@capacitor/core": "^8.3.0",
|
|
@@ -371,24 +371,35 @@ export class ImapManager extends EventEmitter {
|
|
|
371
371
|
}
|
|
372
372
|
const tokenDir = path.join(getConfigDir(), "tokens", account.imap.user.replace(/[@.]/g, "_"));
|
|
373
373
|
tokenProvider = async () => {
|
|
374
|
-
|
|
374
|
+
// Wrap authenticateOAuth with a 30s wall-clock timeout. Without this,
|
|
375
|
+
// a hung OAuth server could block the entire sync thread indefinitely.
|
|
376
|
+
const TOKEN_FETCH_TIMEOUT_MS = 30000;
|
|
377
|
+
const authPromise = authenticateOAuth(credPath, {
|
|
375
378
|
scope: "https://mail.google.com/ https://www.googleapis.com/auth/contacts.readonly https://www.googleapis.com/auth/calendar",
|
|
376
379
|
tokenDirectory: tokenDir,
|
|
377
380
|
credentialsKey: "installed",
|
|
378
381
|
loginHint: account.imap.user,
|
|
379
382
|
});
|
|
383
|
+
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`OAuth token fetch timeout (${TOKEN_FETCH_TIMEOUT_MS / 1000}s)`)), TOKEN_FETCH_TIMEOUT_MS));
|
|
384
|
+
const result = await Promise.race([authPromise, timeoutPromise]);
|
|
380
385
|
return result?.access_token || "";
|
|
381
386
|
};
|
|
382
387
|
}
|
|
388
|
+
// Non-Gmail accounts (typically Dovecot / generic IMAP) get a smaller
|
|
389
|
+
// fetch chunk size (10 vs 25) and longer inactivity timeout (300s) so
|
|
390
|
+
// multi-body FETCH batches don't trip the connection-dead detector on
|
|
391
|
+
// slow servers. Gmail stays at the defaults since it's fast and has
|
|
392
|
+
// its own rate limits to respect.
|
|
393
|
+
const isGmail = account.imap.host?.includes("gmail") || account.email.endsWith("@gmail.com");
|
|
383
394
|
const config = createAutoImapConfig({
|
|
384
395
|
server: account.imap.host,
|
|
385
396
|
port: account.imap.port,
|
|
386
397
|
username: account.imap.user,
|
|
387
398
|
password: account.imap.password,
|
|
388
399
|
tokenProvider,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
400
|
+
inactivityTimeout: isGmail ? 60000 : 300000,
|
|
401
|
+
fetchChunkSize: isGmail ? 25 : 10,
|
|
402
|
+
fetchChunkSizeMax: isGmail ? 500 : 100,
|
|
392
403
|
});
|
|
393
404
|
this.configs.set(account.id, config);
|
|
394
405
|
// Register account in DB
|