emailengine-app 2.79.6 → 2.79.8
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 +32 -0
- package/DOCKER_DEPLOYMENT.md +2 -0
- package/bin/emailengine.js +29 -13
- package/config/default.toml +13 -3
- package/data/google-crawlers.json +7 -1
- package/docker-compose.yml +12 -3
- package/install.sh +2 -0
- package/lib/api-routes/account-routes.js +14 -3
- package/lib/api-routes/mailbox-routes.js +4 -1
- package/lib/api-routes/message-routes.js +6 -5
- package/lib/api-routes/outbox-routes.js +7 -4
- package/lib/api-routes/settings-routes.js +34 -25
- package/lib/api-routes/stats-routes.js +8 -1
- package/lib/api-routes/submit-routes.js +2 -1
- package/lib/api-routes/template-routes.js +3 -2
- package/lib/bounce-detect.js +45 -0
- package/lib/consts.js +9 -3
- package/lib/egress-filter.js +39 -4
- package/lib/email-client/base-client.js +274 -24
- package/lib/email-client/gmail/gmail-api.js +15 -7
- package/lib/email-client/gmail-client.js +121 -64
- package/lib/email-client/imap/mailbox.js +18 -59
- package/lib/email-client/imap-client.js +53 -29
- package/lib/email-client/notification-handler.js +11 -2
- package/lib/email-client/outlook/graph-api.js +106 -90
- package/lib/email-client/outlook-client.js +222 -106
- package/lib/generate-text-preview.js +10 -5
- package/lib/headers-rewriter.js +1 -1
- package/lib/llm-pre-process.js +4 -1
- package/lib/mcp/json-schema.js +50 -2
- package/lib/outbox.js +22 -5
- package/lib/passkeys.js +39 -7
- package/lib/pre-process.js +4 -1
- package/lib/rewrite-text-nodes.js +12 -1
- package/lib/schemas.js +27 -5
- package/lib/settings.js +19 -1
- package/lib/sso.js +60 -7
- package/lib/submit-progress.js +29 -0
- package/lib/templates.js +11 -0
- package/lib/tools.js +115 -53
- package/lib/ui-routes/account-routes.js +79 -12
- package/lib/ui-routes/admin-config-routes.js +7 -21
- package/lib/ui-routes/admin-entities-routes.js +42 -12
- package/lib/ui-routes/auth-routes.js +242 -87
- package/lib/ui-routes/dashboard-routes.js +1 -1
- package/lib/ui-routes/internals-routes.js +2 -0
- package/lib/ui-routes/mcp-consent-routes.js +5 -2
- package/lib/ui-routes/network-config-routes.js +12 -3
- package/lib/ui-routes/oauth-config-routes.js +12 -1
- package/lib/ui-routes/route-helpers.js +41 -6
- package/lib/ui-routes/settings-page.js +10 -0
- package/lib/ui-routes/suppression-list-routes.js +16 -5
- package/lib/ui-routes/unsubscribe-routes.js +22 -3
- package/lib/webhooks.js +14 -2
- package/package.json +17 -17
- package/sbom.json +1 -1
- package/server.js +63 -35
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +55 -0
- package/static/js/app.js +4 -35
- package/static/js/passkey-register.js +50 -1
- package/static/js/public.js +128 -0
- package/static/js/ui.js +183 -6
- package/static/licenses.html +371 -770
- package/translations/messages.pot +66 -66
- package/views/account/passkeys.hbs +141 -0
- package/views/account/password.hbs +11 -0
- package/views/account/security.hbs +318 -326
- package/views/accounts/account.hbs +90 -115
- package/views/accounts/register/imap-server.hbs +18 -12
- package/views/config/ai.hbs +2 -0
- package/views/config/branding.hbs +2 -0
- package/views/config/document-store/index.hbs +6 -6
- package/views/config/email-processing.hbs +2 -0
- package/views/config/imap-proxy.hbs +2 -0
- package/views/config/license.hbs +4 -1
- package/views/config/logging.hbs +3 -1
- package/views/config/mcp.hbs +2 -0
- package/views/config/network.hbs +2 -0
- package/views/config/oauth/app.hbs +3 -3
- package/views/config/oauth/edit.hbs +1 -1
- package/views/config/oauth/new.hbs +1 -1
- package/views/config/security.hbs +2 -0
- package/views/config/service.hbs +2 -0
- package/views/config/smtp.hbs +2 -0
- package/views/config/webhooks.hbs +9 -6
- package/views/error.hbs +6 -0
- package/views/layout/app.hbs +6 -3
- package/views/layout/login.hbs +1 -1
- package/views/layout/prompt.hbs +1 -1
- package/views/layout/public.hbs +1 -1
- package/views/legal.hbs +1 -1
- package/views/partials/filter_editor_js.hbs +1 -1
- package/views/partials/gateway_js.hbs +7 -6
- package/views/partials/oauth_form.hbs +5 -5
- package/views/partials/ui/btn.hbs +8 -2
- package/views/partials/ui/confirm-modal.hbs +2 -3
- package/views/partials/ui/empty-state.hbs +25 -0
- package/views/partials/ui/env-managed-alert.hbs +19 -0
- package/views/partials/webhook_form.hbs +1 -1
- package/views/partials/webhooks_editor_functions.hbs +5 -5
- package/views/unsubscribe.hbs +6 -0
- package/workers/api.js +193 -81
- package/workers/imap.js +32 -3
- package/workers/smtp.js +7 -0
- package/workers/submit.js +25 -1
- package/workers/webhooks.js +13 -17
- package/lib/reconnection-manager.js +0 -106
package/server.js
CHANGED
|
@@ -3175,6 +3175,44 @@ process.on('SIGINT', () => {
|
|
|
3175
3175
|
|
|
3176
3176
|
// START APPLICATION
|
|
3177
3177
|
|
|
3178
|
+
/**
|
|
3179
|
+
* Waits for a fleet of spawned workers and tolerates a partial start: proceeds as long as at
|
|
3180
|
+
* least one worker reached 'ready' (the spawnWorker exit handler respawns any that failed;
|
|
3181
|
+
* letting such a rejection abort startup would exit the process while the respawn is pending).
|
|
3182
|
+
* Only a fleet that failed entirely is fatal - the thrown error rejects startApplication(), which
|
|
3183
|
+
* logs fatal and exits the process, preserving the original single-worker "no worker => exit"
|
|
3184
|
+
* behavior.
|
|
3185
|
+
*
|
|
3186
|
+
* @param {string} label - Worker type as it appears in the log lines ('API', 'IMAP')
|
|
3187
|
+
* @param {Promise[]} promises - spawnWorker() promises of the fleet
|
|
3188
|
+
* @param {Object} logFields - extra fields for the partial-failure log line (requested count etc.)
|
|
3189
|
+
* @returns {Promise<Array>} Thread IDs of the workers that reached 'ready'
|
|
3190
|
+
*/
|
|
3191
|
+
const settleWorkerFleet = async (label, promises, logFields) => {
|
|
3192
|
+
let results = await Promise.allSettled(promises);
|
|
3193
|
+
let threadIds = results.filter(result => result.status === 'fulfilled').map(result => result.value);
|
|
3194
|
+
let failed = results.length - threadIds.length;
|
|
3195
|
+
if (failed) {
|
|
3196
|
+
logger.error(
|
|
3197
|
+
Object.assign({ msg: `Some ${label} workers failed to start; they will be respawned` }, logFields, {
|
|
3198
|
+
ready: threadIds.length,
|
|
3199
|
+
failed,
|
|
3200
|
+
errors: results
|
|
3201
|
+
.filter(result => result.status === 'rejected')
|
|
3202
|
+
.map(result => ({
|
|
3203
|
+
message: result.reason && result.reason.message,
|
|
3204
|
+
exitCode: result.reason && result.reason.exitCode,
|
|
3205
|
+
threadId: result.reason && result.reason.threadId
|
|
3206
|
+
}))
|
|
3207
|
+
})
|
|
3208
|
+
);
|
|
3209
|
+
}
|
|
3210
|
+
if (results.length && !threadIds.length) {
|
|
3211
|
+
throw new Error(`No ${label} worker thread could be started`);
|
|
3212
|
+
}
|
|
3213
|
+
return threadIds;
|
|
3214
|
+
};
|
|
3215
|
+
|
|
3178
3216
|
/**
|
|
3179
3217
|
* Main application startup
|
|
3180
3218
|
* @returns {Promise<void>}
|
|
@@ -3271,6 +3309,13 @@ const startApplication = async () => {
|
|
|
3271
3309
|
for (let key of Object.keys(preparedSettings)) {
|
|
3272
3310
|
await settings.set(key, preparedSettings[key]);
|
|
3273
3311
|
}
|
|
3312
|
+
|
|
3313
|
+
// These keys are re-applied on every boot, so a value saved for one of them in the admin
|
|
3314
|
+
// UI reverts at the next restart. The list is recorded for the settings pages
|
|
3315
|
+
// (lib/ui-routes/settings-page.js) to flag those fields as managed by EENGINE_SETTINGS
|
|
3316
|
+
await settings.set('preparedSettingsKeys', Object.keys(preparedSettings));
|
|
3317
|
+
} else {
|
|
3318
|
+
await settings.clear('preparedSettingsKeys');
|
|
3274
3319
|
}
|
|
3275
3320
|
|
|
3276
3321
|
// Initialize required settings
|
|
@@ -3403,13 +3448,20 @@ const startApplication = async () => {
|
|
|
3403
3448
|
try {
|
|
3404
3449
|
let authData = await settings.get('authData');
|
|
3405
3450
|
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
authData.
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3451
|
+
// Written only when the stored hash differs: passwordVersion is what every admin
|
|
3452
|
+
// session and message-browser token is checked against, so rewriting the same hash
|
|
3453
|
+
// on each boot would log every operator out at every restart
|
|
3454
|
+
if (!authData || authData.password !== preparedPassword) {
|
|
3455
|
+
authData = authData || {};
|
|
3456
|
+
authData.user = authData.user || 'admin';
|
|
3457
|
+
authData.password = preparedPassword;
|
|
3458
|
+
authData.passwordVersion = Date.now();
|
|
3459
|
+
|
|
3460
|
+
await settings.set('authData', authData);
|
|
3461
|
+
logger.debug({ msg: 'Password imported' });
|
|
3462
|
+
} else {
|
|
3463
|
+
logger.debug({ msg: 'Password already imported' });
|
|
3464
|
+
}
|
|
3413
3465
|
} catch (err) {
|
|
3414
3466
|
logger.error({ msg: 'Password import failed', err });
|
|
3415
3467
|
}
|
|
@@ -3481,33 +3533,8 @@ const startApplication = async () => {
|
|
|
3481
3533
|
apiPromises.push(spawnWorker('api', workerSpawnOpts('api', i)));
|
|
3482
3534
|
}
|
|
3483
3535
|
|
|
3484
|
-
//
|
|
3485
|
-
|
|
3486
|
-
// worker failed, preserving the original single-worker "no API worker => exit" behavior.
|
|
3487
|
-
let apiResults = await Promise.allSettled(apiPromises);
|
|
3488
|
-
let apiReady = apiResults.filter(result => result.status === 'fulfilled').length;
|
|
3489
|
-
let apiFailed = apiResults.length - apiReady;
|
|
3490
|
-
if (apiFailed) {
|
|
3491
|
-
logger.error({
|
|
3492
|
-
msg: 'Some API workers failed to start; they will be respawned',
|
|
3493
|
-
requested: apiWorkersRequested,
|
|
3494
|
-
attempted: apiResults.length,
|
|
3495
|
-
ready: apiReady,
|
|
3496
|
-
failed: apiFailed,
|
|
3497
|
-
errors: apiResults
|
|
3498
|
-
.filter(result => result.status === 'rejected')
|
|
3499
|
-
.map(result => ({
|
|
3500
|
-
message: result.reason && result.reason.message,
|
|
3501
|
-
exitCode: result.reason && result.reason.exitCode,
|
|
3502
|
-
threadId: result.reason && result.reason.threadId
|
|
3503
|
-
}))
|
|
3504
|
-
});
|
|
3505
|
-
}
|
|
3506
|
-
if (!apiReady) {
|
|
3507
|
-
// No API worker came up at all - fatal, same as the original single-worker behavior. This
|
|
3508
|
-
// rejects startApplication(), which logs fatal and exits the process.
|
|
3509
|
-
throw new Error('No API worker thread could be started');
|
|
3510
|
-
}
|
|
3536
|
+
// `attempted` can be below `requested` after the SO_REUSEPORT fallback above
|
|
3537
|
+
let apiReady = (await settleWorkerFleet('API', apiPromises, { requested: apiWorkersRequested, attempted: apiPromises.length })).length;
|
|
3511
3538
|
logger.info({ msg: 'API workers started', requested: apiWorkersRequested, ready: apiReady });
|
|
3512
3539
|
|
|
3513
3540
|
// Small delay to allow API to start
|
|
@@ -3518,7 +3545,8 @@ const startApplication = async () => {
|
|
|
3518
3545
|
for (let i = 0; i < config.workers.imap; i++) {
|
|
3519
3546
|
workerPromises.push(spawnWorker('imap'));
|
|
3520
3547
|
}
|
|
3521
|
-
|
|
3548
|
+
|
|
3549
|
+
let threadIds = await settleWorkerFleet('IMAP', workerPromises, { requested: config.workers.imap });
|
|
3522
3550
|
logger.info({ msg: 'IMAP workers started', workers: config.workers.imap, threadIds });
|
|
3523
3551
|
|
|
3524
3552
|
// Mark that initial workers are loaded BEFORE assignment
|