emailengine-app 2.88.0 → 2.90.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.
Files changed (79) hide show
  1. package/.ncurc.js +36 -45
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +58 -0
  4. package/Dockerfile +5 -1
  5. package/bin/healthcheck.js +1 -1
  6. package/copy-static-files.sh +0 -8
  7. package/data/google-crawlers.json +1 -1
  8. package/encrypt.js +1 -4
  9. package/lib/account/field-codec.js +396 -0
  10. package/lib/account.js +158 -453
  11. package/lib/api-routes/account-routes.js +42 -6
  12. package/lib/api-routes/route-metadata.js +5 -2
  13. package/lib/api-routes/submit-routes.js +15 -2
  14. package/lib/api-token-auth.js +342 -274
  15. package/lib/arf-detect.js +174 -149
  16. package/lib/attachment-size.js +29 -0
  17. package/lib/autodetect-imap-settings.js +83 -234
  18. package/lib/consts.js +1 -5
  19. package/lib/db.js +1 -4
  20. package/lib/email-client/base-client.js +907 -780
  21. package/lib/email-client/gmail-client.js +557 -450
  22. package/lib/email-client/imap/cid-parts.js +61 -0
  23. package/lib/email-client/imap/mailbox.js +376 -422
  24. package/lib/email-client/imap/sync-operations.js +239 -178
  25. package/lib/email-client/new-message-steps.js +168 -2
  26. package/lib/email-client/outlook/graph-message.js +266 -0
  27. package/lib/email-client/outlook/subscription-expiry.js +30 -0
  28. package/lib/email-client/outlook-client.js +652 -808
  29. package/lib/get-raw-email.js +338 -232
  30. package/lib/get-secret.js +1 -4
  31. package/lib/license-subscription.js +77 -11
  32. package/lib/load-env.js +48 -0
  33. package/lib/logger.js +1 -4
  34. package/lib/mcp/tools.js +244 -207
  35. package/lib/metric-values.js +76 -0
  36. package/lib/metrics.js +320 -0
  37. package/lib/node-version.js +99 -12
  38. package/lib/oauth/gmail.js +39 -120
  39. package/lib/oauth/http-request.js +195 -0
  40. package/lib/oauth/mail-ru.js +24 -58
  41. package/lib/oauth/outlook.js +37 -137
  42. package/lib/oauth/pubsub/google.js +176 -117
  43. package/lib/oauth2-apps.js +440 -463
  44. package/lib/openapi/build-document.js +10 -10
  45. package/lib/read-env-value.js +1 -1
  46. package/lib/route-descriptors.js +78 -0
  47. package/lib/schemas.js +10 -1
  48. package/lib/sentry-integrations.js +299 -0
  49. package/lib/sentry.js +75 -27
  50. package/lib/settings.js +4 -1
  51. package/lib/sso-routes.js +249 -0
  52. package/lib/sso.js +29 -6
  53. package/lib/tools.js +5 -4
  54. package/lib/ui-routes/account-edit-form.js +198 -0
  55. package/lib/ui-routes/account-page.js +241 -0
  56. package/lib/ui-routes/account-routes.js +12 -318
  57. package/lib/ui-routes/auth-routes.js +10 -10
  58. package/lib/ui-routes/dashboard-routes.js +4 -0
  59. package/lib/ui-view-context.js +328 -0
  60. package/lib/utils/public-suffix.js +22 -101
  61. package/lib/web-safe-html.js +70 -13
  62. package/lib/worker-metrics.js +82 -0
  63. package/list-generate.js +57 -23
  64. package/package.json +34 -33
  65. package/sbom.json +380 -1612
  66. package/scripts/refresh-test-tokens.js +1 -1
  67. package/server.js +351 -707
  68. package/static/css/flyonui.css +1 -1
  69. package/static/css/src/app.tailwind.css +18 -0
  70. package/static/js/ee-client.js +2619 -645
  71. package/static/js/ui.js +12 -2
  72. package/static/licenses.html +1055 -969
  73. package/translations/messages.pot +71 -60
  74. package/views/accounts/browse.hbs +19 -1
  75. package/views/dashboard.hbs +9 -0
  76. package/views/upgrade.hbs +25 -0
  77. package/workers/api.js +20 -451
  78. package/data/public_suffix_list.dat +0 -16597
  79. package/lib/net-tos-guard.js +0 -42
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ // Which attachments of an IMAP message its html shows inline, and which body parts have to be
4
+ // downloaded to embed them. Shared by Mailbox.getMessage() (embedAttachedImages) and
5
+ // Mailbox.processNew() (the web-safe copy of a new message), which carried copies of this loop.
6
+
7
+ const { collectCidReferences } = require('../../tools');
8
+ const { MAX_INLINE_ATTACHMENT_SIZE } = require('../../consts');
9
+
10
+ /**
11
+ * Collects the attachments the html of a message refers to by content id. Each one that has to be
12
+ * downloaded gets its IMAP body part as a non-enumerable `part` property (read off the attachment
13
+ * id, which carries it after an 8 byte prefix), so it never reaches a serialized message.
14
+ *
15
+ * @param {Object} messageInfo - Message with text.html and attachments
16
+ * @param {Object} [opts]
17
+ * @param {boolean} [opts.reuseLoaded] - Keep content an attachment already carries, and do not
18
+ * download such an attachment or one larger than MAX_INLINE_ATTACHMENT_SIZE
19
+ * @returns {{attachmentList: Map<string, {attachment: Object, content: *}>, partList: string[]}}
20
+ * the referenced attachments by content id, and the distinct body parts to download
21
+ */
22
+ function collectCidParts(messageInfo, opts) {
23
+ opts = opts || {};
24
+
25
+ let attachmentList = new Map();
26
+ let partList = [];
27
+ let cidReferences = collectCidReferences(messageInfo.text.html);
28
+
29
+ for (let attachment of messageInfo.attachments || []) {
30
+ let contentId = attachment.contentId && attachment.contentId.replace(/^<|>$/g, '');
31
+ if (!contentId || !cidReferences.has(contentId)) {
32
+ continue;
33
+ }
34
+
35
+ attachmentList.set(contentId, {
36
+ attachment,
37
+ content: (opts.reuseLoaded && attachment.content) || null
38
+ });
39
+
40
+ if (opts.reuseLoaded && (attachment.content || (attachment.encodedSize && attachment.encodedSize > MAX_INLINE_ATTACHMENT_SIZE))) {
41
+ // already loaded by notifyAttachments, or too large to inline
42
+ continue;
43
+ }
44
+
45
+ let buf = Buffer.from(attachment.id, 'base64url');
46
+ let part = buf.subarray(8).toString();
47
+
48
+ Object.defineProperty(attachment, 'part', {
49
+ value: part,
50
+ enumerable: false
51
+ });
52
+
53
+ if (!partList.includes(part)) {
54
+ partList.push(part);
55
+ }
56
+ }
57
+
58
+ return { attachmentList, partList };
59
+ }
60
+
61
+ module.exports = { collectCidParts };