@agenticmail/api 0.9.12 → 0.9.13
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/dist/index.js +18 -3
- package/package.json +1 -1
- package/public/favicon.ico +0 -0
package/dist/index.js
CHANGED
|
@@ -1546,12 +1546,27 @@ function createEventRoutes(accountManager, config, db) {
|
|
|
1546
1546
|
} catch {
|
|
1547
1547
|
}
|
|
1548
1548
|
if (spamResult.isSpam) {
|
|
1549
|
+
let spamFolder = "Spam";
|
|
1549
1550
|
try {
|
|
1550
|
-
await receiver.
|
|
1551
|
+
const folders = await receiver.listFolders();
|
|
1552
|
+
const junkRe = /^junk\b|junk mail|^spam\b|\[gmail\]\/spam/i;
|
|
1553
|
+
const existing = folders.find((f) => f.specialUse === "\\Junk")?.path ?? folders.find((f) => junkRe.test(f.name) || junkRe.test(f.path))?.path;
|
|
1554
|
+
if (existing) {
|
|
1555
|
+
spamFolder = existing;
|
|
1556
|
+
} else {
|
|
1557
|
+
try {
|
|
1558
|
+
await receiver.createFolder("Spam");
|
|
1559
|
+
} catch {
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1551
1562
|
} catch {
|
|
1563
|
+
try {
|
|
1564
|
+
await receiver.createFolder("Spam");
|
|
1565
|
+
} catch {
|
|
1566
|
+
}
|
|
1552
1567
|
}
|
|
1553
|
-
await receiver.moveMessage(event.uid, "INBOX",
|
|
1554
|
-
event.spam = { score: spamResult.score, category: spamResult.topCategory, movedToSpam: true };
|
|
1568
|
+
await receiver.moveMessage(event.uid, "INBOX", spamFolder);
|
|
1569
|
+
event.spam = { score: spamResult.score, category: spamResult.topCategory, movedToSpam: true, folder: spamFolder };
|
|
1555
1570
|
broadcastNew(event);
|
|
1556
1571
|
return;
|
|
1557
1572
|
}
|
package/package.json
CHANGED
|
Binary file
|