@rndmjoker/proton-mcp 0.4.11 → 0.4.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/README.md +61 -16
- package/dist/bridge/certificate.d.ts +33 -1
- package/dist/bridge/certificate.js +82 -9
- package/dist/bridge/certificate.js.map +1 -1
- package/dist/bridge/connection.js +31 -6
- package/dist/bridge/connection.js.map +1 -1
- package/dist/bridge/errors.d.ts +8 -0
- package/dist/bridge/errors.js +28 -3
- package/dist/bridge/errors.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/credentials/availability.d.ts +5 -0
- package/dist/credentials/availability.js +7 -0
- package/dist/credentials/availability.js.map +1 -1
- package/dist/credentials/encrypted-file.js +7 -2
- package/dist/credentials/encrypted-file.js.map +1 -1
- package/dist/credentials/keyring.d.ts +12 -2
- package/dist/credentials/keyring.js +44 -6
- package/dist/credentials/keyring.js.map +1 -1
- package/dist/credentials/plain-file.js +8 -2
- package/dist/credentials/plain-file.js.map +1 -1
- package/dist/credentials/session-bus.d.ts +38 -0
- package/dist/credentials/session-bus.js +68 -0
- package/dist/credentials/session-bus.js.map +1 -0
- package/dist/credentials/store.d.ts +5 -1
- package/dist/credentials/store.js.map +1 -1
- package/dist/mail/attachments.d.ts +12 -2
- package/dist/mail/attachments.js +19 -11
- package/dist/mail/attachments.js.map +1 -1
- package/dist/mail/compose.d.ts +65 -9
- package/dist/mail/compose.js +147 -11
- package/dist/mail/compose.js.map +1 -1
- package/dist/mail/drafts.d.ts +13 -2
- package/dist/mail/drafts.js +69 -18
- package/dist/mail/drafts.js.map +1 -1
- package/dist/mail/ids.js +6 -4
- package/dist/mail/ids.js.map +1 -1
- package/dist/mail/messages.d.ts +25 -2
- package/dist/mail/messages.js +37 -4
- package/dist/mail/messages.js.map +1 -1
- package/dist/mail/saved-attachments.d.ts +128 -0
- package/dist/mail/saved-attachments.js +448 -0
- package/dist/mail/saved-attachments.js.map +1 -0
- package/dist/mail/search.d.ts +67 -3
- package/dist/mail/search.js +134 -23
- package/dist/mail/search.js.map +1 -1
- package/dist/mail/send.js +24 -9
- package/dist/mail/send.js.map +1 -1
- package/dist/mail/uid-search.d.ts +17 -0
- package/dist/mail/uid-search.js +25 -0
- package/dist/mail/uid-search.js.map +1 -0
- package/dist/mime/filenames.d.ts +24 -0
- package/dist/mime/filenames.js +58 -0
- package/dist/mime/filenames.js.map +1 -0
- package/dist/mime/parts.d.ts +34 -0
- package/dist/mime/parts.js +92 -0
- package/dist/mime/parts.js.map +1 -0
- package/dist/server.js +39 -6
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +15 -3
- package/dist/session.js +35 -8
- package/dist/session.js.map +1 -1
- package/dist/tools/confirm.js +39 -11
- package/dist/tools/confirm.js.map +1 -1
- package/dist/tools/drafts.d.ts +3 -0
- package/dist/tools/drafts.js +18 -6
- package/dist/tools/drafts.js.map +1 -1
- package/dist/tools/filters.d.ts +40 -0
- package/dist/tools/filters.js +89 -0
- package/dist/tools/filters.js.map +1 -0
- package/dist/tools/format.d.ts +8 -0
- package/dist/tools/format.js +29 -6
- package/dist/tools/format.js.map +1 -1
- package/dist/tools/guidance.js +27 -3
- package/dist/tools/guidance.js.map +1 -1
- package/dist/tools/messages.js +7 -2
- package/dist/tools/messages.js.map +1 -1
- package/dist/tools/pending-view.d.ts +7 -0
- package/dist/tools/pending-view.js +4 -1
- package/dist/tools/pending-view.js.map +1 -1
- package/dist/tools/saved.d.ts +15 -0
- package/dist/tools/saved.js +107 -0
- package/dist/tools/saved.js.map +1 -0
- package/dist/tools/send.js +4 -1
- package/dist/tools/send.js.map +1 -1
- package/dist/web/layout.js +2 -0
- package/dist/web/layout.js.map +1 -1
- package/dist/web/pages.js +1 -0
- package/dist/web/pages.js.map +1 -1
- package/dist/web/pending.d.ts +4 -0
- package/dist/web/pending.js +32 -4
- package/dist/web/pending.js.map +1 -1
- package/dist/web/server.d.ts +16 -5
- package/dist/web/server.js +12 -8
- package/dist/web/server.js.map +1 -1
- package/package.json +16 -8
package/dist/mail/compose.d.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* same thing and must not drift: the recipients a confirmation shows have to
|
|
6
6
|
* be the recipients that are written or sent, or the confirmation is theatre.
|
|
7
7
|
*
|
|
8
|
-
* No attachment can be read from disk here, and that is deliberate
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* side effect of being able to write a draft.
|
|
8
|
+
* No attachment can be read from disk here, and that is deliberate. An
|
|
9
|
+
* attachment taken from a path would mean the model names a file, the server
|
|
10
|
+
* reads it, and the next confirmation the user waves through carries it
|
|
11
|
+
* outside. Which paths may be reached is its own decision, made in #17 rather
|
|
12
|
+
* than as a side effect of being able to write a draft.
|
|
13
13
|
*/
|
|
14
14
|
import { type MarkupUrl, type MarkupLevel, type StyleNote } from './markup.js';
|
|
15
|
+
import type { CarriedFile } from '../mime/parts.js';
|
|
15
16
|
/** An address, optionally with a display name. */
|
|
16
17
|
export interface Recipient {
|
|
17
18
|
name?: string;
|
|
@@ -43,10 +44,16 @@ export interface Draft {
|
|
|
43
44
|
* replayed for the unwarned one.
|
|
44
45
|
*/
|
|
45
46
|
markupLevel?: MarkupLevel;
|
|
46
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* A whole message carried along, used when forwarding.
|
|
49
|
+
*
|
|
50
|
+
* `carries` names the attachments travelling inside it. Only for telling the
|
|
51
|
+
* assistant what the original held; the bytes are in `raw`.
|
|
52
|
+
*/
|
|
47
53
|
attachedMessage?: {
|
|
48
54
|
filename: string;
|
|
49
55
|
raw: Buffer;
|
|
56
|
+
carries?: string[];
|
|
50
57
|
};
|
|
51
58
|
/**
|
|
52
59
|
* The message as markup, when it has any.
|
|
@@ -76,6 +83,21 @@ export interface Draft {
|
|
|
76
83
|
quotedHtml?: string;
|
|
77
84
|
/** Files referenced from the markup by content id. */
|
|
78
85
|
inlineParts?: InlinePart[];
|
|
86
|
+
/**
|
|
87
|
+
* The markup body of a stored draft, read back to be sent or kept, and kept
|
|
88
|
+
* apart from `html` on purpose.
|
|
89
|
+
*
|
|
90
|
+
* It is not held to the permitted set again. It was held to it when it was
|
|
91
|
+
* written through this server, or a person wrote it in Proton. Once stored,
|
|
92
|
+
* the composed part and a quote can no longer be told apart, and the level
|
|
93
|
+
* it was written at is recorded nowhere, so a second check refused every
|
|
94
|
+
* formatted reply on the <style> of its quote. It is read the way a quote
|
|
95
|
+
* is instead: the confirmation counts and the preview names everything in
|
|
96
|
+
* it, and anything beyond `standard` carries the same warning as `extended`.
|
|
97
|
+
*/
|
|
98
|
+
storedHtml?: string;
|
|
99
|
+
/** Files read back from a stored draft, carried along as they were stored. */
|
|
100
|
+
carriedFiles?: CarriedFile[];
|
|
79
101
|
}
|
|
80
102
|
/** A file carried inside the message and referenced from the markup. */
|
|
81
103
|
export interface InlinePart {
|
|
@@ -85,14 +107,25 @@ export interface InlinePart {
|
|
|
85
107
|
contentType: string;
|
|
86
108
|
content: Buffer;
|
|
87
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Refuses a recipient that reads one way in the confirmation and goes somewhere
|
|
112
|
+
* else, or nowhere, once the message is sent.
|
|
113
|
+
*
|
|
114
|
+
* Applied to every recipient a message can carry, whether a caller typed it or
|
|
115
|
+
* it was read back from a stored draft. The confirmation is only worth
|
|
116
|
+
* something if what it shows is what the envelope carries.
|
|
117
|
+
*/
|
|
118
|
+
export declare function assertDeliverable(recipient: Recipient): void;
|
|
88
119
|
/**
|
|
89
120
|
* Checks an address well enough to catch the mistakes that matter.
|
|
90
121
|
*
|
|
91
122
|
* Not a full RFC 5322 parser, and not trying to be: the point is to refuse a
|
|
92
123
|
* string that would end up somewhere unintended, not to adjudicate exotic but
|
|
93
|
-
* legal forms. A newline is the one that has to be caught, because a
|
|
94
|
-
* injected through an address field would let the sender of a mail the
|
|
95
|
-
* just read add a recipient the confirmation never showed.
|
|
124
|
+
* legal forms. A newline is the one that has to be caught first, because a
|
|
125
|
+
* header injected through an address field would let the sender of a mail the
|
|
126
|
+
* model just read add a recipient the confirmation never showed. Everything
|
|
127
|
+
* else that would make the confirmation and the envelope disagree is
|
|
128
|
+
* assertDeliverable's.
|
|
96
129
|
*/
|
|
97
130
|
export declare function parseRecipient(input: string): Recipient;
|
|
98
131
|
export declare function parseRecipients(list: string[] | undefined): Recipient[];
|
|
@@ -263,6 +296,20 @@ export interface QuoteSummary {
|
|
|
263
296
|
* is visible as the recipient will see it.
|
|
264
297
|
*/
|
|
265
298
|
export declare function summariseQuote(draft: Draft): QuoteSummary | undefined;
|
|
299
|
+
/** The line this server writes above every forwarded message, in text and in markup. */
|
|
300
|
+
export declare const FORWARD_HEADER = "---------- Forwarded message ----------";
|
|
301
|
+
/**
|
|
302
|
+
* Whether the message carries a quoted one, for the count line of the
|
|
303
|
+
* confirmation.
|
|
304
|
+
*
|
|
305
|
+
* summariseQuote only sees a quote that is still held apart from the body,
|
|
306
|
+
* which is the case while a reply or a forward is composed with markup. Once a
|
|
307
|
+
* draft is stored, and in a plain text reply, the quote is part of the body,
|
|
308
|
+
* and up to 0.4.11 the confirmation said nothing about it. It is recognised
|
|
309
|
+
* there by what quotes it: the forward header this server writes, the "wrote:"
|
|
310
|
+
* line followed by quoted lines, or a blockquote, which is how Proton quotes.
|
|
311
|
+
*/
|
|
312
|
+
export declare function carriesQuote(draft: Draft): boolean;
|
|
266
313
|
/**
|
|
267
314
|
* Everything the message points at or carries, for the confirmation.
|
|
268
315
|
*
|
|
@@ -287,3 +334,12 @@ export declare function fingerprintPart(content: Buffer): string;
|
|
|
287
334
|
* "what did it use" is a list rather than a promise.
|
|
288
335
|
*/
|
|
289
336
|
export declare function styleNotesOf(draft: Draft): StyleNote[];
|
|
337
|
+
/**
|
|
338
|
+
* What a stored body carries that no composed message may: style blocks,
|
|
339
|
+
* scripts, event handlers, data: addresses, comments.
|
|
340
|
+
*
|
|
341
|
+
* Empty for anything that is not a stored draft, because composed markup with
|
|
342
|
+
* such a thing never gets this far. For a stored draft it is part of what the
|
|
343
|
+
* confirmation warns about, since it was not checked again on the way out.
|
|
344
|
+
*/
|
|
345
|
+
export declare function storedBeyondOf(draft: Draft): string[];
|
package/dist/mail/compose.js
CHANGED
|
@@ -5,26 +5,82 @@
|
|
|
5
5
|
* same thing and must not drift: the recipients a confirmation shows have to
|
|
6
6
|
* be the recipients that are written or sent, or the confirmation is theatre.
|
|
7
7
|
*
|
|
8
|
-
* No attachment can be read from disk here, and that is deliberate
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* side effect of being able to write a draft.
|
|
8
|
+
* No attachment can be read from disk here, and that is deliberate. An
|
|
9
|
+
* attachment taken from a path would mean the model names a file, the server
|
|
10
|
+
* reads it, and the next confirmation the user waves through carries it
|
|
11
|
+
* outside. Which paths may be reached is its own decision, made in #17 rather
|
|
12
|
+
* than as a side effect of being able to write a draft.
|
|
13
13
|
*/
|
|
14
14
|
import MailComposer from 'nodemailer/lib/mail-composer/index.js';
|
|
15
|
+
import MimeNode from 'nodemailer/lib/mime-node';
|
|
15
16
|
import { createHash, randomUUID } from 'node:crypto';
|
|
16
17
|
import { BridgeError } from '../bridge/errors.js';
|
|
17
18
|
import { assertSendableMarkup, readMarkup, } from './markup.js';
|
|
18
19
|
import { prepareQuotedMarkup } from './quote.js';
|
|
19
20
|
import { htmlToText } from '../mime/parse.js';
|
|
21
|
+
/**
|
|
22
|
+
* Control characters, and the formatting ones that reorder text or take up no
|
|
23
|
+
* space. In a display name they change how a recipient reads in the
|
|
24
|
+
* confirmation without changing where the message goes: U+202E reverses
|
|
25
|
+
* everything after it.
|
|
26
|
+
*/
|
|
27
|
+
const INVISIBLE = /[\p{Cc}\p{Cf}]/u;
|
|
28
|
+
/** Names each invisible character by its code point, so a refusal can show it. */
|
|
29
|
+
function showInvisible(value) {
|
|
30
|
+
return value.replace(/[\p{Cc}\p{Cf}]/gu, (c) => `U+${c.codePointAt(0).toString(16).toUpperCase().padStart(4, '0')}`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Refuses a recipient that reads one way in the confirmation and goes somewhere
|
|
34
|
+
* else, or nowhere, once the message is sent.
|
|
35
|
+
*
|
|
36
|
+
* Applied to every recipient a message can carry, whether a caller typed it or
|
|
37
|
+
* it was read back from a stored draft. The confirmation is only worth
|
|
38
|
+
* something if what it shows is what the envelope carries.
|
|
39
|
+
*/
|
|
40
|
+
export function assertDeliverable(recipient) {
|
|
41
|
+
const { name, address } = recipient;
|
|
42
|
+
if (name !== undefined && INVISIBLE.test(name)) {
|
|
43
|
+
throw new BridgeError(`The display name "${showInvisible(name)}" contains a control or formatting character. Such ` +
|
|
44
|
+
'a character can change how a recipient reads in the confirmation, for example by reversing ' +
|
|
45
|
+
'the text after it, so it is refused rather than removed.');
|
|
46
|
+
}
|
|
47
|
+
// Letters from another script can spell a familiar domain, and the envelope
|
|
48
|
+
// then carries its punycode form, which is a different domain anyone can
|
|
49
|
+
// register. Measured with nodemailer 10.1.7: ceo@\u0430\u0440\u0440\u04cf\u0435.com, all Cyrillic,
|
|
50
|
+
// reads as apple.com and goes to ceo@xn--80ak6aa92e.com.
|
|
51
|
+
if (/[^\x21-\x7e]/.test(address)) {
|
|
52
|
+
throw new BridgeError(`"${showInvisible(address)}" contains a character outside ASCII. Letters from another script ` +
|
|
53
|
+
'can spell a familiar domain while the message goes to a different one, so such an address ' +
|
|
54
|
+
'is refused. A domain that really is written with such letters can be given in its ASCII ' +
|
|
55
|
+
'form, which starts with xn--, and that is then exactly what the confirmation shows.');
|
|
56
|
+
}
|
|
57
|
+
// nodemailer reads the address again, with its own parser, when it builds the
|
|
58
|
+
// envelope, and the two readings disagree. Measured with 10.1.7:
|
|
59
|
+
// "x@example.com:y" leaves the envelope empty, "a:b@example.com" goes to
|
|
60
|
+
// b@example.com. So the address has to come back out of the very code that
|
|
61
|
+
// builds the envelope as itself. Only the domain may change, to lower case.
|
|
62
|
+
const at = address.lastIndexOf('@');
|
|
63
|
+
const expected = address.slice(0, at) + address.slice(at).toLowerCase();
|
|
64
|
+
const envelope = new MimeNode()
|
|
65
|
+
.setEnvelope({ from: 'check@example.invalid', to: [address] })
|
|
66
|
+
.getEnvelope().to;
|
|
67
|
+
if (envelope.length !== 1 || envelope[0] !== expected) {
|
|
68
|
+
const outcome = envelope.length === 0 ? 'names no recipient at all' : `goes to ${envelope.join(', ')}`;
|
|
69
|
+
throw new BridgeError(`"${showInvisible(address)}" would not reach that address: read the way the message is sent, ` +
|
|
70
|
+
`it ${outcome}. Give the address on its own, without a comment in parentheses, a group ` +
|
|
71
|
+
'name or a colon.');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
20
74
|
/**
|
|
21
75
|
* Checks an address well enough to catch the mistakes that matter.
|
|
22
76
|
*
|
|
23
77
|
* Not a full RFC 5322 parser, and not trying to be: the point is to refuse a
|
|
24
78
|
* string that would end up somewhere unintended, not to adjudicate exotic but
|
|
25
|
-
* legal forms. A newline is the one that has to be caught, because a
|
|
26
|
-
* injected through an address field would let the sender of a mail the
|
|
27
|
-
* just read add a recipient the confirmation never showed.
|
|
79
|
+
* legal forms. A newline is the one that has to be caught first, because a
|
|
80
|
+
* header injected through an address field would let the sender of a mail the
|
|
81
|
+
* model just read add a recipient the confirmation never showed. Everything
|
|
82
|
+
* else that would make the confirmation and the envelope disagree is
|
|
83
|
+
* assertDeliverable's.
|
|
28
84
|
*/
|
|
29
85
|
export function parseRecipient(input) {
|
|
30
86
|
const raw = input.trim();
|
|
@@ -42,7 +98,9 @@ export function parseRecipient(input) {
|
|
|
42
98
|
throw new BridgeError(`"${address}" is not a usable email address. Expected something of the form name@example.com, ` +
|
|
43
99
|
'optionally as "Display Name <name@example.com>".');
|
|
44
100
|
}
|
|
45
|
-
|
|
101
|
+
const recipient = name ? { name, address } : { address };
|
|
102
|
+
assertDeliverable(recipient);
|
|
103
|
+
return recipient;
|
|
46
104
|
}
|
|
47
105
|
export function parseRecipients(list) {
|
|
48
106
|
return (list ?? []).map(parseRecipient);
|
|
@@ -93,7 +151,26 @@ export async function buildMessage(draft, options = {}) {
|
|
|
93
151
|
messageId: draft.messageId,
|
|
94
152
|
date: new Date(),
|
|
95
153
|
};
|
|
96
|
-
if (draft.html
|
|
154
|
+
if (draft.html !== undefined && draft.storedHtml !== undefined) {
|
|
155
|
+
// One body or the other. Both would mean the composed part had been checked
|
|
156
|
+
// and the stored part would go out beside it unread.
|
|
157
|
+
throw new BridgeError('A message cannot carry composed markup and a stored body at once.');
|
|
158
|
+
}
|
|
159
|
+
if (draft.storedHtml !== undefined) {
|
|
160
|
+
// Not checked against the permitted set, see Draft.storedHtml. What is
|
|
161
|
+
// still checked is that every picture it shows arrived with it.
|
|
162
|
+
const provided = new Set([
|
|
163
|
+
...(draft.inlineParts ?? []).map((part) => part.contentId),
|
|
164
|
+
...(draft.carriedFiles ?? []).flatMap((file) => (file.contentId ? [file.contentId] : [])),
|
|
165
|
+
]);
|
|
166
|
+
const missing = readMarkup(draft.storedHtml, 'extended').contentIds.filter((id) => !provided.has(id));
|
|
167
|
+
if (missing.length) {
|
|
168
|
+
throw new BridgeError(`The stored draft refers to ${missing.map((id) => `"cid:${id}"`).join(', ')}, but no such ` +
|
|
169
|
+
'file is stored with it. Open the draft in Proton and attach the picture again.');
|
|
170
|
+
}
|
|
171
|
+
fields.html = draft.storedHtml;
|
|
172
|
+
}
|
|
173
|
+
else if (draft.html === undefined) {
|
|
97
174
|
fields.text = draft.text;
|
|
98
175
|
}
|
|
99
176
|
else {
|
|
@@ -103,7 +180,10 @@ export async function buildMessage(draft, options = {}) {
|
|
|
103
180
|
// Every content id the markup points at has to have arrived with it. A
|
|
104
181
|
// reference to a part that is not there shows the recipient a broken image
|
|
105
182
|
// where the sender saw a picture, and neither of them finds out why.
|
|
106
|
-
const provided = new Set(
|
|
183
|
+
const provided = new Set([
|
|
184
|
+
...(draft.inlineParts ?? []).map((part) => part.contentId),
|
|
185
|
+
...(draft.carriedFiles ?? []).flatMap((file) => (file.contentId ? [file.contentId] : [])),
|
|
186
|
+
]);
|
|
107
187
|
const missing = reading.contentIds.filter((id) => !provided.has(id));
|
|
108
188
|
if (missing.length) {
|
|
109
189
|
throw new BridgeError(`The markup refers to ${missing.map((id) => `"cid:${id}"`).join(', ')}, but no such file ` +
|
|
@@ -137,6 +217,14 @@ export async function buildMessage(draft, options = {}) {
|
|
|
137
217
|
cid: part.contentId,
|
|
138
218
|
});
|
|
139
219
|
}
|
|
220
|
+
for (const file of draft.carriedFiles ?? []) {
|
|
221
|
+
attachments.push({
|
|
222
|
+
filename: file.filename,
|
|
223
|
+
content: file.content,
|
|
224
|
+
contentType: file.contentType,
|
|
225
|
+
...(file.contentId ? { cid: file.contentId } : {}),
|
|
226
|
+
});
|
|
227
|
+
}
|
|
140
228
|
if (attachments.length)
|
|
141
229
|
fields.attachments = attachments;
|
|
142
230
|
// keepBcc is not an option MailComposer understands. It lives on the MimeNode
|
|
@@ -335,6 +423,8 @@ export const PLAIN_TEXT_NOTE = 'The body is plain text and markup is not interpr
|
|
|
335
423
|
* to, and that is exactly the difference a person confirming a send has to see.
|
|
336
424
|
*/
|
|
337
425
|
export function readableBody(draft) {
|
|
426
|
+
if (draft.storedHtml !== undefined)
|
|
427
|
+
return htmlToText(draft.storedHtml);
|
|
338
428
|
return draft.html === undefined
|
|
339
429
|
? draft.text
|
|
340
430
|
: htmlToText(draft.html + (draft.quotedHtml ?? ''));
|
|
@@ -348,6 +438,8 @@ export function readableBody(draft) {
|
|
|
348
438
|
* before their own words appear.
|
|
349
439
|
*/
|
|
350
440
|
export function composedBody(draft) {
|
|
441
|
+
if (draft.storedHtml !== undefined)
|
|
442
|
+
return htmlToText(draft.storedHtml);
|
|
351
443
|
return draft.html === undefined ? draft.text : htmlToText(draft.html);
|
|
352
444
|
}
|
|
353
445
|
/**
|
|
@@ -376,6 +468,27 @@ export function summariseQuote(draft) {
|
|
|
376
468
|
hiddenText: reading.hiddenText,
|
|
377
469
|
};
|
|
378
470
|
}
|
|
471
|
+
/** The line this server writes above every forwarded message, in text and in markup. */
|
|
472
|
+
export const FORWARD_HEADER = '---------- Forwarded message ----------';
|
|
473
|
+
/**
|
|
474
|
+
* Whether the message carries a quoted one, for the count line of the
|
|
475
|
+
* confirmation.
|
|
476
|
+
*
|
|
477
|
+
* summariseQuote only sees a quote that is still held apart from the body,
|
|
478
|
+
* which is the case while a reply or a forward is composed with markup. Once a
|
|
479
|
+
* draft is stored, and in a plain text reply, the quote is part of the body,
|
|
480
|
+
* and up to 0.4.11 the confirmation said nothing about it. It is recognised
|
|
481
|
+
* there by what quotes it: the forward header this server writes, the "wrote:"
|
|
482
|
+
* line followed by quoted lines, or a blockquote, which is how Proton quotes.
|
|
483
|
+
*/
|
|
484
|
+
export function carriesQuote(draft) {
|
|
485
|
+
if (draft.quotedHtml)
|
|
486
|
+
return true;
|
|
487
|
+
if (draft.storedHtml !== undefined) {
|
|
488
|
+
return /<blockquote\b/i.test(draft.storedHtml) || draft.storedHtml.includes(FORWARD_HEADER);
|
|
489
|
+
}
|
|
490
|
+
return draft.text.includes(FORWARD_HEADER) || /^On .+ wrote:\n>/m.test(draft.text);
|
|
491
|
+
}
|
|
379
492
|
/**
|
|
380
493
|
* Everything the message points at or carries, for the confirmation.
|
|
381
494
|
*
|
|
@@ -392,16 +505,24 @@ export function describeAttachments(draft) {
|
|
|
392
505
|
for (const part of draft.inlineParts ?? []) {
|
|
393
506
|
lines.push(`${part.filename} (${part.contentType}, ${part.content.length} bytes, in the message body)`);
|
|
394
507
|
}
|
|
508
|
+
for (const file of draft.carriedFiles ?? []) {
|
|
509
|
+
const where = file.contentId ? ', in the message body' : '';
|
|
510
|
+
lines.push(`${file.filename} (${file.contentType}, ${file.content.length} bytes, stored with the draft${where})`);
|
|
511
|
+
}
|
|
395
512
|
return lines;
|
|
396
513
|
}
|
|
397
514
|
/** The addresses in a message's markup, with the text they are shown as. */
|
|
398
515
|
export function describeUrls(draft) {
|
|
516
|
+
if (draft.storedHtml !== undefined)
|
|
517
|
+
return readMarkup(draft.storedHtml, 'extended').urls;
|
|
399
518
|
return draft.html === undefined
|
|
400
519
|
? []
|
|
401
520
|
: assertSendableMarkup(draft.html, draft.markupLevel ?? 'standard').urls;
|
|
402
521
|
}
|
|
403
522
|
/** Text a recipient can read that the readable body leaves out. */
|
|
404
523
|
export function hiddenTextOf(draft) {
|
|
524
|
+
if (draft.storedHtml !== undefined)
|
|
525
|
+
return readMarkup(draft.storedHtml, 'extended').hiddenText;
|
|
405
526
|
return draft.html === undefined
|
|
406
527
|
? []
|
|
407
528
|
: assertSendableMarkup(draft.html, draft.markupLevel ?? 'standard').hiddenText;
|
|
@@ -419,8 +540,23 @@ export function fingerprintPart(content) {
|
|
|
419
540
|
* "what did it use" is a list rather than a promise.
|
|
420
541
|
*/
|
|
421
542
|
export function styleNotesOf(draft) {
|
|
543
|
+
if (draft.storedHtml !== undefined)
|
|
544
|
+
return readMarkup(draft.storedHtml, 'extended').styleNotes;
|
|
422
545
|
if (draft.html === undefined)
|
|
423
546
|
return [];
|
|
424
547
|
return assertSendableMarkup(draft.html, draft.markupLevel ?? 'standard').styleNotes;
|
|
425
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* What a stored body carries that no composed message may: style blocks,
|
|
551
|
+
* scripts, event handlers, data: addresses, comments.
|
|
552
|
+
*
|
|
553
|
+
* Empty for anything that is not a stored draft, because composed markup with
|
|
554
|
+
* such a thing never gets this far. For a stored draft it is part of what the
|
|
555
|
+
* confirmation warns about, since it was not checked again on the way out.
|
|
556
|
+
*/
|
|
557
|
+
export function storedBeyondOf(draft) {
|
|
558
|
+
if (draft.storedHtml === undefined)
|
|
559
|
+
return [];
|
|
560
|
+
return readMarkup(draft.storedHtml, 'extended').problems.map((problem) => problem.found);
|
|
561
|
+
}
|
|
426
562
|
//# sourceMappingURL=compose.js.map
|
package/dist/mail/compose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,UAAU,CAAA;IAC9F,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IACvC,OAAO,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC,UAAU,CAAA;AACrF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAY;IACzC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAC7C,OAAO,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC1F,CAAC"}
|
package/dist/mail/drafts.d.ts
CHANGED
|
@@ -77,8 +77,19 @@ export interface DraftResult {
|
|
|
77
77
|
bcc: Recipient[];
|
|
78
78
|
/** Its uid in "Drafts". Valid until the draft is replaced. */
|
|
79
79
|
uid: number;
|
|
80
|
-
/**
|
|
81
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Set when a whole message was carried along, as with a forward.
|
|
82
|
+
*
|
|
83
|
+
* Two things, kept apart because they were confused up to 0.4.11: the one
|
|
84
|
+
* file this server attached, and the attachments travelling inside it. The
|
|
85
|
+
* answer used to name the first as if it were the second.
|
|
86
|
+
*/
|
|
87
|
+
attachedOriginal?: {
|
|
88
|
+
filename: string;
|
|
89
|
+
carries: string[];
|
|
90
|
+
};
|
|
91
|
+
/** Files that were stored with the draft and stay with it. */
|
|
92
|
+
keptFiles?: string[];
|
|
82
93
|
}
|
|
83
94
|
/** Creates a draft from scratch. */
|
|
84
95
|
export declare function createDraft(connection: Connection, readOnly: boolean, fromAddress: string, input: DraftInput): Promise<DraftResult>;
|
package/dist/mail/drafts.js
CHANGED
|
@@ -41,8 +41,10 @@
|
|
|
41
41
|
import { BridgeError } from '../bridge/errors.js';
|
|
42
42
|
import { normaliseMessageId, findByMessageId } from './ids.js';
|
|
43
43
|
import { getMessage, listMessages } from './messages.js';
|
|
44
|
-
import { htmlToText } from '../mime/parse.js';
|
|
45
|
-
import {
|
|
44
|
+
import { htmlToText, parseMessage } from '../mime/parse.js';
|
|
45
|
+
import { readParts } from '../mime/parts.js';
|
|
46
|
+
import { forwardedFileName } from '../mime/filenames.js';
|
|
47
|
+
import { allRecipients, assertDeliverable, buildMessage, FORWARD_HEADER, mintMessageId, parseRecipient, parseRecipients, escapeHtml, prefixSubject, quote, quoteAsHtml, quoteBody, } from './compose.js';
|
|
46
48
|
/** The one mailbox this module writes to. */
|
|
47
49
|
export const DRAFTS = 'Drafts';
|
|
48
50
|
/**
|
|
@@ -104,6 +106,24 @@ async function findDraft(connection, messageId) {
|
|
|
104
106
|
return { uid, flags: message && message.flags ? message.flags : new Set() };
|
|
105
107
|
});
|
|
106
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* A stored draft as it lies in Drafts.
|
|
111
|
+
*
|
|
112
|
+
* The headers are read as everywhere else. Body and files come from readParts
|
|
113
|
+
* rather than from mailparser, which writes a forwarded original into the body
|
|
114
|
+
* and rewrites every cid: picture, so that what came back was not what had
|
|
115
|
+
* been stored. See src/mime/parts.ts.
|
|
116
|
+
*/
|
|
117
|
+
async function readStored(connection, uid) {
|
|
118
|
+
const source = await connection.withMailbox(DRAFTS, async (client) => {
|
|
119
|
+
const message = await client.fetchOne(String(uid), { source: true }, { uid: true });
|
|
120
|
+
return message && message.source ? message.source : undefined;
|
|
121
|
+
});
|
|
122
|
+
if (!source) {
|
|
123
|
+
throw new BridgeError(`The draft could not be read from "${DRAFTS}". It may have been sent or moved in the meantime.`);
|
|
124
|
+
}
|
|
125
|
+
return { message: await parseMessage(source), parts: await readParts(source) };
|
|
126
|
+
}
|
|
107
127
|
/** Writes a built message into Drafts and describes what was stored. */
|
|
108
128
|
async function store(connection, draft) {
|
|
109
129
|
const raw = await buildMessage(draft, { keepBcc: true });
|
|
@@ -173,7 +193,7 @@ export async function updateDraft(connection, readOnly, fromAddress, messageId,
|
|
|
173
193
|
throw new BridgeError(`The message ${id} is in "${DRAFTS}" but does not carry the draft flag, so it is not treated ` +
|
|
174
194
|
'as a draft. Refusing to replace it, because replacing means deleting the old version.');
|
|
175
195
|
}
|
|
176
|
-
const current = await
|
|
196
|
+
const { message: current, parts } = await readStored(connection, existing.uid);
|
|
177
197
|
const from = parseRecipient(fromAddress);
|
|
178
198
|
const draft = {
|
|
179
199
|
from,
|
|
@@ -184,9 +204,15 @@ export async function updateDraft(connection, readOnly, fromAddress, messageId,
|
|
|
184
204
|
// only ever true for a draft this server wrote.
|
|
185
205
|
bcc: changes.bcc === undefined ? current.bcc : parseRecipients(changes.bcc),
|
|
186
206
|
subject: changes.subject === undefined ? current.subject : changes.subject,
|
|
187
|
-
...
|
|
207
|
+
...bodyOf(changes, parts),
|
|
188
208
|
messageId: id,
|
|
209
|
+
// Kept whatever happens to the body. No tool removes a file from a draft,
|
|
210
|
+
// so none may disappear as a side effect of changing the text.
|
|
211
|
+
...(parts.files.length ? { carriedFiles: parts.files } : {}),
|
|
189
212
|
};
|
|
213
|
+
// The recipients carried over were read back from the stored draft rather
|
|
214
|
+
// than typed, and have not been through parseRecipient.
|
|
215
|
+
allRecipients(draft).forEach(assertDeliverable);
|
|
190
216
|
const raw = await buildMessage(draft, { keepBcc: true });
|
|
191
217
|
const uid = await appendDraft(connection, raw);
|
|
192
218
|
await connection.withMailbox(DRAFTS, async (client, status) => {
|
|
@@ -202,6 +228,7 @@ export async function updateDraft(connection, readOnly, fromAddress, messageId,
|
|
|
202
228
|
cc: draft.cc,
|
|
203
229
|
bcc: draft.bcc,
|
|
204
230
|
uid,
|
|
231
|
+
...(parts.files.length ? { keptFiles: parts.files.map((file) => file.filename) } : {}),
|
|
205
232
|
};
|
|
206
233
|
}
|
|
207
234
|
/**
|
|
@@ -221,15 +248,18 @@ export async function updateDraft(connection, readOnly, fromAddress, messageId,
|
|
|
221
248
|
* `standard`. A level carried over onto markup nobody re-stated would be a
|
|
222
249
|
* permission granted by an earlier call.
|
|
223
250
|
*/
|
|
224
|
-
function
|
|
225
|
-
|
|
226
|
-
|
|
251
|
+
function bodyOf(changes, stored) {
|
|
252
|
+
if (changes.html !== undefined) {
|
|
253
|
+
const level = changes.markupLevel !== undefined ? { markupLevel: changes.markupLevel } : {};
|
|
227
254
|
return { text: htmlToText(changes.html), html: changes.html, ...level };
|
|
255
|
+
}
|
|
228
256
|
if (changes.text !== undefined)
|
|
229
257
|
return { text: changes.text };
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
258
|
+
// Nothing restated: the stored body stays as it was, quote and all, and is
|
|
259
|
+
// not checked again. See Draft.storedHtml for why it cannot be.
|
|
260
|
+
return stored.html !== undefined
|
|
261
|
+
? { text: htmlToText(stored.html), storedHtml: stored.html }
|
|
262
|
+
: { text: (stored.text ?? '').trim() };
|
|
233
263
|
}
|
|
234
264
|
/**
|
|
235
265
|
* The body of a reply, with the original quoted below it.
|
|
@@ -359,11 +389,14 @@ export async function buildForwardDraft(connection, fromAddress, messageId, to,
|
|
|
359
389
|
}
|
|
360
390
|
const header = [
|
|
361
391
|
'',
|
|
362
|
-
|
|
392
|
+
FORWARD_HEADER,
|
|
363
393
|
`From: ${original.from.map((f) => (f.name ? `${f.name} <${f.address}>` : f.address)).join(', ')}`,
|
|
364
394
|
`Date: ${original.date ? original.date.toISOString().slice(0, 16).replace('T', ' ') : 'unknown'}`,
|
|
365
395
|
`Subject: ${original.subject || '(no subject)'}`,
|
|
366
396
|
`To: ${original.to.map((t) => t.address).join(', ') || '(none)'}`,
|
|
397
|
+
// Two, so that a blank line parts the head from the original's first line.
|
|
398
|
+
// With one the two ran together, seen on 2026-11-02.
|
|
399
|
+
'',
|
|
367
400
|
'',
|
|
368
401
|
].join('\n');
|
|
369
402
|
const draft = {
|
|
@@ -375,7 +408,7 @@ export async function buildForwardDraft(connection, fromAddress, messageId, to,
|
|
|
375
408
|
...(options.html === undefined
|
|
376
409
|
? { text: `${text}\n${header}${original.text}` }
|
|
377
410
|
: (() => {
|
|
378
|
-
const head = `<p
|
|
411
|
+
const head = `<p>${FORWARD_HEADER}<br>` +
|
|
379
412
|
`From: ${escapeHtml(original.from.map((f) => (f.name ? `${f.name} <${f.address}>` : f.address)).join(', '))}<br>` +
|
|
380
413
|
`Date: ${escapeHtml(original.date ? original.date.toISOString().slice(0, 16).replace('T', ' ') : 'unknown')}<br>` +
|
|
381
414
|
`Subject: ${escapeHtml(original.subject || '(no subject)')}<br>` +
|
|
@@ -401,8 +434,9 @@ export async function buildForwardDraft(connection, fromAddress, messageId, to,
|
|
|
401
434
|
});
|
|
402
435
|
if (source) {
|
|
403
436
|
draft.attachedMessage = {
|
|
404
|
-
filename:
|
|
437
|
+
filename: forwardedFileName(original.subject),
|
|
405
438
|
raw: source,
|
|
439
|
+
carries: original.attachments.map((attachment) => attachment.filename),
|
|
406
440
|
};
|
|
407
441
|
}
|
|
408
442
|
}
|
|
@@ -414,7 +448,13 @@ export async function forwardDraft(connection, readOnly, fromAddress, messageId,
|
|
|
414
448
|
const draft = await buildForwardDraft(connection, fromAddress, messageId, to, text, options);
|
|
415
449
|
const stored = await store(connection, draft);
|
|
416
450
|
return draft.attachedMessage
|
|
417
|
-
? {
|
|
451
|
+
? {
|
|
452
|
+
...stored,
|
|
453
|
+
attachedOriginal: {
|
|
454
|
+
filename: draft.attachedMessage.filename,
|
|
455
|
+
carries: draft.attachedMessage.carries ?? [],
|
|
456
|
+
},
|
|
457
|
+
}
|
|
418
458
|
: stored;
|
|
419
459
|
}
|
|
420
460
|
/** The drafts that are there. Reading only. */
|
|
@@ -447,22 +487,33 @@ export async function readDraftForSending(connection, fromAddress, messageId) {
|
|
|
447
487
|
throw new BridgeError(`The message ${id} is in "${DRAFTS}" but does not carry the draft flag, so it is not a ` +
|
|
448
488
|
'draft. Refusing to send it.');
|
|
449
489
|
}
|
|
450
|
-
const stored = await
|
|
490
|
+
const { message: stored, parts } = await readStored(connection, existing.uid);
|
|
451
491
|
if (stored.to.length === 0 && stored.cc.length === 0 && stored.bcc.length === 0) {
|
|
452
492
|
throw new BridgeError(`The draft ${id} has no recipient, so there is nobody to send it to. Add one with ` +
|
|
453
493
|
'update_draft first.');
|
|
454
494
|
}
|
|
495
|
+
// A stored draft may have been written anywhere, in Proton itself included,
|
|
496
|
+
// so its recipients are held to the same rule as typed ones before the
|
|
497
|
+
// confirmation shows them.
|
|
498
|
+
for (const recipient of [...stored.to, ...stored.cc, ...stored.bcc])
|
|
499
|
+
assertDeliverable(recipient);
|
|
455
500
|
return {
|
|
456
501
|
from: parseRecipient(fromAddress),
|
|
457
502
|
to: stored.to,
|
|
458
503
|
cc: stored.cc,
|
|
459
504
|
bcc: stored.bcc,
|
|
460
505
|
subject: stored.subject,
|
|
461
|
-
text:
|
|
506
|
+
text: parts.html !== undefined ? htmlToText(parts.html) : (parts.text ?? '').trim(),
|
|
462
507
|
messageId: id,
|
|
463
508
|
// A draft written as markup is sent as the markup it was. Converting it to
|
|
464
|
-
// text and back would deliver something its author never wrote.
|
|
465
|
-
|
|
509
|
+
// text and back would deliver something its author never wrote. It goes
|
|
510
|
+
// out as it was stored, without the check composed markup goes through,
|
|
511
|
+
// which is what Draft.storedHtml explains.
|
|
512
|
+
...(parts.html !== undefined ? { storedHtml: parts.html } : {}),
|
|
513
|
+
// Its files too, the forwarded original among them. Up to 0.4.11 they were
|
|
514
|
+
// dropped here, and a forward sent from a draft went out without the
|
|
515
|
+
// message it forwarded.
|
|
516
|
+
...(parts.files.length ? { carriedFiles: parts.files } : {}),
|
|
466
517
|
};
|
|
467
518
|
}
|
|
468
519
|
//# sourceMappingURL=drafts.js.map
|