emailengine-app 2.83.1 → 2.84.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 (83) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +30 -0
  3. package/README.md +1 -1
  4. package/SECURITY.md +126 -47
  5. package/data/google-crawlers.json +1 -1
  6. package/gettext-extract.js +95 -15
  7. package/lib/api-routes/outbox-routes.js +132 -9
  8. package/lib/api-routes/permission-map.js +11 -1
  9. package/lib/consts.js +3 -5
  10. package/lib/email-client/base-client.js +44 -20
  11. package/lib/email-client/credential-errors.js +3 -31
  12. package/lib/email-client/imap/idle-settings.js +44 -0
  13. package/lib/email-client/imap/mailbox.js +19 -7
  14. package/lib/email-client/imap-client.js +3 -21
  15. package/lib/email-client/smtp-pool-manager.js +25 -6
  16. package/lib/enum-descriptions.js +7 -0
  17. package/lib/export.js +46 -42
  18. package/lib/field-usage.js +4 -0
  19. package/lib/handlebars-helpers.js +4 -0
  20. package/lib/imapproxy/imap-core/lib/commands/starttls.js +4 -2
  21. package/lib/imapproxy/imap-core/lib/imap-server.js +44 -11
  22. package/lib/imapproxy/proxy-handoff.js +10 -1
  23. package/lib/logger.js +3 -2
  24. package/lib/message-port-stream.js +23 -0
  25. package/lib/network-errors.js +50 -0
  26. package/lib/oauth/gmail.js +5 -1
  27. package/lib/oauth/mail-ru.js +5 -1
  28. package/lib/oauth/outlook.js +5 -1
  29. package/lib/oauth/pubsub/google.js +3 -2
  30. package/lib/oauth/token-fetch.js +2 -3
  31. package/lib/outbox.js +338 -10
  32. package/lib/queue-browser/definitions.js +132 -0
  33. package/lib/queue-browser/format.js +387 -0
  34. package/lib/queue-browser/index.js +568 -0
  35. package/lib/queue-job-actions.js +75 -0
  36. package/lib/queue-retention.js +53 -1
  37. package/lib/routes-ui.js +5 -0
  38. package/lib/schemas.js +42 -2
  39. package/lib/security-headers.js +2 -24
  40. package/lib/sub-script.js +10 -3
  41. package/lib/token-permission-view.js +1 -1
  42. package/lib/tools.js +16 -2
  43. package/lib/ui-routes/account-routes.js +6 -0
  44. package/lib/ui-routes/imap-idle-field.js +42 -0
  45. package/lib/ui-routes/queue-routes.js +371 -0
  46. package/lib/utils/status-error.js +21 -0
  47. package/package.json +18 -20
  48. package/prepare-bundle-deps.sh +1 -1
  49. package/sbom.json +1 -1
  50. package/server.js +10 -0
  51. package/static/css/flyonui.css +1 -1
  52. package/static/css/src/app.tailwind.css +2 -0
  53. package/static/js/queues.js +117 -0
  54. package/static/licenses.html +127 -251
  55. package/translations/README.md +3 -2
  56. package/translations/messages.pot +280 -265
  57. package/views/accounts/account.hbs +31 -0
  58. package/views/accounts/edit.hbs +2 -0
  59. package/views/config/service.hbs +1 -2
  60. package/views/dashboard.hbs +2 -2
  61. package/views/partials/queue_cell_account.hbs +20 -0
  62. package/views/partials/queue_cell_failure.hbs +6 -0
  63. package/views/partials/queue_clean_items.hbs +9 -0
  64. package/views/partials/queue_clean_modal.hbs +9 -0
  65. package/views/partials/queue_entry_actions.hbs +41 -0
  66. package/views/partials/queue_job_actions.hbs +15 -0
  67. package/views/partials/queue_pause_controls.hbs +18 -0
  68. package/views/partials/queue_retention_note.hbs +49 -0
  69. package/views/partials/queue_rows_export.hbs +58 -0
  70. package/views/partials/queue_rows_notify.hbs +73 -0
  71. package/views/partials/queue_rows_submit.hbs +70 -0
  72. package/views/partials/side_menu.hbs +1 -1
  73. package/views/partials/ui/tooltip.hbs +5 -3
  74. package/views/queues/index.hbs +104 -0
  75. package/views/queues/job.hbs +224 -0
  76. package/views/queues/queue.hbs +93 -0
  77. package/views/webhooks/webhook.hbs +3 -0
  78. package/workers/api.js +0 -4
  79. package/workers/imap.js +10 -3
  80. package/workers/smtp.js +16 -1
  81. package/workers/submit.js +19 -5
  82. package/workers/webhooks.js +13 -0
  83. package/lib/api-routes/bull-board-routes.js +0 -56
@@ -72,6 +72,8 @@
72
72
  @source inline('[--placement:top] [--placement:bottom] [--placement:left] [--placement:right]');
73
73
  /* server-driven dashboard icons (lib/ui-routes/dashboard-routes.js is not scanned) */
74
74
  @source inline('icon-[tabler--mail] icon-[tabler--webhook] icon-[tabler--mail-forward] icon-[tabler--file-code] icon-[tabler--clock]');
