@bobfrankston/mailx-imap 0.1.75 → 0.1.77
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 +12 -5
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Syncs messages to local store, emits events for new mail.
|
|
5
5
|
*/
|
|
6
6
|
import { createAutoImapConfig, CompatImapClient } from "@bobfrankston/iflow-direct";
|
|
7
|
-
import { authenticateOAuth } from "@bobfrankston/oauthsupport";
|
|
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
10
|
import { EventEmitter } from "node:events";
|
|
@@ -312,6 +312,13 @@ export class ImapManager extends EventEmitter {
|
|
|
312
312
|
fs.unlinkSync(tokenPath);
|
|
313
313
|
console.log(` [reauth] Deleted ${tokenPath}`);
|
|
314
314
|
}
|
|
315
|
+
// User explicitly asked to re-auth — clear any re-auth backoff so
|
|
316
|
+
// addAccount's token validation opens the browser immediately
|
|
317
|
+
// instead of honoring the "don't reopen tabs" cooldown.
|
|
318
|
+
try {
|
|
319
|
+
clearReauthBackoff(tokenDir);
|
|
320
|
+
}
|
|
321
|
+
catch { /* */ }
|
|
315
322
|
// Re-register the account to get a fresh config with new tokenProvider
|
|
316
323
|
this.configs.delete(accountId);
|
|
317
324
|
await this.addAccount(account);
|
|
@@ -2774,7 +2781,7 @@ export class ImapManager extends EventEmitter {
|
|
|
2774
2781
|
if (!raw)
|
|
2775
2782
|
return null;
|
|
2776
2783
|
const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
|
|
2777
|
-
this.db.updateBodyPath(accountId, uid, bodyPath);
|
|
2784
|
+
this.db.updateBodyPath(accountId, folderId, uid, bodyPath);
|
|
2778
2785
|
this.emit("bodyCached", accountId, uid);
|
|
2779
2786
|
return raw;
|
|
2780
2787
|
}
|
|
@@ -2816,7 +2823,7 @@ export class ImapManager extends EventEmitter {
|
|
|
2816
2823
|
}
|
|
2817
2824
|
const raw = Buffer.from(msg.source, "utf-8");
|
|
2818
2825
|
const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
|
|
2819
|
-
this.db.updateBodyPath(accountId, uid, bodyPath);
|
|
2826
|
+
this.db.updateBodyPath(accountId, folderId, uid, bodyPath);
|
|
2820
2827
|
this.emit("bodyCached", accountId, uid);
|
|
2821
2828
|
return raw;
|
|
2822
2829
|
}
|
|
@@ -2997,7 +3004,7 @@ export class ImapManager extends EventEmitter {
|
|
|
2997
3004
|
const raw = Buffer.from(source, "utf-8");
|
|
2998
3005
|
const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
|
|
2999
3006
|
const parsed = await extractPreview(source);
|
|
3000
|
-
this.db.updateBodyMeta(accountId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
|
|
3007
|
+
this.db.updateBodyMeta(accountId, folderId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
|
|
3001
3008
|
this.emit("bodyCached", accountId, uid);
|
|
3002
3009
|
counters.totalFetched++;
|
|
3003
3010
|
madeProgress = true;
|
|
@@ -3129,7 +3136,7 @@ export class ImapManager extends EventEmitter {
|
|
|
3129
3136
|
const raw = Buffer.from(source, "utf-8");
|
|
3130
3137
|
const bodyPath = await this.bodyStore.putMessage(accountId, folderId, uid, raw);
|
|
3131
3138
|
const parsed = await extractPreview(source);
|
|
3132
|
-
this.db.updateBodyMeta(accountId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
|
|
3139
|
+
this.db.updateBodyMeta(accountId, folderId, uid, bodyPath, parsed.hasAttachments, parsed.preview);
|
|
3133
3140
|
this.emit("bodyCached", accountId, uid);
|
|
3134
3141
|
this.clearPrefetchEmpty(accountId, folderId, uid); // healed — drop stale backoff
|
|
3135
3142
|
counters.totalFetched++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.77",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
13
13
|
"@bobfrankston/mailx-settings": "^0.1.25",
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.42",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.51",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
18
18
|
"@bobfrankston/mailx-sync": "^0.1.19",
|
|
19
|
-
"@bobfrankston/oauthsupport": "^1.0.
|
|
19
|
+
"@bobfrankston/oauthsupport": "^1.0.30"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
41
41
|
"@bobfrankston/mailx-settings": "^0.1.25",
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.42",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.51",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
46
46
|
"@bobfrankston/mailx-sync": "^0.1.19",
|
|
47
|
-
"@bobfrankston/oauthsupport": "^1.0.
|
|
47
|
+
"@bobfrankston/oauthsupport": "^1.0.30"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|