proton-mail-bridge-client 2.3.1 → 2.3.2
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.d.ts.map +1 -1
- package/dist/index.js +54 -11
- package/dist/index.js.map +1 -1
- package/dist/services/delivery-queue-service.d.ts +4 -1
- package/dist/services/delivery-queue-service.d.ts.map +1 -1
- package/dist/services/delivery-queue-service.js +18 -19
- package/dist/services/delivery-queue-service.js.map +1 -1
- package/dist/services/draft-store-service.d.ts.map +1 -1
- package/dist/services/draft-store-service.js +10 -21
- package/dist/services/draft-store-service.js.map +1 -1
- package/dist/services/local-index-service.d.ts.map +1 -1
- package/dist/services/local-index-service.js +46 -24
- package/dist/services/local-index-service.js.map +1 -1
- package/dist/services/simple-imap-service.d.ts +1 -0
- package/dist/services/simple-imap-service.d.ts.map +1 -1
- package/dist/services/simple-imap-service.js +25 -5
- package/dist/services/simple-imap-service.js.map +1 -1
- package/dist/services/smtp-service.d.ts.map +1 -1
- package/dist/services/smtp-service.js +9 -2
- package/dist/services/smtp-service.js.map +1 -1
- package/dist/services/snooze-service.d.ts.map +1 -1
- package/dist/services/snooze-service.js +3 -10
- package/dist/services/snooze-service.js.map +1 -1
- package/dist/services/template-service.d.ts.map +1 -1
- package/dist/services/template-service.js +3 -10
- package/dist/services/template-service.js.map +1 -1
- package/dist/utils/corrupt-store.d.ts +4 -0
- package/dist/utils/corrupt-store.d.ts.map +1 -0
- package/dist/utils/corrupt-store.js +29 -0
- package/dist/utils/corrupt-store.js.map +1 -0
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +59 -6
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYn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AAmB,CASpF;AAsQD,wBAAgB,kBAAkB,IAAI,gBAAgB,CAoGrD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAimJP;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuE1C"}
|
package/dist/index.js
CHANGED
|
@@ -905,7 +905,7 @@ const TOOLS = [
|
|
|
905
905
|
},
|
|
906
906
|
{
|
|
907
907
|
name: "count_messages",
|
|
908
|
-
description: "Count messages matching search criteria. Plain IMAP criteria are answered by the server without fetching messages; non-ASCII values (accented letters, ł, ß) and local-only filters (hasAttachment, senderDomain,
|
|
908
|
+
description: "Count messages matching search criteria. Plain IMAP criteria are answered by the server without fetching messages; non-ASCII values (accented letters, ł, ß) and local-only filters (hasAttachment, senderDomain, threadId, attachmentName, mailboxRole) are checked locally, and the result carries approximate: true when only the newest 500 candidates could be checked. A label that names a folder (Proton: Labels/<name>) counts that folder, as search_emails does. Across several accounts the counts are summed and an account that fails (for example one without that folder) is listed in failedAccounts instead of failing the whole call. Use to preview how many results a search would return before running it. Prefer folder_stats for a simple unread/total count on one folder without filters.",
|
|
909
909
|
annotations: { readOnlyHint: true },
|
|
910
910
|
inputSchema: {
|
|
911
911
|
type: "object",
|
|
@@ -2179,7 +2179,9 @@ export function formatQuoteDate(value) {
|
|
|
2179
2179
|
// (a broken-image box) and copies its base64 into every reply, and a cid: image refers to a part
|
|
2180
2180
|
// that is not attached here. Replace each with its alt text, or nothing.
|
|
2181
2181
|
export function stripUnshippableImages(html) {
|
|
2182
|
-
|
|
2182
|
+
// A tag is a run of non-quote characters and quoted strings, so a ">" inside alt="a>b" does not end
|
|
2183
|
+
// it and an unclosed "<img" stops at the next "<" instead of scanning to the end of the text.
|
|
2184
|
+
return html.replace(/<img\b(?:[^<>"']|"[^"]*"|'[^']*')*>/gi, (tag) => {
|
|
2183
2185
|
const src = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(tag);
|
|
2184
2186
|
const value = (src?.[1] ?? src?.[2] ?? src?.[3] ?? "").trim().toLowerCase();
|
|
2185
2187
|
if (!value.startsWith("data:") && !value.startsWith("cid:"))
|
|
@@ -2189,6 +2191,13 @@ export function stripUnshippableImages(html) {
|
|
|
2189
2191
|
return text ? `[${text}]` : "";
|
|
2190
2192
|
});
|
|
2191
2193
|
}
|
|
2194
|
+
// References for a reply: the original's own chain followed by the original's Message-ID (RFC 5322),
|
|
2195
|
+
// so mail clients that thread by References keep the whole conversation together.
|
|
2196
|
+
function replyReferences(detail) {
|
|
2197
|
+
const chain = [...(detail.references ?? []), detail.messageId].filter((id) => Boolean(id));
|
|
2198
|
+
const unique = [...new Set(chain)];
|
|
2199
|
+
return unique.length > 0 ? unique : undefined;
|
|
2200
|
+
}
|
|
2192
2201
|
function buildReplyText(detail, body) {
|
|
2193
2202
|
const originalText = detail.text || detail.preview || "";
|
|
2194
2203
|
const fromText = formatAddressList(detail.from);
|
|
@@ -2636,7 +2645,7 @@ function parseResourceUri(uri) {
|
|
|
2636
2645
|
// created here are owner-only (0700) and the file is 0600, existing files included.
|
|
2637
2646
|
export async function writeAttachmentToDownloadDir(downloadDir, saveTo, data) {
|
|
2638
2647
|
const { resolve: pathResolve, join: pathJoin, dirname, basename, sep } = await import("node:path");
|
|
2639
|
-
const { realpathSync } = await import("node:fs");
|
|
2648
|
+
const { realpathSync, existsSync } = await import("node:fs");
|
|
2640
2649
|
const { writeFile: wf, mkdir: mkd, chmod: chm } = await import("node:fs/promises");
|
|
2641
2650
|
const absDir = pathResolve(downloadDir);
|
|
2642
2651
|
const absTarget = pathJoin(absDir, saveTo);
|
|
@@ -2645,8 +2654,26 @@ export async function writeAttachmentToDownloadDir(downloadDir, saveTo, data) {
|
|
|
2645
2654
|
if (!absTarget.startsWith(absDir + sep) && absTarget !== absDir) {
|
|
2646
2655
|
throw new McpError(ErrorCode.InvalidParams, "saveTo path escapes the allowed directory.");
|
|
2647
2656
|
}
|
|
2648
|
-
|
|
2657
|
+
// The allowed directory itself may be created. Then check, BEFORE creating anything below it, that the
|
|
2658
|
+
// deepest directory that already exists on the way to the target really is inside it: otherwise a
|
|
2659
|
+
// symlink in the allowed dir could make mkdir create new directories outside it before the final
|
|
2660
|
+
// containment check below refuses the save.
|
|
2661
|
+
await mkd(absDir, { recursive: true, mode: 0o700 });
|
|
2649
2662
|
const realDir = realpathSync(absDir);
|
|
2663
|
+
let probe = pathResolve(absTarget, "..");
|
|
2664
|
+
while (!existsSync(probe))
|
|
2665
|
+
probe = dirname(probe);
|
|
2666
|
+
let realProbe;
|
|
2667
|
+
try {
|
|
2668
|
+
realProbe = realpathSync(probe);
|
|
2669
|
+
}
|
|
2670
|
+
catch {
|
|
2671
|
+
throw new McpError(ErrorCode.InvalidParams, "saveTo path escapes the allowed directory.");
|
|
2672
|
+
}
|
|
2673
|
+
if (!realProbe.startsWith(realDir + sep) && realProbe !== realDir) {
|
|
2674
|
+
throw new McpError(ErrorCode.InvalidParams, "saveTo path escapes the allowed directory.");
|
|
2675
|
+
}
|
|
2676
|
+
await mkd(pathResolve(absTarget, ".."), { recursive: true, mode: 0o700 });
|
|
2650
2677
|
let realTarget;
|
|
2651
2678
|
try {
|
|
2652
2679
|
realTarget = realpathSync(absTarget);
|
|
@@ -4140,7 +4167,11 @@ export function createServer(config, options = {}) {
|
|
|
4140
4167
|
// Signature goes right after the user's own reply text, before the
|
|
4141
4168
|
// quoted original — not at the very end, after the quote.
|
|
4142
4169
|
const signedReply = applySignature(body, htmlBody, normalizeBoolean(args.appendSignature, true), isHtml);
|
|
4143
|
-
|
|
4170
|
+
// With isHtml the body is HTML source, so the quoted original (untrusted text) must be HTML-escaped
|
|
4171
|
+
// by the HTML builder, not appended as raw plain text.
|
|
4172
|
+
const replyBody = includeQuoteReply
|
|
4173
|
+
? (isHtml ? buildReplyHtml(detail, signedReply.body) : buildReplyText(detail, signedReply.body))
|
|
4174
|
+
: signedReply.body;
|
|
4144
4175
|
// A separate htmlBody (the markdown-rendered case) needs the SAME quoted
|
|
4145
4176
|
// original merged in — see buildReplyHtml's comment for why this was
|
|
4146
4177
|
// previously missing entirely from the html part.
|
|
@@ -4165,7 +4196,7 @@ export function createServer(config, options = {}) {
|
|
|
4165
4196
|
from: fromReply,
|
|
4166
4197
|
sanitizeHtml: sanitizeHtmlReply,
|
|
4167
4198
|
inReplyTo: detail.messageId,
|
|
4168
|
-
references: detail
|
|
4199
|
+
references: replyReferences(detail),
|
|
4169
4200
|
attachments,
|
|
4170
4201
|
// Already applied above, before quote-wrapping.
|
|
4171
4202
|
appendSignature: false,
|
|
@@ -4237,7 +4268,9 @@ export function createServer(config, options = {}) {
|
|
|
4237
4268
|
// Signature goes right after the user's own reply text, before the
|
|
4238
4269
|
// quoted original — not at the very end, after the quote.
|
|
4239
4270
|
const signedReplyRa = applySignature(bodyRa, htmlBodyRa, normalizeBoolean(args.appendSignature, true), isHtmlRa);
|
|
4240
|
-
const replyBodyRa = includeQuoteRa
|
|
4271
|
+
const replyBodyRa = includeQuoteRa
|
|
4272
|
+
? (isHtmlRa ? buildReplyHtml(detailRa, signedReplyRa.body) : buildReplyText(detailRa, signedReplyRa.body))
|
|
4273
|
+
: signedReplyRa.body;
|
|
4241
4274
|
// Same fix as reply_to_email — see buildReplyHtml's comment.
|
|
4242
4275
|
const replyHtmlBodyRa = includeQuoteRa && signedReplyRa.htmlBody !== undefined
|
|
4243
4276
|
? buildReplyHtml(detailRa, signedReplyRa.htmlBody)
|
|
@@ -4360,7 +4393,7 @@ export function createServer(config, options = {}) {
|
|
|
4360
4393
|
cc,
|
|
4361
4394
|
bcc,
|
|
4362
4395
|
subject: prefixedSubject(detail.subject, "Fwd:"),
|
|
4363
|
-
body: buildForwardText(detail, signedFwd.body),
|
|
4396
|
+
body: isHtml ? buildForwardHtml(detail, signedFwd.body) : buildForwardText(detail, signedFwd.body),
|
|
4364
4397
|
isHtml,
|
|
4365
4398
|
htmlBody: forwardHtmlBody,
|
|
4366
4399
|
fromName: fromNameFwd,
|
|
@@ -4523,7 +4556,7 @@ export function createServer(config, options = {}) {
|
|
|
4523
4556
|
// sender instead of the alias the caller asked for.
|
|
4524
4557
|
from: optionalString(args, "from"),
|
|
4525
4558
|
inReplyTo: detail.messageId,
|
|
4526
|
-
references: detail
|
|
4559
|
+
references: replyReferences(detail),
|
|
4527
4560
|
attachments,
|
|
4528
4561
|
sourceEmailId: detail.id,
|
|
4529
4562
|
sourceMessageId: detail.messageId,
|
|
@@ -5422,14 +5455,24 @@ export function createServer(config, options = {}) {
|
|
|
5422
5455
|
// Merge strategy: count in every account's mailbox and sum — folder is
|
|
5423
5456
|
// reported from the request (all accounts are counted against the same
|
|
5424
5457
|
// folder name), with a per-account breakdown alongside the total.
|
|
5425
|
-
|
|
5458
|
+
// One account lacking the folder or label (or unreachable) must not fail the whole count, as in
|
|
5459
|
+
// search_emails: report it and return the rest. Every account failing still throws.
|
|
5460
|
+
const settled = await Promise.allSettled(accountManager.all().map(async (bundle) => ({
|
|
5426
5461
|
slug: bundle.account.slug,
|
|
5427
5462
|
...(await bundle.imapService.countMessages(countInput)),
|
|
5428
5463
|
})));
|
|
5464
|
+
const perAccount = settled.flatMap((entry) => (entry.status === "fulfilled" ? [entry.value] : []));
|
|
5465
|
+
if (perAccount.length === 0) {
|
|
5466
|
+
throw settled[0].reason;
|
|
5467
|
+
}
|
|
5468
|
+
const failedAccounts = settled.flatMap((entry, index) => entry.status === "rejected"
|
|
5469
|
+
? [{ account: accountManager.all()[index].account.slug, error: entry.reason instanceof Error ? entry.reason.message : String(entry.reason) }]
|
|
5470
|
+
: []);
|
|
5429
5471
|
return createTextResult({
|
|
5430
5472
|
folder: countInput.folder ?? "INBOX",
|
|
5431
5473
|
count: perAccount.reduce((sum, entry) => sum + entry.count, 0),
|
|
5432
5474
|
...(perAccount.some((entry) => entry.approximate) ? { approximate: true } : {}),
|
|
5475
|
+
...(failedAccounts.length > 0 ? { failedAccounts } : {}),
|
|
5433
5476
|
byAccount: perAccount,
|
|
5434
5477
|
});
|
|
5435
5478
|
}
|
|
@@ -7226,7 +7269,7 @@ export function createServer(config, options = {}) {
|
|
|
7226
7269
|
// Same fix as create_reply_draft — see its comment.
|
|
7227
7270
|
from: optionalString(args, "from"),
|
|
7228
7271
|
inReplyTo: detail.messageId,
|
|
7229
|
-
references: detail
|
|
7272
|
+
references: replyReferences(detail),
|
|
7230
7273
|
attachments,
|
|
7231
7274
|
sourceEmailId: detail.id,
|
|
7232
7275
|
sourceMessageId: detail.messageId,
|