domma-cms 1.29.0 → 1.30.0
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 +8 -0
- package/docs/DommaFeatures.md +10 -6
- package/docs/plugin-development.md +1 -1
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/body-menu.js +1 -1
- package/plugins/_lib/admin/mail/cms-host.js +1 -1
- package/plugins/_lib/admin/mail/compose-window.js +1 -1
- package/plugins/_lib/admin/mail/contacts.js +1 -1
- package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
- package/plugins/_lib/admin/mail/drag-drop.js +1 -1
- package/plugins/_lib/admin/mail/folder-tree.js +22 -1
- package/plugins/_lib/admin/mail/font-controls.js +1 -1
- package/plugins/_lib/admin/mail/fonts.js +1 -1
- package/plugins/_lib/admin/mail/host-context.js +1 -1
- package/plugins/_lib/admin/mail/identity.js +1 -1
- package/plugins/_lib/admin/mail/image-senders-section.js +68 -1
- package/plugins/_lib/admin/mail/keyboard.js +1 -1
- package/plugins/_lib/admin/mail/mail.css +1 -1
- package/plugins/_lib/admin/mail/mail.html +1 -1
- package/plugins/_lib/admin/mail/message-actions.js +1 -1
- package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
- package/plugins/_lib/admin/mail/panes.js +1 -1
- package/plugins/_lib/admin/mail/reader-kit.js +1 -1
- package/plugins/_lib/admin/mail/reader-runtime.js +91 -5
- package/plugins/_lib/admin/mail/reader-view.js +1 -1
- package/plugins/_lib/admin/mail/resizable.js +1 -1
- package/plugins/_lib/admin/mail/restore-spam.js +1 -1
- package/plugins/_lib/admin/mail/rules.js +6 -2
- package/plugins/_lib/admin/mail/scheduling.js +1 -1
- package/plugins/_lib/admin/mail/section-kit.js +1 -1
- package/plugins/_lib/admin/mail/security-note.js +1 -1
- package/plugins/_lib/admin/mail/settings-section.js +1 -1
- package/plugins/_lib/admin/mail/templates.js +1 -1
- package/plugins/_lib/admin/mail/threads.js +1 -1
- package/plugins/_lib/admin/mail/vacation.js +1 -1
- package/plugins/_lib/admin/mail/when-closed.js +1 -1
- package/plugins/_lib/admin/ui/dates.js +1 -1
- package/plugins/_lib/admin/ui/resizable.js +1 -1
- package/plugins/_lib/domma-mail.lock.json +80 -79
- package/plugins/_lib/mail/accountFileStore.js +1 -1
- package/plugins/_lib/mail/accountRepository.js +36 -2
- package/plugins/_lib/mail/accountRoutes.js +1 -1
- package/plugins/_lib/mail/accounts.js +1 -1
- package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
- package/plugins/_lib/mail/bodyTokens.js +1 -1
- package/plugins/_lib/mail/compose.js +1 -1
- package/plugins/_lib/mail/defaults.js +1 -1
- package/plugins/_lib/mail/envelope.js +1 -1
- package/plugins/_lib/mail/folderActions.js +1 -1
- package/plugins/_lib/mail/folderRuntime.js +1 -1
- package/plugins/_lib/mail/folders.js +1 -1
- package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
- package/plugins/_lib/mail/mbox.js +1 -1
- package/plugins/_lib/mail/message-action.js +1 -1
- package/plugins/_lib/mail/messageSecurity.js +1 -1
- package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
- package/plugins/_lib/mail/networkAddresses.js +1 -1
- package/plugins/_lib/mail/networkPolicy.js +1 -1
- package/plugins/_lib/mail/oauthAccounts.js +1 -1
- package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
- package/plugins/_lib/mail/oauthRuntime.js +1 -1
- package/plugins/_lib/mail/pollSchedule.js +1 -1
- package/plugins/_lib/mail/poller.js +1 -1
- package/plugins/_lib/mail/pollerRuntime.js +1 -1
- package/plugins/_lib/mail/priority.js +1 -1
- package/plugins/_lib/mail/publicMailbox.js +1 -1
- package/plugins/_lib/mail/readRuntime.js +57 -3
- package/plugins/_lib/mail/render.js +1 -1
- package/plugins/_lib/mail/ruleRunner.js +1 -1
- package/plugins/_lib/mail/schedulerRuntime.js +1 -1
- package/plugins/_lib/mail/secretProvider.js +1 -1
- package/plugins/_lib/mail/secretbox.js +1 -1
- package/plugins/_lib/mail/senderAuth.js +113 -0
- package/plugins/_lib/mail/sieve.js +7 -2
- package/plugins/_lib/mail/smtpService.js +1 -1
- package/plugins/_lib/mail/snoozeRuntime.js +1 -1
- package/plugins/_lib/mail/store.js +1 -1
- package/plugins/_lib/mail/subscriptions.js +1 -1
- package/plugins/_lib/mail/syncPlan.js +1 -1
- package/plugins/_lib/mail/syncRuntime.js +1 -1
- package/plugins/_lib/mail/syncSelection.js +1 -1
- package/plugins/_lib/mail/unreadBadge.js +1 -1
- package/plugins/_lib/mail/unsubscribe.js +1 -1
- package/plugins/_lib/mail/vacationRuntime.js +1 -1
- package/plugins/_lib/mail/write.js +4 -2
- package/server/routes/api/forms.js +8 -1
- package/server/services/viewerSession.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/readRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {registerAccountRoutes} from './accountRoutes.js';
|
|
4
4
|
import {ENVELOPE_QUERY, hasAttachment, parseHeaderBlock} from './envelope.js';
|
|
@@ -7,6 +7,7 @@ import {readPriority} from './priority.js';
|
|
|
7
7
|
import {readUnsubscribe} from './unsubscribe.js';
|
|
8
8
|
import {MailKeyError} from './secretProvider.js';
|
|
9
9
|
import {unreadBadge} from './unreadBadge.js';
|
|
10
|
+
import {senderAuthenticated} from './senderAuth.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* The security facts the reader shows - nothing else of the provider's
|
|
@@ -51,6 +52,9 @@ function addresses(list) {
|
|
|
51
52
|
export function registerReadRuntime(fastify, {auth, hooks, config, pool, pluginName, cachedList = null, diagnostics = null, unreadBadge: withUnreadBadge = false,
|
|
52
53
|
accounts, bodyTokens, guardHost, resolveSubscriptions, renderer, parseReadable,
|
|
53
54
|
listUserIds = null, buildDiagnostics = async () => ({available: false}), onDelete,
|
|
55
|
+
// (userId, address) => Promise<boolean>: is this address in the user's
|
|
56
|
+
// contacts? Absent = the host has no contacts, and the setting is not offered.
|
|
57
|
+
knownSender = null,
|
|
54
58
|
apiBase = `/api/plugins/${pluginName}`
|
|
55
59
|
}) {
|
|
56
60
|
if (!accounts || !bodyTokens || typeof auth?.authenticate !== 'function' || typeof guardHost !== 'function'
|
|
@@ -441,7 +445,19 @@ export function registerReadRuntime(fastify, {auth, hooks, config, pool, pluginN
|
|
|
441
445
|
const {parsed, security} = await parseReadable(fetched.source, {account: ctx.account, userId: ctx.uid});
|
|
442
446
|
const from = addresses(parsed.from?.value);
|
|
443
447
|
const senderTrusted = accounts.sendersImagesTrusted(ctx.account, from);
|
|
444
|
-
|
|
448
|
+
// A contact's images: only for a single sender who is in the
|
|
449
|
+
// user's contacts AND whom the receiving server verified (see
|
|
450
|
+
// senderAuth.js) - anyone can type a contact's address into From.
|
|
451
|
+
let contact = null;
|
|
452
|
+
const sole = from.length === 1 ? from[0].address : '';
|
|
453
|
+
if (!requestedNow && !config.allowRemoteImages && !senderTrusted && sole && typeof knownSender === 'function'
|
|
454
|
+
&& (accounts.contactImagesAllowed?.(ctx.account, sole) ?? ctx.account.contactImages !== false)
|
|
455
|
+
&& await Promise.resolve(knownSender(ctx.uid, sole)).catch(() => false)) {
|
|
456
|
+
const check = senderAuthenticated(parsed.headerLines, sole);
|
|
457
|
+
contact = {address: sole, verified: check.ok, reason: check.ok ? null : check.reason};
|
|
458
|
+
}
|
|
459
|
+
const contactTrusted = contact?.verified === true;
|
|
460
|
+
const allowRemoteImages = requestedNow || config.allowRemoteImages || senderTrusted || contactTrusted;
|
|
445
461
|
|
|
446
462
|
const rendered = renderBody(parsed, {
|
|
447
463
|
allowRemoteImages,
|
|
@@ -453,6 +469,10 @@ export function registerReadRuntime(fastify, {auth, hooks, config, pool, pluginN
|
|
|
453
469
|
folder,
|
|
454
470
|
accountId: ctx.account.id,
|
|
455
471
|
senderTrusted,
|
|
472
|
+
// In the user's contacts: {address, verified, reason}. Verified
|
|
473
|
+
// = its images loaded for that reason; unverified = they did
|
|
474
|
+
// not, and the reader says why.
|
|
475
|
+
contact,
|
|
456
476
|
// Offered only when remembering is switched on for this mailbox.
|
|
457
477
|
canTrustSender: ctx.account.rememberImageSenders !== false
|
|
458
478
|
&& !senderTrusted
|
|
@@ -599,10 +619,44 @@ export function registerReadRuntime(fastify, {auth, hooks, config, pool, pluginN
|
|
|
599
619
|
return {
|
|
600
620
|
accountId: ctx.account.id,
|
|
601
621
|
remember: ctx.account.rememberImageSenders !== false,
|
|
602
|
-
senders: Array.isArray(ctx.account.imageSenders) ? ctx.account.imageSenders : []
|
|
622
|
+
senders: Array.isArray(ctx.account.imageSenders) ? ctx.account.imageSenders : [],
|
|
623
|
+
...contactImagesPublic(ctx.account)
|
|
603
624
|
};
|
|
604
625
|
});
|
|
605
626
|
|
|
627
|
+
/** The contacts setting as the settings screen sees it; absent where the host has no contacts. */
|
|
628
|
+
function contactImagesPublic(account) {
|
|
629
|
+
if (typeof knownSender !== 'function' || typeof accounts.setContactImages !== 'function') return {};
|
|
630
|
+
return {
|
|
631
|
+
contactImages: account?.contactImages !== false,
|
|
632
|
+
contactImageBlocks: Array.isArray(account?.contactImageBlocks) ? account.contactImageBlocks : []
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* PUT /image-senders/contacts - images from people in my contacts:
|
|
638
|
+
* {enabled} switches it, {block} / {unblock} an exception for one sender.
|
|
639
|
+
*/
|
|
640
|
+
fastify.put('/image-senders/contacts', {preHandler: [authenticate]}, async (request, reply) => {
|
|
641
|
+
const ctx = await context(request, reply);
|
|
642
|
+
if (!ctx) return;
|
|
643
|
+
if (typeof knownSender !== 'function' || typeof accounts.setContactImages !== 'function') {
|
|
644
|
+
return reply.code(404).send({error: 'Contacts are not available here.'});
|
|
645
|
+
}
|
|
646
|
+
const body = request.body ?? {};
|
|
647
|
+
const change = {};
|
|
648
|
+
if (typeof body.enabled === 'boolean') change.enabled = body.enabled;
|
|
649
|
+
for (const key of ['block', 'unblock']) {
|
|
650
|
+
if (body[key] === undefined) continue;
|
|
651
|
+
const address = String(body[key] ?? '').trim();
|
|
652
|
+
if (!address || address.length > 320 || /[\s\x00-\x1f]/.test(address)) return reply.code(400).send({error: 'A sender address is required.'});
|
|
653
|
+
change[key] = address;
|
|
654
|
+
}
|
|
655
|
+
const saved = await accounts.setContactImages(ctx.uid, ctx.account.id, change);
|
|
656
|
+
if (!saved) return reply.code(404).send({error: 'That mailbox does not exist.'});
|
|
657
|
+
return contactImagesPublic(saved);
|
|
658
|
+
});
|
|
659
|
+
|
|
606
660
|
/**
|
|
607
661
|
* POST /image-senders - trust a sender's images from now on.
|
|
608
662
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/schedulerRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The worker behind "send later", "undo send" and "snooze".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/secretProvider.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {createCipheriv, createDecipheriv, createHash, randomBytes, scryptSync} from 'node:crypto';
|
|
4
4
|
import fs from 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/secretbox.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** CMS compatibility entry point. Standalone hosts create their own secret box. */
|
|
4
4
|
import path from 'node:path';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/senderAuth.js.
|
|
2
|
+
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
|
+
/**
|
|
4
|
+
* Did this message really come from the address in its From line?
|
|
5
|
+
*
|
|
6
|
+
* Used before loading a contact's remote images automatically: anyone can
|
|
7
|
+
* write a contact's address into From, so being in the contacts list is not
|
|
8
|
+
* enough on its own. The answer comes from the RECEIVING mail server's own
|
|
9
|
+
* check, recorded in an Authentication-Results header (RFC 8601).
|
|
10
|
+
*
|
|
11
|
+
* Only a header the receiving server wrote counts. A sender can put any
|
|
12
|
+
* Authentication-Results it likes into its own message, so:
|
|
13
|
+
*
|
|
14
|
+
* - the server that took delivery is the `by` host of the topmost Received
|
|
15
|
+
* header (each hop adds its Received line at the top);
|
|
16
|
+
* - a result counts only when its authserv-id is that host, or another host
|
|
17
|
+
* in the same domain (a local delivery step on the same system), AND it
|
|
18
|
+
* sits ABOVE the first Received line that host wrote. Anything a sender
|
|
19
|
+
* forged arrives below that line, whatever names it uses.
|
|
20
|
+
*
|
|
21
|
+
* A pass is any of: dmarc=pass; dkim=pass whose signing domain (header.d)
|
|
22
|
+
* aligns with the From domain; spf=pass whose smtp.mailfrom domain aligns.
|
|
23
|
+
* "Aligns" is relaxed alignment: the same organisational domain (example.co.uk).
|
|
24
|
+
*
|
|
25
|
+
* No such header, or nothing aligned that passed, is NOT verified - the safe
|
|
26
|
+
* answer, so images stay blocked as before.
|
|
27
|
+
*
|
|
28
|
+
* Pure: header lines in, an answer out.
|
|
29
|
+
*
|
|
30
|
+
* @module _lib/mail/senderAuth
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** Second-level labels that are public suffixes under a country code (co.uk, com.au...). */
|
|
34
|
+
const SECOND_LEVEL = /^(co|com|org|net|ac|gov|ltd|plc|me|sch|nhs|edu|nom|or|ne|go)\.[a-z]{2}$/;
|
|
35
|
+
|
|
36
|
+
/** The registrable part of a host name, roughly: example.co.uk, example.com. */
|
|
37
|
+
export function baseDomain(host) {
|
|
38
|
+
const labels = String(host ?? '').toLowerCase().replace(/\.$/, '').split('.').filter(Boolean);
|
|
39
|
+
if (labels.length < 2) return labels.join('.');
|
|
40
|
+
const lastTwo = labels.slice(-2).join('.');
|
|
41
|
+
return SECOND_LEVEL.test(lastTwo) && labels.length >= 3 ? labels.slice(-3).join('.') : lastTwo;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Relaxed alignment (DMARC): the same organisational domain. Never a bare public suffix. */
|
|
45
|
+
export function aligned(a, b) {
|
|
46
|
+
const x = baseDomain(a), y = baseDomain(b);
|
|
47
|
+
return Boolean(x) && x.includes('.') && !SECOND_LEVEL.test(x) && x === y;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const unfold = line => String(line ?? '').replace(/\r?\n[ \t]+/g, ' ');
|
|
51
|
+
const valueOf = line => unfold(line).replace(/^[^:]*:\s*/, '');
|
|
52
|
+
/** Comments in parentheses removed (RFC 5322 CFWS, one level deep is all servers write). */
|
|
53
|
+
const uncomment = text => text.replace(/\([^()]*\)/g, ' ');
|
|
54
|
+
|
|
55
|
+
/** The `by` host of a Received header, or null. */
|
|
56
|
+
export function receivedBy(value) {
|
|
57
|
+
const match = /\bby\s+([A-Za-z0-9.-]+\.[A-Za-z]{2,})/i.exec(uncomment(String(value ?? '')));
|
|
58
|
+
return match ? match[1].toLowerCase() : null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* One Authentication-Results value -> {authservId, results: [{method, result, props}]}.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} value
|
|
65
|
+
* @returns {{authservId: string, results: object[]}}
|
|
66
|
+
*/
|
|
67
|
+
export function parseAuthResults(value) {
|
|
68
|
+
const parts = uncomment(String(value ?? '')).split(';').map(s => s.trim()).filter(Boolean);
|
|
69
|
+
const authservId = (parts.shift() ?? '').split(/\s+/)[0].toLowerCase();
|
|
70
|
+
const results = [];
|
|
71
|
+
for (const part of parts) {
|
|
72
|
+
const match = /^([a-z0-9-]+)\s*=\s*([a-z0-9-]+)(.*)$/i.exec(part);
|
|
73
|
+
if (!match) continue;
|
|
74
|
+
const props = {};
|
|
75
|
+
for (const prop of match[3].matchAll(/([a-z0-9-]+\.[a-z0-9-]+)\s*=\s*("[^"]*"|[^\s;]+)/gi)) {
|
|
76
|
+
props[prop[1].toLowerCase()] = prop[2].replace(/^"|"$/g, '');
|
|
77
|
+
}
|
|
78
|
+
results.push({method: match[1].toLowerCase(), result: match[2].toLowerCase(), props});
|
|
79
|
+
}
|
|
80
|
+
return {authservId, results};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The domain of an address or @domain / user@domain identity. */
|
|
84
|
+
const domainOf = value => String(value ?? '').toLowerCase().split('@').pop().replace(/[>\s]/g, '');
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param {{key: string, line: string}[]} headerLines - in message order (mailparser's `headerLines`)
|
|
88
|
+
* @param {string} fromAddress
|
|
89
|
+
* @returns {{ok: boolean, via?: string, reason?: string}}
|
|
90
|
+
*/
|
|
91
|
+
export function senderAuthenticated(headerLines, fromAddress) {
|
|
92
|
+
const fromDomain = domainOf(fromAddress);
|
|
93
|
+
if (!fromDomain.includes('.')) return {ok: false, reason: 'The sender has no domain to check.'};
|
|
94
|
+
const lines = (headerLines ?? []).map(h => ({key: String(h?.key ?? '').toLowerCase(), value: valueOf(h?.line)}));
|
|
95
|
+
const received = lines.map((h, i) => ({...h, i})).filter(h => h.key === 'received');
|
|
96
|
+
const receiver = received.length ? receivedBy(received[0].value) : null;
|
|
97
|
+
if (!receiver) return {ok: false, reason: 'The message does not say which server received it.'};
|
|
98
|
+
for (const [i, h] of lines.entries()) {
|
|
99
|
+
if (h.key !== 'authentication-results') continue;
|
|
100
|
+
const {authservId, results} = parseAuthResults(h.value);
|
|
101
|
+
if (!authservId || (authservId !== receiver && baseDomain(authservId) !== baseDomain(receiver))) continue;
|
|
102
|
+
// Must sit above the first Received line its own server wrote.
|
|
103
|
+
const own = received.find(r => receivedBy(r.value) === authservId);
|
|
104
|
+
if (!own || own.i < i) continue;
|
|
105
|
+
for (const r of results) {
|
|
106
|
+
if (r.result !== 'pass') continue;
|
|
107
|
+
if (r.method === 'dmarc') return {ok: true, via: 'dmarc'};
|
|
108
|
+
if (r.method === 'dkim' && aligned(domainOf(r.props['header.d'] ?? r.props['header.i']), fromDomain)) return {ok: true, via: 'dkim'};
|
|
109
|
+
if (r.method === 'spf' && aligned(domainOf(r.props['smtp.mailfrom']), fromDomain)) return {ok: true, via: 'spf'};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {ok: false, reason: 'Your mail server did not confirm this message came from the sender\'s domain.'};
|
|
113
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/sieve.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** ManageSieve (RFC 5804). One bounded, TLS-verified session per operation. */
|
|
4
4
|
import net from 'node:net';
|
|
@@ -199,7 +199,12 @@ export async function connectSieve({target, port = 4190, security = 'starttls',
|
|
|
199
199
|
const secure = (adapters.tlsConnect ?? tls.connect)({socket, ...tlsOptions});
|
|
200
200
|
session.attach(secure);
|
|
201
201
|
await connected(secure, 'secureConnect');
|
|
202
|
-
|
|
202
|
+
// RFC 5804 2.2: once TLS is up the server re-issues its capabilities
|
|
203
|
+
// unasked, ending in OK. Sending CAPABILITY here as well put every
|
|
204
|
+
// later reply one behind (sign-in read CAPABILITY's OK, LISTSCRIPTS
|
|
205
|
+
// read the capability lines), so the scripts never showed.
|
|
206
|
+
session.received = 0;
|
|
207
|
+
caps = capabilities(await session.response());
|
|
203
208
|
}
|
|
204
209
|
if (!caps.SASL?.split(/\s+/).includes('PLAIN')) throw new SieveError('This Sieve server does not offer password authentication over TLS.', 409);
|
|
205
210
|
const token = Buffer.from(`\0${auth.user}\0${auth.pass}`).toString('base64');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/smtpService.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Sending, and keeping a copy where the rest of your clients will find it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/snoozeRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {safeWritePool, moveMessage} from './write.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/subscriptions.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
export function resolveSubscriptions(boxes) {
|
|
4
4
|
const list = boxes ?? [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/syncRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {missingUids, planFolderSync} from './syncPlan.js';
|
|
4
4
|
import {resolveSyncFolders} from './syncSelection.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/syncSelection.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Which folders a mailbox keeps mirrored.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/unreadBadge.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The free reader's sidebar badge - unread mail in each mailbox's INBOX.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/vacationRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {randomUUID} from 'node:crypto';
|
|
4
4
|
import {autoReplyHeaders, isActive, normaliseVacation, replySubject, shouldAutoReply, replyHistory} from '../admin/mail/vacation.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.19.0, packages/core/src/mail/write.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Changing mail, rather than reading it.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @module _lib/mail/write
|
|
16
16
|
*/
|
|
17
17
|
import {ENVELOPE_QUERY, toRecord} from './envelope.js';
|
|
18
|
+
import {isSpamFolder} from '../admin/mail/folder-tree.js';
|
|
18
19
|
|
|
19
20
|
/** Refuse IMAP fallbacks that could expunge mail outside the selected UID set. */
|
|
20
21
|
export function safeWritePool(pool) {
|
|
@@ -355,7 +356,8 @@ export const NOT_JUNK_KEYWORD = '$NotJunk';
|
|
|
355
356
|
* @returns {{destination: string|null, add: string[], remove: string[]}}
|
|
356
357
|
*/
|
|
357
358
|
export function planSpamMove({spam, folder, junkFolder, inboxFolder = 'INBOX'}) {
|
|
358
|
-
|
|
359
|
+
// The \Junk folder, or a plain folder a server filter files spam into.
|
|
360
|
+
const inJunk = isSpamFolder(folder, junkFolder);
|
|
359
361
|
|
|
360
362
|
if (spam) {
|
|
361
363
|
return {
|
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
import {getConfig} from '../../config.js';
|
|
48
48
|
import {authenticate, requireAdmin, requirePermission} from '../../middleware/auth.js';
|
|
49
49
|
import {hooks} from '../../services/hooks.js';
|
|
50
|
+
import {parseCookies, SESSION_COOKIE} from '../../services/viewerSession.js';
|
|
50
51
|
import {pluginDenialFor} from '../../services/collectionAccess.js';
|
|
51
52
|
import {deleteMedia, saveMedia} from '../../services/content.js';
|
|
52
53
|
import {formMayCollect, servedType} from '../../services/mediaTypes.js';
|
|
@@ -1198,7 +1199,13 @@ export async function formsRoutes(fastify) {
|
|
|
1198
1199
|
|
|
1199
1200
|
// An unrecorded end is not a submission anyone keeps, so nothing that
|
|
1200
1201
|
// listens for submissions (plugins, the "Form submitted" notice) hears it.
|
|
1201
|
-
|
|
1202
|
+
// `ip` and `cookies` are the visitor's, for a listener acting for them (Social Media Pro's
|
|
1203
|
+
// LinkedIn conversions read the marketing-consent and click-ID cookies) - never the sign-in
|
|
1204
|
+
// session cookie.
|
|
1205
|
+
if (record) {
|
|
1206
|
+
const {[SESSION_COOKIE]: _session, ...cookies} = parseCookies(request.headers.cookie);
|
|
1207
|
+
hooks.emit('form:submitted', {slug, entryId: entry?.id || null, data, formTitle: form.title, ended: !!ended, ip: request.ip, cookies});
|
|
1208
|
+
}
|
|
1202
1209
|
|
|
1203
1210
|
// Template interpolation for successRedirect. A trigger's redirect is
|
|
1204
1211
|
// the more specific instruction, so it wins over the form's default.
|
|
@@ -26,7 +26,7 @@ export const SESSION_COOKIE = 'dm_session';
|
|
|
26
26
|
* @param {string} [header]
|
|
27
27
|
* @returns {Record<string, string>}
|
|
28
28
|
*/
|
|
29
|
-
function parseCookies(header) {
|
|
29
|
+
export function parseCookies(header) {
|
|
30
30
|
const out = {};
|
|
31
31
|
if (!header) return out;
|
|
32
32
|
for (const part of header.split(';')) {
|