75
+ /* queue icons named in lib/queue-browser/definitions.js and rendered through {{queue.icon}} */
76
+ @source inline('icon-[tabler--package-export]');
75
77
  /* client-side rendered delivery-test status icons (built by browser JS) */
76
78
  @source inline('icon-[tabler--circle-check] icon-[tabler--circle-off] icon-[tabler--alert-triangle]');
77
79
  /* server-driven icon classes emitted by lib/ui-routes/route-helpers.js,
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ // Client behavior for the queue browser (/admin/queues and its pages).
4
+ //
5
+ // The pages arrive as finished HTML. This file only adds what needs a browser: the counts and
6
+ // the paused badges are repainted from /admin/queues/counts every few seconds (polling, on
7
+ // purpose - a busy instance fans out thousands of queue events a minute, and none of them is
8
+ // worth pushing to a page that only shows totals), and the clean action fills in its dialog.
9
+ // Retry and send-now are plain forms, and a removal goes through the shared .list-delete-btn
10
+ // flow in ui.js, like every other list page; neither needs anything from here.
11
+
12
+ (() => {
13
+ const POLL_INTERVAL = 10 * 1000;
14
+
15
+ const countElements = () => document.querySelectorAll('[data-queue-count]');
16
+
17
+ function paintCounts(queues) {
18
+ for (const elm of countElements()) {
19
+ const [queue, state] = (elm.dataset.queueCount || '').split(':');
20
+ const status = queues[queue];
21
+ if (!status || !status.counts || typeof status.counts[state] !== 'number') {
22
+ continue;
23
+ }
24
+ const count = status.counts[state];
25
+ elm.textContent = count.toLocaleString();
26
+ // the overview tiles mute a zero and colour anything else by its state
27
+ if (elm.dataset.countVariant) {
28
+ elm.classList.toggle(`text-${elm.dataset.countVariant}`, count > 0);
29
+ elm.classList.toggle('text-base-content/40', count === 0);
30
+ }
31
+ }
32
+
33
+ // what shows only while the queue is paused, and what shows only while it runs
34
+ for (const elm of document.querySelectorAll('[data-queue-paused]')) {
35
+ const status = queues[elm.dataset.queuePaused];
36
+ if (status) {
37
+ elm.classList.toggle('hidden', !status.isPaused);
38
+ }
39
+ }
40
+ for (const elm of document.querySelectorAll('[data-queue-active-only]')) {
41
+ const status = queues[elm.dataset.queueActiveOnly];
42
+ if (status) {
43
+ elm.classList.toggle('hidden', status.isPaused);
44
+ }
45
+ }
46
+ }
47
+
48
+ let polling = false;
49
+ async function poll() {
50
+ if (document.hidden || polling || !countElements().length) {
51
+ return;
52
+ }
53
+ polling = true;
54
+ try {
55
+ const res = await fetch('/admin/queues/counts', { headers: { accept: 'application/json' }, credentials: 'same-origin' });
56
+ if (!res.ok) {
57
+ return;
58
+ }
59
+ const data = await res.json();
60
+ if (data && data.queues) {
61
+ paintCounts(data.queues);
62
+ }
63
+ } catch (err) {
64
+ // a failed poll changes nothing on the page; the next one may succeed
65
+ } finally {
66
+ polling = false;
67
+ }
68
+ }
69
+
70
+ setInterval(poll, POLL_INTERVAL);
71
+ document.addEventListener('visibilitychange', () => {
72
+ if (!document.hidden) {
73
+ poll();
74
+ }
75
+ });
76
+
77
+ // Cleaning a state: the one dialog on the page is filled in from the button that opened it
78
+ document.addEventListener('click', e => {
79
+ const btn = e.target.closest('.queue-clean-btn');
80
+ if (!btn) {
81
+ return;
82
+ }
83
+ e.preventDefault();
84
+
85
+ const modal = document.getElementById('cleanQueue');
86
+ if (!modal) {
87
+ return;
88
+ }
89
+
90
+ const form = modal.querySelector('form');
91
+ if (form) {
92
+ form.setAttribute('action', `/admin/queues/${encodeURIComponent(btn.dataset.queue)}/clean`);
93
+ }
94
+ const stateField = document.getElementById('clean-state');
95
+ if (stateField) {
96
+ stateField.value = btn.dataset.state;
97
+ }
98
+ const title = document.getElementById('clean-queue-title');
99
+ if (title) {
100
+ title.textContent = `Remove ${btn.dataset.state} ${btn.dataset.noun || 'entries'}`;
101
+ }
102
+ const stateName = modal.querySelector('.clean-state-name');
103
+ if (stateName) {
104
+ stateName.textContent = btn.dataset.state;
105
+ }
106
+ const queueName = modal.querySelector('.clean-queue-name');
107
+ if (queueName) {
108
+ queueName.textContent = btn.dataset.queueLabel || btn.dataset.queue;
109
+ }
110
+ const note = modal.querySelector('.clean-queue-note');
111
+ if (note) {
112
+ note.textContent = note.dataset[`note${btn.dataset.state.charAt(0).toUpperCase()}${btn.dataset.state.slice(1)}`] || '';
113
+ }
114
+
115
+ window.uiModal.open(modal);
116
+ });
117
+ })();