emailengine-app 2.83.2 → 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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/SECURITY.md +126 -47
- package/data/google-crawlers.json +1 -1
- package/lib/api-routes/outbox-routes.js +132 -9
- package/lib/api-routes/permission-map.js +11 -1
- package/lib/consts.js +0 -4
- package/lib/email-client/imap/idle-settings.js +44 -0
- package/lib/email-client/imap/mailbox.js +19 -7
- package/lib/email-client/imap-client.js +3 -21
- package/lib/enum-descriptions.js +7 -0
- package/lib/export.js +2 -6
- package/lib/field-usage.js +4 -0
- package/lib/handlebars-helpers.js +4 -0
- package/lib/outbox.js +338 -10
- package/lib/queue-browser/definitions.js +132 -0
- package/lib/queue-browser/format.js +387 -0
- package/lib/queue-browser/index.js +568 -0
- package/lib/queue-job-actions.js +75 -0
- package/lib/queue-retention.js +53 -1
- package/lib/routes-ui.js +5 -0
- package/lib/schemas.js +42 -2
- package/lib/security-headers.js +2 -24
- package/lib/token-permission-view.js +1 -1
- package/lib/ui-routes/account-routes.js +6 -0
- package/lib/ui-routes/imap-idle-field.js +42 -0
- package/lib/ui-routes/queue-routes.js +371 -0
- package/lib/utils/status-error.js +21 -0
- package/package.json +15 -17
- package/prepare-bundle-deps.sh +1 -1
- package/sbom.json +1 -1
- package/server.js +10 -0
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +2 -0
- package/static/js/queues.js +117 -0
- package/static/licenses.html +122 -246
- package/translations/messages.pot +57 -42
- package/views/accounts/account.hbs +31 -0
- package/views/accounts/edit.hbs +2 -0
- package/views/config/service.hbs +1 -2
- package/views/dashboard.hbs +2 -2
- package/views/partials/queue_cell_account.hbs +20 -0
- package/views/partials/queue_cell_failure.hbs +6 -0
- package/views/partials/queue_clean_items.hbs +9 -0
- package/views/partials/queue_clean_modal.hbs +9 -0
- package/views/partials/queue_entry_actions.hbs +41 -0
- package/views/partials/queue_job_actions.hbs +15 -0
- package/views/partials/queue_pause_controls.hbs +18 -0
- package/views/partials/queue_retention_note.hbs +49 -0
- package/views/partials/queue_rows_export.hbs +58 -0
- package/views/partials/queue_rows_notify.hbs +73 -0
- package/views/partials/queue_rows_submit.hbs +70 -0
- package/views/partials/side_menu.hbs +1 -1
- package/views/partials/ui/tooltip.hbs +5 -3
- package/views/queues/index.hbs +104 -0
- package/views/queues/job.hbs +224 -0
- package/views/queues/queue.hbs +93 -0
- package/views/webhooks/webhook.hbs +3 -0
- package/workers/api.js +0 -4
- package/workers/submit.js +19 -5
- package/workers/webhooks.js +13 -0
- 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
|
+
})();
|