emailengine-app 2.84.2 → 2.86.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/.ncurc.js +29 -9
- package/.prettierignore +5 -1
- package/.prettierrc.js +2 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +107 -0
- package/Dockerfile +20 -1
- package/ENVIRONMENT.md +139 -0
- package/README.md +2 -2
- package/bin/emailengine.js +434 -408
- package/config/default.toml +2 -0
- package/copy-static-files.sh +41 -14
- package/data/google-crawlers.json +1 -1
- package/data/public_suffix_list.dat +16563 -0
- package/eslint.config.js +81 -99
- package/lib/account-assignment.js +19 -0
- package/lib/account.js +230 -170
- package/lib/api-error-codes.js +49 -0
- package/lib/api-reference/format.js +4 -3
- package/lib/api-reference/model.js +6 -1
- package/lib/api-routes/account-routes.js +255 -38
- package/lib/api-routes/blocklist-routes.js +91 -4
- package/lib/api-routes/delivery-test-routes.js +27 -4
- package/lib/api-routes/export-routes.js +28 -2
- package/lib/api-routes/gateway-routes.js +110 -12
- package/lib/api-routes/index.js +4 -0
- package/lib/api-routes/license-routes.js +2 -2
- package/lib/api-routes/mailbox-routes.js +44 -5
- package/lib/api-routes/message-routes.js +112 -10
- package/lib/api-routes/oauth2-app-routes.js +63 -23
- package/lib/api-routes/outbox-routes.js +97 -52
- package/lib/api-routes/permission-map.js +67 -7
- package/lib/api-routes/scoped-routes.js +74 -0
- package/lib/api-routes/settings-routes.js +34 -6
- package/lib/api-routes/stats-routes.js +5 -1
- package/lib/api-routes/submit-routes.js +337 -309
- package/lib/api-routes/template-routes.js +45 -8
- package/lib/api-routes/token-routes.js +152 -100
- package/lib/api-routes/webhook-delivery-routes.js +262 -0
- package/lib/api-routes/webhook-route-routes.js +132 -6
- package/lib/bounce-detect.js +397 -205
- package/lib/calendar-event.js +81 -1
- package/lib/consts.js +38 -45
- package/lib/db.js +14 -6
- package/lib/delivery-error.js +6 -0
- package/lib/deprecations.js +270 -0
- package/lib/email-client/base-client.js +137 -184
- package/lib/email-client/fallback-poll.js +62 -0
- package/lib/email-client/gmail-client.js +60 -22
- package/lib/email-client/imap/adaptive-idle-store.js +73 -0
- package/lib/email-client/imap/adaptive-idle.js +278 -0
- package/lib/email-client/imap/connection-errors.js +14 -1
- package/lib/email-client/imap/idle-settings.js +31 -5
- package/lib/email-client/imap/listing-diff.js +37 -0
- package/lib/email-client/imap/mailbox.js +372 -242
- package/lib/email-client/imap/subconnection.js +8 -30
- package/lib/email-client/imap/sync-operations.js +220 -127
- package/lib/email-client/imap-client.js +228 -164
- package/lib/email-client/message-builder.js +14 -79
- package/lib/email-client/notification-handler.js +1 -2
- package/lib/email-client/outlook-client.js +372 -338
- package/lib/email-client/smtp-pool-manager.js +16 -13
- package/lib/email-client/sync-state-fields.js +19 -0
- package/lib/encrypt.js +157 -41
- package/lib/enum-descriptions.js +3 -1
- package/lib/env-setting-overrides.js +288 -0
- package/lib/export-worker.js +751 -0
- package/lib/export.js +64 -15
- package/lib/gateway.js +19 -4
- package/lib/get-raw-email.js +25 -107
- package/lib/hapi-request-logger.js +107 -0
- package/lib/health.js +75 -0
- package/lib/imapproxy/imap-core/README.md +6 -5
- package/lib/lock-run.js +119 -0
- package/lib/logger-consts.js +48 -0
- package/lib/logger.js +1 -1
- package/lib/lua/z-head-scores.lua +28 -0
- package/lib/mcp/tools.js +37 -8
- package/lib/network-errors.js +1 -1
- package/lib/node-version.js +24 -0
- package/lib/notify-attachments.js +36 -0
- package/lib/oauth/outlook-mailbox.js +35 -0
- package/lib/oauth/state.js +24 -0
- package/lib/oauth2-apps.js +631 -656
- package/lib/outbox.js +184 -54
- package/lib/parse-message.js +3 -3
- package/lib/pbkdf2-phc.js +1 -1
- package/lib/privileged-settings.js +2 -2
- package/lib/queue-browser/definitions.js +11 -0
- package/lib/queue-browser/index.js +68 -19
- package/lib/queue-job-actions.js +18 -1
- package/lib/queue-retention.js +48 -12
- package/lib/queue-stats.js +11 -2
- package/lib/read-env-value.js +3 -0
- package/lib/redis-memory-warnings.js +99 -0
- package/lib/redis-reconnect.js +29 -0
- package/lib/request-timing.js +23 -0
- package/lib/respawn-backoff.js +35 -0
- package/lib/rewrite-text-nodes.js +19 -59
- package/lib/schemas.js +164 -40
- package/lib/settings.js +6 -2
- package/lib/smtp-auth.js +19 -1
- package/lib/sso.js +1 -1
- package/lib/swagger-options.js +1 -1
- package/lib/thread-diagnostics.js +63 -0
- package/lib/timezones.js +109 -0
- package/lib/tls/provision.js +6 -3
- package/lib/token-audit-log.js +19 -20
- package/lib/token-permission-view.js +7 -6
- package/lib/tools.js +48 -51
- package/lib/totp.js +2 -5
- package/lib/translations.js +1 -2
- package/lib/ui-routes/account-routes.js +475 -454
- package/lib/ui-routes/account-setup.js +99 -0
- package/lib/ui-routes/admin-config-routes.js +152 -100
- package/lib/ui-routes/admin-entities-routes.js +93 -21
- package/lib/ui-routes/auth-routes.js +90 -38
- package/lib/ui-routes/imap-idle-field.js +1 -1
- package/lib/ui-routes/internals-routes.js +5 -0
- package/lib/ui-routes/oauth-config-routes.js +124 -82
- package/lib/ui-routes/outlook-subscription-view.js +1 -1
- package/lib/ui-routes/overridable-fields.js +84 -0
- package/lib/ui-routes/queue-routes.js +8 -5
- package/lib/ui-routes/route-helpers.js +19 -3
- package/lib/ui-routes/settings-page.js +6 -0
- package/lib/ui-routes/tls-config-routes.js +58 -15
- package/lib/utils/back-off.js +82 -0
- package/lib/utils/decode-headers.js +3 -12
- package/lib/utils/filter-empty.js +20 -0
- package/lib/utils/int-setting.js +48 -0
- package/lib/utils/murmurhash3.js +66 -0
- package/lib/utils/public-suffix.js +122 -0
- package/lib/utils/random-id.js +26 -0
- package/lib/utils/tracking-settings.js +35 -0
- package/lib/utils/version.js +74 -0
- package/lib/web-safe-html.js +18 -105
- package/lib/webhook-delivery.js +461 -0
- package/lib/webhook-failures.js +132 -0
- package/lib/webhook-request.js +29 -1
- package/lib/webhook-routing.js +56 -0
- package/lib/webhook-test.js +88 -0
- package/lib/webhooks.js +93 -45
- package/lib/worker-rpc-error.js +2 -1
- package/package.json +37 -38
- package/sbom.json +7902 -1
- package/server.js +784 -518
- package/static/js/ace/ace.js +1 -1
- package/static/licenses.html +225 -1060
- package/translations/messages.pot +62 -63
- package/views/config/ai.hbs +1 -1
- package/views/config/security.hbs +24 -2
- package/views/config/service.hbs +47 -0
- package/views/config/webhooks.hbs +36 -0
- package/views/internals/index.hbs +8 -0
- package/views/partials/queue_retention_note.hbs +12 -8
- package/views/partials/ui/env-managed-alert.hbs +16 -7
- package/views/partials/webhook_form.hbs +1 -1
- package/views/suppression-lists/index.hbs +1 -1
- package/workers/api.js +840 -611
- package/workers/export.js +17 -632
- package/workers/imap.js +13 -0
- package/workers/smtp.js +9 -11
- package/workers/submit.js +1 -1
- package/workers/webhooks.js +18 -448
- package/lib/email-client/outlook-fallback-poll.js +0 -30
|
@@ -14,7 +14,7 @@ const tokenPermissionView = require('../token-permission-view');
|
|
|
14
14
|
const { PRIVILEGED_SETTINGS_SUMMARY } = require('../privileged-settings');
|
|
15
15
|
const { Account, accountExists, accountSummary } = require('../account');
|
|
16
16
|
const { isMcpEnabled } = require('../mcp');
|
|
17
|
-
const { Gateway } = require('../gateway');
|
|
17
|
+
const { Gateway, gatewaySmtpConfig } = require('../gateway');
|
|
18
18
|
const { templates } = require('../templates');
|
|
19
19
|
const { webhooks } = require('../webhooks');
|
|
20
20
|
const consts = require('../consts');
|
|
@@ -92,11 +92,9 @@ async function getExampleWebhookPayloads() {
|
|
|
92
92
|
return examplePayloads;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
const { server, call } = args;
|
|
97
|
-
|
|
98
|
-
// Webhook routes
|
|
95
|
+
// Webhook routes
|
|
99
96
|
|
|
97
|
+
function registerGetWebhooks(server) {
|
|
100
98
|
server.route({
|
|
101
99
|
method: 'GET',
|
|
102
100
|
path: '/admin/webhooks',
|
|
@@ -183,7 +181,9 @@ function init(args) {
|
|
|
183
181
|
}
|
|
184
182
|
}
|
|
185
183
|
});
|
|
184
|
+
}
|
|
186
185
|
|
|
186
|
+
function registerGetWebhooksNew(server) {
|
|
187
187
|
server.route({
|
|
188
188
|
method: 'GET',
|
|
189
189
|
path: '/admin/webhooks/new',
|
|
@@ -241,7 +241,9 @@ return payload;`)
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
|
+
}
|
|
244
245
|
|
|
246
|
+
function registerPostWebhooksNew(server) {
|
|
245
247
|
server.route({
|
|
246
248
|
method: 'POST',
|
|
247
249
|
path: '/admin/webhooks/new',
|
|
@@ -372,7 +374,9 @@ return payload;`)
|
|
|
372
374
|
}
|
|
373
375
|
}
|
|
374
376
|
});
|
|
377
|
+
}
|
|
375
378
|
|
|
379
|
+
function registerGetWebhooksWebhook(server) {
|
|
376
380
|
server.route({
|
|
377
381
|
method: 'GET',
|
|
378
382
|
path: '/admin/webhooks/webhook/{webhook}',
|
|
@@ -435,7 +439,9 @@ return payload;`)
|
|
|
435
439
|
}
|
|
436
440
|
}
|
|
437
441
|
});
|
|
442
|
+
}
|
|
438
443
|
|
|
444
|
+
function registerGetWebhooksWebhookEdit(server) {
|
|
439
445
|
server.route({
|
|
440
446
|
method: 'GET',
|
|
441
447
|
path: '/admin/webhooks/webhook/{webhook}/edit',
|
|
@@ -504,7 +510,9 @@ return payload;`)
|
|
|
504
510
|
}
|
|
505
511
|
}
|
|
506
512
|
});
|
|
513
|
+
}
|
|
507
514
|
|
|
515
|
+
function registerPostWebhooksEdit(server) {
|
|
508
516
|
server.route({
|
|
509
517
|
method: 'POST',
|
|
510
518
|
path: '/admin/webhooks/edit',
|
|
@@ -661,7 +669,9 @@ return payload;`)
|
|
|
661
669
|
}
|
|
662
670
|
}
|
|
663
671
|
});
|
|
672
|
+
}
|
|
664
673
|
|
|
674
|
+
function registerPostWebhooksDelete(server) {
|
|
665
675
|
server.route({
|
|
666
676
|
method: 'POST',
|
|
667
677
|
path: '/admin/webhooks/delete',
|
|
@@ -706,9 +716,11 @@ return payload;`)
|
|
|
706
716
|
}
|
|
707
717
|
}
|
|
708
718
|
});
|
|
719
|
+
}
|
|
709
720
|
|
|
710
|
-
|
|
721
|
+
// Template routes
|
|
711
722
|
|
|
723
|
+
function registerGetTemplates(server) {
|
|
712
724
|
server.route({
|
|
713
725
|
method: 'GET',
|
|
714
726
|
path: '/admin/templates',
|
|
@@ -805,7 +817,9 @@ return payload;`)
|
|
|
805
817
|
}
|
|
806
818
|
}
|
|
807
819
|
});
|
|
820
|
+
}
|
|
808
821
|
|
|
822
|
+
function registerGetTemplatesTemplate(server) {
|
|
809
823
|
server.route({
|
|
810
824
|
method: 'GET',
|
|
811
825
|
path: '/admin/templates/template/{template}',
|
|
@@ -866,7 +880,9 @@ return payload;`)
|
|
|
866
880
|
}
|
|
867
881
|
}
|
|
868
882
|
});
|
|
883
|
+
}
|
|
869
884
|
|
|
885
|
+
function registerGetTemplatesTemplateEdit(server) {
|
|
870
886
|
server.route({
|
|
871
887
|
method: 'GET',
|
|
872
888
|
path: '/admin/templates/template/{template}/edit',
|
|
@@ -941,7 +957,9 @@ return payload;`)
|
|
|
941
957
|
}
|
|
942
958
|
}
|
|
943
959
|
});
|
|
960
|
+
}
|
|
944
961
|
|
|
962
|
+
function registerPostTemplatesEdit(server) {
|
|
945
963
|
server.route({
|
|
946
964
|
method: 'POST',
|
|
947
965
|
path: '/admin/templates/edit',
|
|
@@ -1094,7 +1112,9 @@ return payload;`)
|
|
|
1094
1112
|
}
|
|
1095
1113
|
}
|
|
1096
1114
|
});
|
|
1115
|
+
}
|
|
1097
1116
|
|
|
1117
|
+
function registerGetTemplatesNew(server) {
|
|
1098
1118
|
server.route({
|
|
1099
1119
|
method: 'GET',
|
|
1100
1120
|
path: '/admin/templates/new',
|
|
@@ -1158,7 +1178,9 @@ return payload;`)
|
|
|
1158
1178
|
}
|
|
1159
1179
|
}
|
|
1160
1180
|
});
|
|
1181
|
+
}
|
|
1161
1182
|
|
|
1183
|
+
function registerPostTemplatesNew(server) {
|
|
1162
1184
|
server.route({
|
|
1163
1185
|
method: 'POST',
|
|
1164
1186
|
path: '/admin/templates/new',
|
|
@@ -1298,7 +1320,9 @@ return payload;`)
|
|
|
1298
1320
|
}
|
|
1299
1321
|
}
|
|
1300
1322
|
});
|
|
1323
|
+
}
|
|
1301
1324
|
|
|
1325
|
+
function registerPostTemplatesDelete(server) {
|
|
1302
1326
|
server.route({
|
|
1303
1327
|
method: 'POST',
|
|
1304
1328
|
path: '/admin/templates/delete',
|
|
@@ -1346,6 +1370,10 @@ return payload;`)
|
|
|
1346
1370
|
}
|
|
1347
1371
|
}
|
|
1348
1372
|
});
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
function registerPostTemplatesTest(server, args) {
|
|
1376
|
+
const { call } = args;
|
|
1349
1377
|
|
|
1350
1378
|
server.route({
|
|
1351
1379
|
method: 'POST',
|
|
@@ -1438,9 +1466,11 @@ return payload;`)
|
|
|
1438
1466
|
}
|
|
1439
1467
|
}
|
|
1440
1468
|
});
|
|
1469
|
+
}
|
|
1441
1470
|
|
|
1442
|
-
|
|
1471
|
+
// Gateway routes
|
|
1443
1472
|
|
|
1473
|
+
function registerGetGateways(server) {
|
|
1444
1474
|
server.route({
|
|
1445
1475
|
method: 'GET',
|
|
1446
1476
|
path: '/admin/gateways',
|
|
@@ -1542,7 +1572,9 @@ return payload;`)
|
|
|
1542
1572
|
}
|
|
1543
1573
|
}
|
|
1544
1574
|
});
|
|
1575
|
+
}
|
|
1545
1576
|
|
|
1577
|
+
function registerGetGatewaysNew(server) {
|
|
1546
1578
|
server.route({
|
|
1547
1579
|
method: 'GET',
|
|
1548
1580
|
path: '/admin/gateways/new',
|
|
@@ -1562,7 +1594,9 @@ return payload;`)
|
|
|
1562
1594
|
);
|
|
1563
1595
|
}
|
|
1564
1596
|
});
|
|
1597
|
+
}
|
|
1565
1598
|
|
|
1599
|
+
function registerGetGatewaysGateway(server) {
|
|
1566
1600
|
server.route({
|
|
1567
1601
|
method: 'GET',
|
|
1568
1602
|
path: '/admin/gateways/gateway/{gateway}',
|
|
@@ -1618,7 +1652,9 @@ return payload;`)
|
|
|
1618
1652
|
}
|
|
1619
1653
|
}
|
|
1620
1654
|
});
|
|
1655
|
+
}
|
|
1621
1656
|
|
|
1657
|
+
function registerGetGatewaysEdit(server) {
|
|
1622
1658
|
server.route({
|
|
1623
1659
|
method: 'GET',
|
|
1624
1660
|
path: '/admin/gateways/edit/{gateway}',
|
|
@@ -1665,7 +1701,9 @@ return payload;`)
|
|
|
1665
1701
|
}
|
|
1666
1702
|
}
|
|
1667
1703
|
});
|
|
1704
|
+
}
|
|
1668
1705
|
|
|
1706
|
+
function registerPostGatewaysNew(server) {
|
|
1669
1707
|
server.route({
|
|
1670
1708
|
method: 'POST',
|
|
1671
1709
|
path: '/admin/gateways/new',
|
|
@@ -1778,7 +1816,9 @@ return payload;`)
|
|
|
1778
1816
|
}
|
|
1779
1817
|
}
|
|
1780
1818
|
});
|
|
1819
|
+
}
|
|
1781
1820
|
|
|
1821
|
+
function registerPostGatewaysEdit(server) {
|
|
1782
1822
|
server.route({
|
|
1783
1823
|
method: 'POST',
|
|
1784
1824
|
path: '/admin/gateways/edit',
|
|
@@ -1906,7 +1946,9 @@ return payload;`)
|
|
|
1906
1946
|
}
|
|
1907
1947
|
}
|
|
1908
1948
|
});
|
|
1949
|
+
}
|
|
1909
1950
|
|
|
1951
|
+
function registerPostGatewaysTest(server) {
|
|
1910
1952
|
server.route({
|
|
1911
1953
|
method: 'POST',
|
|
1912
1954
|
path: '/admin/gateways/test',
|
|
@@ -1930,19 +1972,7 @@ return payload;`)
|
|
|
1930
1972
|
}
|
|
1931
1973
|
|
|
1932
1974
|
let accountData = {
|
|
1933
|
-
smtp: {
|
|
1934
|
-
host,
|
|
1935
|
-
port,
|
|
1936
|
-
secure,
|
|
1937
|
-
requireTLS,
|
|
1938
|
-
auth:
|
|
1939
|
-
user || pass
|
|
1940
|
-
? {
|
|
1941
|
-
user,
|
|
1942
|
-
pass: pass || ''
|
|
1943
|
-
}
|
|
1944
|
-
: false
|
|
1945
|
-
}
|
|
1975
|
+
smtp: gatewaySmtpConfig({ host, port, secure, requireTLS, user, pass })
|
|
1946
1976
|
};
|
|
1947
1977
|
|
|
1948
1978
|
let verifyResult = await verifyAccountInfo(redis, accountData, request.logger.child({ gateway, action: 'verify-gateway' }));
|
|
@@ -2021,7 +2051,9 @@ return payload;`)
|
|
|
2021
2051
|
}
|
|
2022
2052
|
}
|
|
2023
2053
|
});
|
|
2054
|
+
}
|
|
2024
2055
|
|
|
2056
|
+
function registerPostGatewaysDelete(server) {
|
|
2025
2057
|
server.route({
|
|
2026
2058
|
method: 'POST',
|
|
2027
2059
|
path: '/admin/gateways/delete/{gateway}',
|
|
@@ -2071,9 +2103,11 @@ return payload;`)
|
|
|
2071
2103
|
}
|
|
2072
2104
|
}
|
|
2073
2105
|
});
|
|
2106
|
+
}
|
|
2074
2107
|
|
|
2075
|
-
|
|
2108
|
+
// Token routes
|
|
2076
2109
|
|
|
2110
|
+
function registerGetTokens(server) {
|
|
2077
2111
|
server.route({
|
|
2078
2112
|
method: 'GET',
|
|
2079
2113
|
path: '/admin/tokens',
|
|
@@ -2246,7 +2280,9 @@ return payload;`)
|
|
|
2246
2280
|
}
|
|
2247
2281
|
}
|
|
2248
2282
|
});
|
|
2283
|
+
}
|
|
2249
2284
|
|
|
2285
|
+
function registerGetTokensNew(server) {
|
|
2250
2286
|
server.route({
|
|
2251
2287
|
method: 'GET',
|
|
2252
2288
|
path: '/admin/tokens/new',
|
|
@@ -2332,7 +2368,9 @@ return payload;`)
|
|
|
2332
2368
|
}
|
|
2333
2369
|
}
|
|
2334
2370
|
});
|
|
2371
|
+
}
|
|
2335
2372
|
|
|
2373
|
+
function registerPostTokensNew(server) {
|
|
2336
2374
|
server.route({
|
|
2337
2375
|
method: 'POST',
|
|
2338
2376
|
path: '/admin/tokens/new',
|
|
@@ -2419,7 +2457,9 @@ return payload;`)
|
|
|
2419
2457
|
}
|
|
2420
2458
|
}
|
|
2421
2459
|
});
|
|
2460
|
+
}
|
|
2422
2461
|
|
|
2462
|
+
function registerPostTokensDelete(server) {
|
|
2423
2463
|
server.route({
|
|
2424
2464
|
method: 'POST',
|
|
2425
2465
|
path: '/admin/tokens/delete',
|
|
@@ -2474,6 +2514,38 @@ return payload;`)
|
|
|
2474
2514
|
});
|
|
2475
2515
|
}
|
|
2476
2516
|
|
|
2517
|
+
function init(args) {
|
|
2518
|
+
const { server } = args;
|
|
2519
|
+
|
|
2520
|
+
registerGetWebhooks(server);
|
|
2521
|
+
registerGetWebhooksNew(server);
|
|
2522
|
+
registerPostWebhooksNew(server);
|
|
2523
|
+
registerGetWebhooksWebhook(server);
|
|
2524
|
+
registerGetWebhooksWebhookEdit(server);
|
|
2525
|
+
registerPostWebhooksEdit(server);
|
|
2526
|
+
registerPostWebhooksDelete(server);
|
|
2527
|
+
registerGetTemplates(server);
|
|
2528
|
+
registerGetTemplatesTemplate(server);
|
|
2529
|
+
registerGetTemplatesTemplateEdit(server);
|
|
2530
|
+
registerPostTemplatesEdit(server);
|
|
2531
|
+
registerGetTemplatesNew(server);
|
|
2532
|
+
registerPostTemplatesNew(server);
|
|
2533
|
+
registerPostTemplatesDelete(server);
|
|
2534
|
+
registerPostTemplatesTest(server, args);
|
|
2535
|
+
registerGetGateways(server);
|
|
2536
|
+
registerGetGatewaysNew(server);
|
|
2537
|
+
registerGetGatewaysGateway(server);
|
|
2538
|
+
registerGetGatewaysEdit(server);
|
|
2539
|
+
registerPostGatewaysNew(server);
|
|
2540
|
+
registerPostGatewaysEdit(server);
|
|
2541
|
+
registerPostGatewaysTest(server);
|
|
2542
|
+
registerPostGatewaysDelete(server);
|
|
2543
|
+
registerGetTokens(server);
|
|
2544
|
+
registerGetTokensNew(server);
|
|
2545
|
+
registerPostTokensNew(server);
|
|
2546
|
+
registerPostTokensDelete(server);
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2477
2549
|
// The account a template belongs to, for the template pages. A template can outlive its account
|
|
2478
2550
|
// (deleted since, or stored before the create form checked the ID), and a missing account is
|
|
2479
2551
|
// then rendered as no account rather than turning the template itself into a 404 nobody can
|
|
@@ -190,9 +190,32 @@ async function listPasskeysForView(username) {
|
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
// --- Passkey (WebAuthn) routes ---
|
|
194
|
+
|
|
195
|
+
const passkeyCredentialSchema = Joi.object({
|
|
196
|
+
id: Joi.string()
|
|
197
|
+
.max(512)
|
|
198
|
+
.pattern(/^[A-Za-z0-9_-]+$/)
|
|
199
|
+
.required(),
|
|
200
|
+
rawId: Joi.string()
|
|
201
|
+
.max(512)
|
|
202
|
+
.pattern(/^[A-Za-z0-9_-]+$/)
|
|
203
|
+
.required(),
|
|
204
|
+
response: Joi.object({
|
|
205
|
+
clientDataJSON: Joi.string().max(16384).required(),
|
|
206
|
+
attestationObject: Joi.string().max(65536),
|
|
207
|
+
authenticatorData: Joi.string().max(8192),
|
|
208
|
+
signature: Joi.string().max(2048),
|
|
209
|
+
userHandle: Joi.string().max(512).allow(''),
|
|
210
|
+
publicKey: Joi.string().max(4096),
|
|
211
|
+
publicKeyAlgorithm: Joi.number().integer()
|
|
212
|
+
}).required(),
|
|
213
|
+
type: Joi.string().valid('public-key').required(),
|
|
214
|
+
authenticatorAttachment: Joi.string().optional(),
|
|
215
|
+
clientExtensionResults: Joi.object().optional()
|
|
216
|
+
}).required();
|
|
217
|
+
|
|
218
|
+
function registerGetLogin(server) {
|
|
196
219
|
server.route({
|
|
197
220
|
method: 'GET',
|
|
198
221
|
path: '/admin/login',
|
|
@@ -290,7 +313,9 @@ function init(args) {
|
|
|
290
313
|
}
|
|
291
314
|
}
|
|
292
315
|
});
|
|
316
|
+
}
|
|
293
317
|
|
|
318
|
+
function registerGetLogout(server) {
|
|
294
319
|
server.route({
|
|
295
320
|
method: 'GET',
|
|
296
321
|
path: '/admin/logout',
|
|
@@ -320,7 +345,9 @@ function init(args) {
|
|
|
320
345
|
return h.redirect('/');
|
|
321
346
|
}
|
|
322
347
|
});
|
|
348
|
+
}
|
|
323
349
|
|
|
350
|
+
function registerPostLogin(server) {
|
|
324
351
|
server.route({
|
|
325
352
|
method: 'POST',
|
|
326
353
|
path: '/admin/login',
|
|
@@ -499,7 +526,9 @@ function init(args) {
|
|
|
499
526
|
}
|
|
500
527
|
}
|
|
501
528
|
});
|
|
529
|
+
}
|
|
502
530
|
|
|
531
|
+
function registerGetTotp(server) {
|
|
503
532
|
server.route({
|
|
504
533
|
method: 'GET',
|
|
505
534
|
path: '/admin/totp',
|
|
@@ -548,7 +577,9 @@ function init(args) {
|
|
|
548
577
|
}
|
|
549
578
|
}
|
|
550
579
|
});
|
|
580
|
+
}
|
|
551
581
|
|
|
582
|
+
function registerPostTotp(server) {
|
|
552
583
|
server.route({
|
|
553
584
|
method: 'POST',
|
|
554
585
|
path: '/admin/totp',
|
|
@@ -751,7 +782,9 @@ function init(args) {
|
|
|
751
782
|
}
|
|
752
783
|
}
|
|
753
784
|
});
|
|
785
|
+
}
|
|
754
786
|
|
|
787
|
+
function registerGetAccountSecurity(server) {
|
|
755
788
|
server.route({
|
|
756
789
|
method: 'GET',
|
|
757
790
|
path: '/admin/account/security',
|
|
@@ -831,11 +864,13 @@ function init(args) {
|
|
|
831
864
|
);
|
|
832
865
|
}
|
|
833
866
|
});
|
|
867
|
+
}
|
|
834
868
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
869
|
+
// Passkeys get a page of their own, the way the password does: the security page above is an
|
|
870
|
+
// inventory of ways into the account, and a credential list that grows to MAX_PASSKEYS_PER_USER
|
|
871
|
+
// rows would take it over. Registering needs an account password, so an instance without one
|
|
872
|
+
// has nothing to show here.
|
|
873
|
+
function registerGetAccountPasskeys(server) {
|
|
839
874
|
server.route({
|
|
840
875
|
method: 'GET',
|
|
841
876
|
path: '/admin/account/passkeys',
|
|
@@ -884,7 +919,9 @@ function init(args) {
|
|
|
884
919
|
);
|
|
885
920
|
}
|
|
886
921
|
});
|
|
922
|
+
}
|
|
887
923
|
|
|
924
|
+
function registerPostAccountTfaEnable(server) {
|
|
888
925
|
server.route({
|
|
889
926
|
method: 'POST',
|
|
890
927
|
path: '/admin/account/tfa/enable',
|
|
@@ -961,7 +998,9 @@ function init(args) {
|
|
|
961
998
|
}
|
|
962
999
|
}
|
|
963
1000
|
});
|
|
1001
|
+
}
|
|
964
1002
|
|
|
1003
|
+
function registerPostAccountTfaDisable(server) {
|
|
965
1004
|
server.route({
|
|
966
1005
|
method: 'POST',
|
|
967
1006
|
path: '/admin/account/tfa/disable',
|
|
@@ -1016,7 +1055,9 @@ function init(args) {
|
|
|
1016
1055
|
}
|
|
1017
1056
|
}
|
|
1018
1057
|
});
|
|
1058
|
+
}
|
|
1019
1059
|
|
|
1060
|
+
function registerPostAccountLogoutAll(server) {
|
|
1020
1061
|
server.route({
|
|
1021
1062
|
method: 'POST',
|
|
1022
1063
|
path: '/admin/account/logout-all',
|
|
@@ -1059,33 +1100,10 @@ function init(args) {
|
|
|
1059
1100
|
}
|
|
1060
1101
|
}
|
|
1061
1102
|
});
|
|
1103
|
+
}
|
|
1062
1104
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const passkeyCredentialSchema = Joi.object({
|
|
1066
|
-
id: Joi.string()
|
|
1067
|
-
.max(512)
|
|
1068
|
-
.pattern(/^[A-Za-z0-9_-]+$/)
|
|
1069
|
-
.required(),
|
|
1070
|
-
rawId: Joi.string()
|
|
1071
|
-
.max(512)
|
|
1072
|
-
.pattern(/^[A-Za-z0-9_-]+$/)
|
|
1073
|
-
.required(),
|
|
1074
|
-
response: Joi.object({
|
|
1075
|
-
clientDataJSON: Joi.string().max(16384).required(),
|
|
1076
|
-
attestationObject: Joi.string().max(65536),
|
|
1077
|
-
authenticatorData: Joi.string().max(8192),
|
|
1078
|
-
signature: Joi.string().max(2048),
|
|
1079
|
-
userHandle: Joi.string().max(512).allow(''),
|
|
1080
|
-
publicKey: Joi.string().max(4096),
|
|
1081
|
-
publicKeyAlgorithm: Joi.number().integer()
|
|
1082
|
-
}).required(),
|
|
1083
|
-
type: Joi.string().valid('public-key').required(),
|
|
1084
|
-
authenticatorAttachment: Joi.string().optional(),
|
|
1085
|
-
clientExtensionResults: Joi.object().optional()
|
|
1086
|
-
}).required();
|
|
1087
|
-
|
|
1088
|
-
// Registration: generate options (authenticated)
|
|
1105
|
+
// Registration: generate options (authenticated)
|
|
1106
|
+
function registerPostAccountPasskeysRegisterOptions(server) {
|
|
1089
1107
|
server.route({
|
|
1090
1108
|
method: 'POST',
|
|
1091
1109
|
path: '/admin/account/passkeys/register/options',
|
|
@@ -1157,8 +1175,10 @@ function init(args) {
|
|
|
1157
1175
|
}
|
|
1158
1176
|
}
|
|
1159
1177
|
});
|
|
1178
|
+
}
|
|
1160
1179
|
|
|
1161
|
-
|
|
1180
|
+
// Registration: verify response (authenticated)
|
|
1181
|
+
function registerPostAccountPasskeysRegisterVerify(server) {
|
|
1162
1182
|
server.route({
|
|
1163
1183
|
method: 'POST',
|
|
1164
1184
|
path: '/admin/account/passkeys/register/verify',
|
|
@@ -1258,8 +1278,10 @@ function init(args) {
|
|
|
1258
1278
|
}
|
|
1259
1279
|
}
|
|
1260
1280
|
});
|
|
1281
|
+
}
|
|
1261
1282
|
|
|
1262
|
-
|
|
1283
|
+
// Delete passkey (authenticated)
|
|
1284
|
+
function registerPostAccountPasskeysDelete(server) {
|
|
1263
1285
|
server.route({
|
|
1264
1286
|
method: 'POST',
|
|
1265
1287
|
path: '/admin/account/passkeys/delete',
|
|
@@ -1313,8 +1335,10 @@ function init(args) {
|
|
|
1313
1335
|
}
|
|
1314
1336
|
}
|
|
1315
1337
|
});
|
|
1338
|
+
}
|
|
1316
1339
|
|
|
1317
|
-
|
|
1340
|
+
// Authentication: generate options (unauthenticated)
|
|
1341
|
+
function registerPostPasskeyAuthOptions(server) {
|
|
1318
1342
|
server.route({
|
|
1319
1343
|
method: 'POST',
|
|
1320
1344
|
path: '/admin/passkey/auth/options',
|
|
@@ -1376,8 +1400,10 @@ function init(args) {
|
|
|
1376
1400
|
}
|
|
1377
1401
|
}
|
|
1378
1402
|
});
|
|
1403
|
+
}
|
|
1379
1404
|
|
|
1380
|
-
|
|
1405
|
+
// Authentication: verify response (unauthenticated)
|
|
1406
|
+
function registerPostPasskeyAuthVerify(server) {
|
|
1381
1407
|
server.route({
|
|
1382
1408
|
method: 'POST',
|
|
1383
1409
|
path: '/admin/passkey/auth/verify',
|
|
@@ -1487,9 +1513,11 @@ function init(args) {
|
|
|
1487
1513
|
}
|
|
1488
1514
|
}
|
|
1489
1515
|
});
|
|
1516
|
+
}
|
|
1490
1517
|
|
|
1491
|
-
|
|
1518
|
+
// --- End of Passkey routes ---
|
|
1492
1519
|
|
|
1520
|
+
function registerGetAccountPassword(server) {
|
|
1493
1521
|
server.route({
|
|
1494
1522
|
method: 'GET',
|
|
1495
1523
|
path: '/admin/account/password',
|
|
@@ -1518,7 +1546,9 @@ function init(args) {
|
|
|
1518
1546
|
);
|
|
1519
1547
|
}
|
|
1520
1548
|
});
|
|
1549
|
+
}
|
|
1521
1550
|
|
|
1551
|
+
function registerPostAccountPassword(server) {
|
|
1522
1552
|
server.route({
|
|
1523
1553
|
method: 'POST',
|
|
1524
1554
|
path: '/admin/account/password',
|
|
@@ -1681,4 +1711,26 @@ function init(args) {
|
|
|
1681
1711
|
});
|
|
1682
1712
|
}
|
|
1683
1713
|
|
|
1714
|
+
function init(args) {
|
|
1715
|
+
const { server } = args;
|
|
1716
|
+
|
|
1717
|
+
registerGetLogin(server);
|
|
1718
|
+
registerGetLogout(server);
|
|
1719
|
+
registerPostLogin(server);
|
|
1720
|
+
registerGetTotp(server);
|
|
1721
|
+
registerPostTotp(server);
|
|
1722
|
+
registerGetAccountSecurity(server);
|
|
1723
|
+
registerGetAccountPasskeys(server);
|
|
1724
|
+
registerPostAccountTfaEnable(server);
|
|
1725
|
+
registerPostAccountTfaDisable(server);
|
|
1726
|
+
registerPostAccountLogoutAll(server);
|
|
1727
|
+
registerPostAccountPasskeysRegisterOptions(server);
|
|
1728
|
+
registerPostAccountPasskeysRegisterVerify(server);
|
|
1729
|
+
registerPostAccountPasskeysDelete(server);
|
|
1730
|
+
registerPostPasskeyAuthOptions(server);
|
|
1731
|
+
registerPostPasskeyAuthVerify(server);
|
|
1732
|
+
registerGetAccountPassword(server);
|
|
1733
|
+
registerPostAccountPassword(server);
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1684
1736
|
module.exports = init;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
|
-
const { IMAP_MAX_IDLE_TIME_MIN, IMAP_MAX_IDLE_TIME_MAX } = require('../
|
|
4
|
+
const { IMAP_MAX_IDLE_TIME_MIN, IMAP_MAX_IDLE_TIME_MAX } = require('../consts');
|
|
5
5
|
|
|
6
6
|
// The IDLE restart interval on the account edit form. The form takes seconds, like the resync
|
|
7
7
|
// interval next to it, while the account stores milliseconds, the unit of the ImapFlow option it
|
|
@@ -145,6 +145,11 @@ function init(args) {
|
|
|
145
145
|
threadInfo.heapUsed = bytesFormatter.format(threadInfo.heapUsed).replace(/BB$/, 'GB');
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// Longest delay over the collector's last window; a thread's first reading has none yet
|
|
149
|
+
if (!threadInfo.isUnresponsive && typeof threadInfo.eventLoopDelay?.max === 'number') {
|
|
150
|
+
threadInfo.eventLoopDelayMax = Math.round(threadInfo.eventLoopDelay.max);
|
|
151
|
+
}
|
|
152
|
+
|
|
148
153
|
// Email (sync) workers own account assignment, but the count field is absent
|
|
149
154
|
// when a worker currently syncs none - show an explicit 0 instead of a blank.
|
|
150
155
|
if (threadInfo.type === 'imap' && typeof threadInfo.accounts !== 'number') {
|