emailengine-app 2.84.1 → 2.85.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/.dockerignore +6 -0
- package/.ncurc.js +5 -3
- package/.prettierignore +5 -1
- package/.prettierrc.js +2 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +61 -0
- package/Dockerfile +8 -2
- package/README.md +1 -1
- package/bin/emailengine.js +444 -403
- package/copy-static-files.sh +39 -14
- package/data/google-crawlers.json +1 -1
- package/data/public_suffix_list.dat +16562 -0
- package/docker-compose.yml +1 -1
- package/eslint.config.js +81 -99
- package/lib/account/own-account-key.js +42 -0
- package/lib/account-assignment.js +1 -33
- package/lib/account.js +68 -24
- package/lib/add-trackers.js +11 -4
- package/lib/api-reference/format.js +4 -3
- package/lib/api-routes/account-routes.js +244 -26
- package/lib/api-routes/blocklist-routes.js +23 -2
- package/lib/api-routes/delivery-test-routes.js +26 -3
- package/lib/api-routes/export-routes.js +28 -2
- package/lib/api-routes/gateway-routes.js +37 -5
- package/lib/api-routes/mailbox-routes.js +41 -2
- package/lib/api-routes/message-routes.js +104 -4
- package/lib/api-routes/mint-bounds.js +11 -0
- package/lib/api-routes/oauth2-app-routes.js +48 -15
- package/lib/api-routes/outbox-routes.js +45 -11
- package/lib/api-routes/permission-map.js +12 -1
- package/lib/api-routes/route-helpers.js +125 -3
- package/lib/api-routes/settings-routes.js +23 -2
- package/lib/api-routes/submit-routes.js +338 -309
- package/lib/api-routes/template-routes.js +38 -2
- package/lib/api-routes/token-routes.js +142 -96
- package/lib/api-routes/webhook-route-routes.js +13 -2
- package/lib/auth-token.js +23 -10
- package/lib/bounce-detect.js +414 -210
- package/lib/consts.js +39 -4
- package/lib/create-imap-client.js +41 -2
- package/lib/email-client/base-client.js +30 -41
- package/lib/email-client/gmail-client.js +30 -18
- package/lib/email-client/imap/mailbox.js +13 -23
- package/lib/email-client/imap/response-metrics.js +75 -0
- package/lib/email-client/imap/subconnection.js +1 -1
- package/lib/email-client/imap-client.js +6 -3
- package/lib/email-client/message-builder.js +7 -2
- package/lib/email-client/notification-handler.js +1 -2
- package/lib/email-client/outlook/graph-api.js +17 -2
- package/lib/email-client/outlook-client.js +6 -3
- package/lib/email-client/smtp-pool-manager.js +6 -0
- package/lib/encrypt.js +9 -0
- package/lib/export.js +3 -1
- package/lib/gateway.js +2 -3
- package/lib/get-raw-email.js +4 -2
- package/lib/hapi-request-logger.js +107 -0
- package/lib/imap-proxy-auth.js +14 -1
- package/lib/imapproxy/imap-core/README.md +6 -5
- package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +1 -0
- package/lib/imapproxy/imap-core/lib/commands/login.js +1 -0
- package/lib/imapproxy/imap-core/lib/imap-command.js +86 -43
- package/lib/imapproxy/imap-core/lib/imap-stream.js +58 -13
- package/lib/imapproxy/imap-core/lib/indexer/indexer.js +3 -1
- package/lib/mcp/listen.js +10 -1
- package/lib/mcp/tools.js +37 -8
- package/lib/notify-attachments.js +17 -0
- package/lib/oauth/external-account-config.js +3 -1
- package/lib/oauth/gmail.js +21 -48
- package/lib/oauth/mail-ru.js +5 -38
- package/lib/oauth/outlook-mailbox.js +35 -0
- package/lib/oauth/outlook.js +26 -44
- package/lib/oauth/state.js +24 -0
- package/lib/oauth2-apps.js +1 -1
- package/lib/pbkdf2-phc.js +19 -2
- package/lib/privileged-settings.js +6 -3
- package/lib/redis-scan-delete.js +15 -1
- package/lib/schemas.js +79 -33
- package/lib/settings.js +13 -1
- package/lib/smtp-auth.js +23 -0
- package/lib/sso.js +1 -1
- package/lib/swagger-options.js +1 -1
- package/lib/thread-diagnostics.js +46 -0
- package/lib/timezones.js +109 -0
- package/lib/token-permission-view.js +3 -3
- package/lib/tools.js +285 -66
- package/lib/totp.js +2 -5
- package/lib/translations.js +1 -2
- package/lib/ui-routes/account-routes.js +491 -491
- package/lib/ui-routes/account-setup.js +99 -0
- package/lib/ui-routes/admin-config-routes.js +98 -48
- package/lib/ui-routes/admin-entities-routes.js +113 -31
- package/lib/ui-routes/auth-routes.js +137 -62
- package/lib/ui-routes/connection-security-form.js +74 -0
- package/lib/ui-routes/form-lists.js +46 -0
- package/lib/ui-routes/internals-routes.js +5 -0
- package/lib/ui-routes/mcp-consent-routes.js +5 -1
- package/lib/ui-routes/oauth-config-routes.js +133 -100
- package/lib/ui-routes/route-helpers.js +19 -3
- package/lib/ui-routes/sign-in-helpers.js +59 -0
- package/lib/ui-routes/tls-config-routes.js +58 -15
- package/lib/ui-routes/unsubscribe-routes.js +6 -3
- package/lib/utils/back-off.js +82 -0
- package/lib/utils/map-concurrent.js +36 -0
- package/lib/utils/murmurhash3.js +66 -0
- package/lib/utils/network.js +28 -0
- package/lib/utils/provider-id.js +27 -0
- package/lib/utils/public-suffix.js +122 -0
- package/lib/utils/random-id.js +26 -0
- package/lib/utils/require-tls.js +33 -0
- package/lib/utils/version.js +74 -0
- package/lib/web-safe-html.js +5 -6
- package/lib/webhook-penalty.js +75 -0
- package/lib/webhook-routing.js +49 -2
- package/lib/webhooks.js +41 -6
- package/package.json +37 -39
- package/sbom.json +7980 -1
- package/server.js +659 -455
- package/static/js/ace/ace.js +1 -1
- package/static/js/ace/mode-handlebars.js +1 -1
- package/static/js/ace/mode-html.js +1 -1
- package/static/js/ace/mode-javascript.js +1 -1
- package/static/js/ace/mode-markdown.js +1 -1
- package/static/js/ace/worker-html.js +1 -1
- package/static/js/ace/worker-javascript.js +1 -1
- package/static/js/ace/worker-json.js +1 -1
- package/static/js/ee-client.js +5 -0
- package/static/licenses.html +191 -1016
- package/translations/messages.pot +70 -71
- package/views/account/security.hbs +10 -0
- package/views/accounts/account.hbs +11 -11
- package/views/accounts/edit.hbs +6 -2
- package/views/config/ai.hbs +1 -1
- package/views/config/security.hbs +2 -2
- package/views/config/service.hbs +3 -0
- package/views/internals/index.hbs +8 -0
- package/views/partials/gateway_form.hbs +3 -1
- package/views/partials/webhook_form.hbs +1 -1
- package/views/suppression-lists/index.hbs +1 -1
- package/workers/api.js +780 -585
- package/workers/export.js +1 -1
- package/workers/submit.js +1 -1
- package/workers/webhooks.js +54 -34
- package/config/test.toml +0 -46
- package/install.sh +0 -428
- package/setup-production.sh +0 -215
- package/systemd/emailengine.service +0 -97
- package/systemd/nginx-proxy.conf +0 -77
|
@@ -9,6 +9,7 @@ const { redis } = require('../db');
|
|
|
9
9
|
const getSecret = require('../get-secret');
|
|
10
10
|
const { failAction, verifyAccountInfo, formatPartialSecretKey } = require('../tools');
|
|
11
11
|
const { templateSchemas, accountIdSchema, tokenPermissionsSchema, formBoolean, mailboxAddressSchema } = require('../schemas');
|
|
12
|
+
const { requireTlsFormField } = require('./connection-security-form');
|
|
12
13
|
const tokenPermissionView = require('../token-permission-view');
|
|
13
14
|
const { PRIVILEGED_SETTINGS_SUMMARY } = require('../privileged-settings');
|
|
14
15
|
const { Account, accountExists, accountSummary } = require('../account');
|
|
@@ -28,6 +29,7 @@ const {
|
|
|
28
29
|
submittedValues,
|
|
29
30
|
windowedPageLinks
|
|
30
31
|
} = require('./route-helpers');
|
|
32
|
+
const { parseCustomHeaders } = require('./form-lists');
|
|
31
33
|
const exampleWebhookPayloads = require('../payload-examples-webhooks.json');
|
|
32
34
|
|
|
33
35
|
const { DEFAULT_PAGE_SIZE } = consts;
|
|
@@ -90,11 +92,9 @@ async function getExampleWebhookPayloads() {
|
|
|
90
92
|
return examplePayloads;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
const { server, call } = args;
|
|
95
|
-
|
|
96
|
-
// Webhook routes
|
|
95
|
+
// Webhook routes
|
|
97
96
|
|
|
97
|
+
function registerGetWebhooks(server) {
|
|
98
98
|
server.route({
|
|
99
99
|
method: 'GET',
|
|
100
100
|
path: '/admin/webhooks',
|
|
@@ -181,7 +181,9 @@ function init(args) {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
|
+
}
|
|
184
185
|
|
|
186
|
+
function registerGetWebhooksNew(server) {
|
|
185
187
|
server.route({
|
|
186
188
|
method: 'GET',
|
|
187
189
|
path: '/admin/webhooks/new',
|
|
@@ -239,7 +241,9 @@ return payload;`)
|
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
});
|
|
244
|
+
}
|
|
242
245
|
|
|
246
|
+
function registerPostWebhooksNew(server) {
|
|
243
247
|
server.route({
|
|
244
248
|
method: 'POST',
|
|
245
249
|
path: '/admin/webhooks/new',
|
|
@@ -370,7 +374,9 @@ return payload;`)
|
|
|
370
374
|
}
|
|
371
375
|
}
|
|
372
376
|
});
|
|
377
|
+
}
|
|
373
378
|
|
|
379
|
+
function registerGetWebhooksWebhook(server) {
|
|
374
380
|
server.route({
|
|
375
381
|
method: 'GET',
|
|
376
382
|
path: '/admin/webhooks/webhook/{webhook}',
|
|
@@ -433,7 +439,9 @@ return payload;`)
|
|
|
433
439
|
}
|
|
434
440
|
}
|
|
435
441
|
});
|
|
442
|
+
}
|
|
436
443
|
|
|
444
|
+
function registerGetWebhooksWebhookEdit(server) {
|
|
437
445
|
server.route({
|
|
438
446
|
method: 'GET',
|
|
439
447
|
path: '/admin/webhooks/webhook/{webhook}/edit',
|
|
@@ -502,7 +510,9 @@ return payload;`)
|
|
|
502
510
|
}
|
|
503
511
|
}
|
|
504
512
|
});
|
|
513
|
+
}
|
|
505
514
|
|
|
515
|
+
function registerPostWebhooksEdit(server) {
|
|
506
516
|
server.route({
|
|
507
517
|
method: 'POST',
|
|
508
518
|
path: '/admin/webhooks/edit',
|
|
@@ -659,7 +669,9 @@ return payload;`)
|
|
|
659
669
|
}
|
|
660
670
|
}
|
|
661
671
|
});
|
|
672
|
+
}
|
|
662
673
|
|
|
674
|
+
function registerPostWebhooksDelete(server) {
|
|
663
675
|
server.route({
|
|
664
676
|
method: 'POST',
|
|
665
677
|
path: '/admin/webhooks/delete',
|
|
@@ -704,9 +716,11 @@ return payload;`)
|
|
|
704
716
|
}
|
|
705
717
|
}
|
|
706
718
|
});
|
|
719
|
+
}
|
|
707
720
|
|
|
708
|
-
|
|
721
|
+
// Template routes
|
|
709
722
|
|
|
723
|
+
function registerGetTemplates(server) {
|
|
710
724
|
server.route({
|
|
711
725
|
method: 'GET',
|
|
712
726
|
path: '/admin/templates',
|
|
@@ -803,7 +817,9 @@ return payload;`)
|
|
|
803
817
|
}
|
|
804
818
|
}
|
|
805
819
|
});
|
|
820
|
+
}
|
|
806
821
|
|
|
822
|
+
function registerGetTemplatesTemplate(server) {
|
|
807
823
|
server.route({
|
|
808
824
|
method: 'GET',
|
|
809
825
|
path: '/admin/templates/template/{template}',
|
|
@@ -864,7 +880,9 @@ return payload;`)
|
|
|
864
880
|
}
|
|
865
881
|
}
|
|
866
882
|
});
|
|
883
|
+
}
|
|
867
884
|
|
|
885
|
+
function registerGetTemplatesTemplateEdit(server) {
|
|
868
886
|
server.route({
|
|
869
887
|
method: 'GET',
|
|
870
888
|
path: '/admin/templates/template/{template}/edit',
|
|
@@ -939,7 +957,9 @@ return payload;`)
|
|
|
939
957
|
}
|
|
940
958
|
}
|
|
941
959
|
});
|
|
960
|
+
}
|
|
942
961
|
|
|
962
|
+
function registerPostTemplatesEdit(server) {
|
|
943
963
|
server.route({
|
|
944
964
|
method: 'POST',
|
|
945
965
|
path: '/admin/templates/edit',
|
|
@@ -1092,7 +1112,9 @@ return payload;`)
|
|
|
1092
1112
|
}
|
|
1093
1113
|
}
|
|
1094
1114
|
});
|
|
1115
|
+
}
|
|
1095
1116
|
|
|
1117
|
+
function registerGetTemplatesNew(server) {
|
|
1096
1118
|
server.route({
|
|
1097
1119
|
method: 'GET',
|
|
1098
1120
|
path: '/admin/templates/new',
|
|
@@ -1156,7 +1178,9 @@ return payload;`)
|
|
|
1156
1178
|
}
|
|
1157
1179
|
}
|
|
1158
1180
|
});
|
|
1181
|
+
}
|
|
1159
1182
|
|
|
1183
|
+
function registerPostTemplatesNew(server) {
|
|
1160
1184
|
server.route({
|
|
1161
1185
|
method: 'POST',
|
|
1162
1186
|
path: '/admin/templates/new',
|
|
@@ -1296,7 +1320,9 @@ return payload;`)
|
|
|
1296
1320
|
}
|
|
1297
1321
|
}
|
|
1298
1322
|
});
|
|
1323
|
+
}
|
|
1299
1324
|
|
|
1325
|
+
function registerPostTemplatesDelete(server) {
|
|
1300
1326
|
server.route({
|
|
1301
1327
|
method: 'POST',
|
|
1302
1328
|
path: '/admin/templates/delete',
|
|
@@ -1344,6 +1370,10 @@ return payload;`)
|
|
|
1344
1370
|
}
|
|
1345
1371
|
}
|
|
1346
1372
|
});
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
function registerPostTemplatesTest(server, args) {
|
|
1376
|
+
const { call } = args;
|
|
1347
1377
|
|
|
1348
1378
|
server.route({
|
|
1349
1379
|
method: 'POST',
|
|
@@ -1436,9 +1466,11 @@ return payload;`)
|
|
|
1436
1466
|
}
|
|
1437
1467
|
}
|
|
1438
1468
|
});
|
|
1469
|
+
}
|
|
1439
1470
|
|
|
1440
|
-
|
|
1471
|
+
// Gateway routes
|
|
1441
1472
|
|
|
1473
|
+
function registerGetGateways(server) {
|
|
1442
1474
|
server.route({
|
|
1443
1475
|
method: 'GET',
|
|
1444
1476
|
path: '/admin/gateways',
|
|
@@ -1540,7 +1572,9 @@ return payload;`)
|
|
|
1540
1572
|
}
|
|
1541
1573
|
}
|
|
1542
1574
|
});
|
|
1575
|
+
}
|
|
1543
1576
|
|
|
1577
|
+
function registerGetGatewaysNew(server) {
|
|
1544
1578
|
server.route({
|
|
1545
1579
|
method: 'GET',
|
|
1546
1580
|
path: '/admin/gateways/new',
|
|
@@ -1550,7 +1584,9 @@ return payload;`)
|
|
|
1550
1584
|
{
|
|
1551
1585
|
pageTitle: 'Gateways',
|
|
1552
1586
|
menuGateways: true,
|
|
1553
|
-
wellKnownServices: JSON.stringify(Object.keys(wellKnownServices).map(key => Object.assign({ key }, wellKnownServices[key])))
|
|
1587
|
+
wellKnownServices: JSON.stringify(Object.keys(wellKnownServices).map(key => Object.assign({ key }, wellKnownServices[key]))),
|
|
1588
|
+
// a new gateway requires STARTTLS unless the operator unticks it
|
|
1589
|
+
values: { requireTLS: true }
|
|
1554
1590
|
},
|
|
1555
1591
|
{
|
|
1556
1592
|
layout: 'app'
|
|
@@ -1558,7 +1594,9 @@ return payload;`)
|
|
|
1558
1594
|
);
|
|
1559
1595
|
}
|
|
1560
1596
|
});
|
|
1597
|
+
}
|
|
1561
1598
|
|
|
1599
|
+
function registerGetGatewaysGateway(server) {
|
|
1562
1600
|
server.route({
|
|
1563
1601
|
method: 'GET',
|
|
1564
1602
|
path: '/admin/gateways/gateway/{gateway}',
|
|
@@ -1614,7 +1652,9 @@ return payload;`)
|
|
|
1614
1652
|
}
|
|
1615
1653
|
}
|
|
1616
1654
|
});
|
|
1655
|
+
}
|
|
1617
1656
|
|
|
1657
|
+
function registerGetGatewaysEdit(server) {
|
|
1618
1658
|
server.route({
|
|
1619
1659
|
method: 'GET',
|
|
1620
1660
|
path: '/admin/gateways/edit/{gateway}',
|
|
@@ -1631,7 +1671,8 @@ return payload;`)
|
|
|
1631
1671
|
pageTitle: 'Gateways',
|
|
1632
1672
|
menuGateways: true,
|
|
1633
1673
|
wellKnownServices: JSON.stringify(Object.keys(wellKnownServices).map(key => Object.assign({ key }, wellKnownServices[key]))),
|
|
1634
|
-
|
|
1674
|
+
// STARTTLS is required unless the stored gateway says otherwise
|
|
1675
|
+
values: Object.assign({}, gatewayData, { requireTLS: gatewayData.requireTLS !== false }),
|
|
1635
1676
|
gatewayData,
|
|
1636
1677
|
hasSMTPPass
|
|
1637
1678
|
},
|
|
@@ -1660,7 +1701,9 @@ return payload;`)
|
|
|
1660
1701
|
}
|
|
1661
1702
|
}
|
|
1662
1703
|
});
|
|
1704
|
+
}
|
|
1663
1705
|
|
|
1706
|
+
function registerPostGatewaysNew(server) {
|
|
1664
1707
|
server.route({
|
|
1665
1708
|
method: 'POST',
|
|
1666
1709
|
path: '/admin/gateways/new',
|
|
@@ -1672,6 +1715,7 @@ return payload;`)
|
|
|
1672
1715
|
host: request.payload.host || null,
|
|
1673
1716
|
port: request.payload.port || null,
|
|
1674
1717
|
secure: request.payload.secure || null,
|
|
1718
|
+
requireTLS: request.payload.requireTLS,
|
|
1675
1719
|
user: request.payload.user || null,
|
|
1676
1720
|
pass: request.payload.pass || null,
|
|
1677
1721
|
tls: {}
|
|
@@ -1766,12 +1810,15 @@ return payload;`)
|
|
|
1766
1810
|
.label('Port')
|
|
1767
1811
|
.required(),
|
|
1768
1812
|
|
|
1769
|
-
secure: formBoolean().default(false).example(true).description('Should connection use TLS. Usually true for port 465').label('TLS')
|
|
1813
|
+
secure: formBoolean().default(false).example(true).description('Should connection use TLS. Usually true for port 465').label('TLS'),
|
|
1814
|
+
requireTLS: requireTlsFormField()
|
|
1770
1815
|
})
|
|
1771
1816
|
}
|
|
1772
1817
|
}
|
|
1773
1818
|
});
|
|
1819
|
+
}
|
|
1774
1820
|
|
|
1821
|
+
function registerPostGatewaysEdit(server) {
|
|
1775
1822
|
server.route({
|
|
1776
1823
|
method: 'POST',
|
|
1777
1824
|
path: '/admin/gateways/edit',
|
|
@@ -1783,6 +1830,7 @@ return payload;`)
|
|
|
1783
1830
|
host: request.payload.host || null,
|
|
1784
1831
|
port: request.payload.port || null,
|
|
1785
1832
|
secure: request.payload.secure || null,
|
|
1833
|
+
requireTLS: request.payload.requireTLS,
|
|
1786
1834
|
user: request.payload.user || null
|
|
1787
1835
|
};
|
|
1788
1836
|
|
|
@@ -1892,24 +1940,30 @@ return payload;`)
|
|
|
1892
1940
|
.label('Port')
|
|
1893
1941
|
.required(),
|
|
1894
1942
|
|
|
1895
|
-
secure: formBoolean().default(false).example(true).description('Should connection use TLS. Usually true for port 465').label('TLS')
|
|
1943
|
+
secure: formBoolean().default(false).example(true).description('Should connection use TLS. Usually true for port 465').label('TLS'),
|
|
1944
|
+
requireTLS: requireTlsFormField()
|
|
1896
1945
|
})
|
|
1897
1946
|
}
|
|
1898
1947
|
}
|
|
1899
1948
|
});
|
|
1949
|
+
}
|
|
1900
1950
|
|
|
1951
|
+
function registerPostGatewaysTest(server) {
|
|
1901
1952
|
server.route({
|
|
1902
1953
|
method: 'POST',
|
|
1903
1954
|
path: '/admin/gateways/test',
|
|
1904
1955
|
async handler(request) {
|
|
1905
|
-
let { gateway, host, port, user, pass, secure } = request.payload;
|
|
1956
|
+
let { gateway, host, port, user, pass, secure, requireTLS } = request.payload;
|
|
1906
1957
|
|
|
1907
1958
|
try {
|
|
1908
1959
|
if (user && !pass && gateway) {
|
|
1909
1960
|
let gatewayObject = new Gateway({ gateway, redis, secret: await getSecret() });
|
|
1910
1961
|
try {
|
|
1911
1962
|
let gatewayData = await gatewayObject.loadGatewayData();
|
|
1912
|
-
|
|
1963
|
+
// The stored password is only ever sent to the server it was stored for:
|
|
1964
|
+
// the form names any host it likes, and a write-only secret must not be
|
|
1965
|
+
// extractable by pointing the test at one's own server
|
|
1966
|
+
if (gatewayData && gatewayData.host === host && Number(gatewayData.port) === Number(port) && gatewayData.user === user) {
|
|
1913
1967
|
pass = gatewayData.pass || '';
|
|
1914
1968
|
}
|
|
1915
1969
|
} catch (err) {
|
|
@@ -1922,6 +1976,7 @@ return payload;`)
|
|
|
1922
1976
|
host,
|
|
1923
1977
|
port,
|
|
1924
1978
|
secure,
|
|
1979
|
+
requireTLS,
|
|
1925
1980
|
auth:
|
|
1926
1981
|
user || pass
|
|
1927
1982
|
? {
|
|
@@ -2002,12 +2057,15 @@ return payload;`)
|
|
|
2002
2057
|
.example(465)
|
|
2003
2058
|
.description('Service port number')
|
|
2004
2059
|
.label('Port'),
|
|
2005
|
-
secure: formBoolean().default(false).example(true).description('Should connection use TLS. Usually true for port 465').label('TLS')
|
|
2060
|
+
secure: formBoolean().default(false).example(true).description('Should connection use TLS. Usually true for port 465').label('TLS'),
|
|
2061
|
+
requireTLS: requireTlsFormField()
|
|
2006
2062
|
})
|
|
2007
2063
|
}
|
|
2008
2064
|
}
|
|
2009
2065
|
});
|
|
2066
|
+
}
|
|
2010
2067
|
|
|
2068
|
+
function registerPostGatewaysDelete(server) {
|
|
2011
2069
|
server.route({
|
|
2012
2070
|
method: 'POST',
|
|
2013
2071
|
path: '/admin/gateways/delete/{gateway}',
|
|
@@ -2057,9 +2115,11 @@ return payload;`)
|
|
|
2057
2115
|
}
|
|
2058
2116
|
}
|
|
2059
2117
|
});
|
|
2118
|
+
}
|
|
2060
2119
|
|
|
2061
|
-
|
|
2120
|
+
// Token routes
|
|
2062
2121
|
|
|
2122
|
+
function registerGetTokens(server) {
|
|
2063
2123
|
server.route({
|
|
2064
2124
|
method: 'GET',
|
|
2065
2125
|
path: '/admin/tokens',
|
|
@@ -2232,7 +2292,9 @@ return payload;`)
|
|
|
2232
2292
|
}
|
|
2233
2293
|
}
|
|
2234
2294
|
});
|
|
2295
|
+
}
|
|
2235
2296
|
|
|
2297
|
+
function registerGetTokensNew(server) {
|
|
2236
2298
|
server.route({
|
|
2237
2299
|
method: 'GET',
|
|
2238
2300
|
path: '/admin/tokens/new',
|
|
@@ -2318,7 +2380,9 @@ return payload;`)
|
|
|
2318
2380
|
}
|
|
2319
2381
|
}
|
|
2320
2382
|
});
|
|
2383
|
+
}
|
|
2321
2384
|
|
|
2385
|
+
function registerPostTokensNew(server) {
|
|
2322
2386
|
server.route({
|
|
2323
2387
|
method: 'POST',
|
|
2324
2388
|
path: '/admin/tokens/new',
|
|
@@ -2405,7 +2469,9 @@ return payload;`)
|
|
|
2405
2469
|
}
|
|
2406
2470
|
}
|
|
2407
2471
|
});
|
|
2472
|
+
}
|
|
2408
2473
|
|
|
2474
|
+
function registerPostTokensDelete(server) {
|
|
2409
2475
|
server.route({
|
|
2410
2476
|
method: 'POST',
|
|
2411
2477
|
path: '/admin/tokens/delete',
|
|
@@ -2460,6 +2526,38 @@ return payload;`)
|
|
|
2460
2526
|
});
|
|
2461
2527
|
}
|
|
2462
2528
|
|
|
2529
|
+
function init(args) {
|
|
2530
|
+
const { server } = args;
|
|
2531
|
+
|
|
2532
|
+
registerGetWebhooks(server);
|
|
2533
|
+
registerGetWebhooksNew(server);
|
|
2534
|
+
registerPostWebhooksNew(server);
|
|
2535
|
+
registerGetWebhooksWebhook(server);
|
|
2536
|
+
registerGetWebhooksWebhookEdit(server);
|
|
2537
|
+
registerPostWebhooksEdit(server);
|
|
2538
|
+
registerPostWebhooksDelete(server);
|
|
2539
|
+
registerGetTemplates(server);
|
|
2540
|
+
registerGetTemplatesTemplate(server);
|
|
2541
|
+
registerGetTemplatesTemplateEdit(server);
|
|
2542
|
+
registerPostTemplatesEdit(server);
|
|
2543
|
+
registerGetTemplatesNew(server);
|
|
2544
|
+
registerPostTemplatesNew(server);
|
|
2545
|
+
registerPostTemplatesDelete(server);
|
|
2546
|
+
registerPostTemplatesTest(server, args);
|
|
2547
|
+
registerGetGateways(server);
|
|
2548
|
+
registerGetGatewaysNew(server);
|
|
2549
|
+
registerGetGatewaysGateway(server);
|
|
2550
|
+
registerGetGatewaysEdit(server);
|
|
2551
|
+
registerPostGatewaysNew(server);
|
|
2552
|
+
registerPostGatewaysEdit(server);
|
|
2553
|
+
registerPostGatewaysTest(server);
|
|
2554
|
+
registerPostGatewaysDelete(server);
|
|
2555
|
+
registerGetTokens(server);
|
|
2556
|
+
registerGetTokensNew(server);
|
|
2557
|
+
registerPostTokensNew(server);
|
|
2558
|
+
registerPostTokensDelete(server);
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2463
2561
|
// The account a template belongs to, for the template pages. A template can outlive its account
|
|
2464
2562
|
// (deleted since, or stored before the create form checked the ID), and a missing account is
|
|
2465
2563
|
// then rendered as no account rather than turning the template itself into a 404 nobody can
|
|
@@ -2496,23 +2594,7 @@ function parseWebhookForm(payload) {
|
|
|
2496
2594
|
}
|
|
2497
2595
|
}
|
|
2498
2596
|
|
|
2499
|
-
let customHeaders = payload.customHeaders
|
|
2500
|
-
.split(/[\r\n]+/)
|
|
2501
|
-
.map(header => header.trim())
|
|
2502
|
-
.filter(header => header)
|
|
2503
|
-
.map(line => {
|
|
2504
|
-
let sep = line.indexOf(':');
|
|
2505
|
-
if (sep >= 0) {
|
|
2506
|
-
return {
|
|
2507
|
-
key: line.substring(0, sep).trim(),
|
|
2508
|
-
value: line.substring(sep + 1).trim()
|
|
2509
|
-
};
|
|
2510
|
-
}
|
|
2511
|
-
return {
|
|
2512
|
-
key: line,
|
|
2513
|
-
value: ''
|
|
2514
|
-
};
|
|
2515
|
-
});
|
|
2597
|
+
let customHeaders = parseCustomHeaders(payload.customHeaders);
|
|
2516
2598
|
|
|
2517
2599
|
return { contentFn: scripts.contentFn, contentMap: scripts.contentMap, customHeaders };
|
|
2518
2600
|
}
|