@bobfrankston/mailx 1.0.194 → 1.0.196
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.
|
@@ -94,10 +94,11 @@ function buildTree(folders, delimiter, accountId) {
|
|
|
94
94
|
}
|
|
95
95
|
/** Sort: INBOX first, then special folders, then alphabetical */
|
|
96
96
|
function sortFolders(nodes) {
|
|
97
|
-
const specialOrder = { inbox: 0,
|
|
97
|
+
const specialOrder = { inbox: 0, sent: 1, outbox: 2, drafts: 3, trash: 4, junk: 5, archive: 6 };
|
|
98
|
+
const nameOrder = { inbox: 0, sent: 1, "sent items": 1, outbox: 2, drafts: 3, trash: 4, "deleted items": 4, junk: 5, "junk email": 5, "junk e-mail": 5, spam: 5, archive: 6 };
|
|
98
99
|
nodes.sort((a, b) => {
|
|
99
|
-
const aOrder = specialOrder[a.specialUse] ??
|
|
100
|
-
const bOrder = specialOrder[b.specialUse] ??
|
|
100
|
+
const aOrder = specialOrder[a.specialUse] ?? nameOrder[a.name.toLowerCase()] ?? 99;
|
|
101
|
+
const bOrder = specialOrder[b.specialUse] ?? nameOrder[b.name.toLowerCase()] ?? 99;
|
|
101
102
|
if (aOrder !== bOrder)
|
|
102
103
|
return aOrder - bOrder;
|
|
103
104
|
return a.name.localeCompare(b.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.196",
|
|
4
4
|
"description": "Local-first email client with IMAP sync and standalone native app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/mailx.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@bobfrankston/iflow-node": "^0.1.2",
|
|
25
25
|
"@bobfrankston/miscinfo": "^1.0.8",
|
|
26
26
|
"@bobfrankston/oauthsupport": "^1.0.21",
|
|
27
|
-
"@bobfrankston/msger": "^0.1.
|
|
27
|
+
"@bobfrankston/msger": "^0.1.247",
|
|
28
28
|
"@capacitor/android": "^8.3.0",
|
|
29
29
|
"@capacitor/cli": "^8.3.0",
|
|
30
30
|
"@capacitor/core": "^8.3.0",
|
|
@@ -240,7 +240,7 @@ export class MailxService {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
const storePath = getStorePath();
|
|
243
|
-
const emlPath =
|
|
243
|
+
const emlPath = path.join(storePath, accountId, String(envelope.folderId), `${envelope.uid}.eml`);
|
|
244
244
|
return {
|
|
245
245
|
...envelope, bodyHtml, bodyText, hasRemoteContent, remoteAllowed: allowRemote,
|
|
246
246
|
attachments, emlPath, deliveredTo, returnPath, listUnsubscribe,
|
|
@@ -341,8 +341,11 @@ export class MailxService {
|
|
|
341
341
|
const account = settings.accounts.find(a => a.id === msg.from);
|
|
342
342
|
if (!account)
|
|
343
343
|
throw new Error(`Unknown account: ${msg.from}`);
|
|
344
|
-
//
|
|
345
|
-
|
|
344
|
+
// Extract bare email from fromAddress (may be "Name <addr>" or just "addr")
|
|
345
|
+
let fromAddr = msg.fromAddress || account.email;
|
|
346
|
+
const angleMatch = fromAddr.match(/<([^>]+)>/);
|
|
347
|
+
if (angleMatch)
|
|
348
|
+
fromAddr = angleMatch[1];
|
|
346
349
|
const fromHeader = `${account.name} <${fromAddr}>`;
|
|
347
350
|
const to = msg.to.map((a) => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
|
|
348
351
|
const cc = msg.cc?.map((a) => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
|