emailengine-app 2.79.8 → 2.79.9

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 (133) hide show
  1. package/.github/dependabot.yml +22 -0
  2. package/.github/workflows/test.yml +39 -0
  3. package/.release-please-manifest.json +1 -1
  4. package/CHANGELOG.md +20 -0
  5. package/DOCKER_DEPLOYMENT.md +6 -7
  6. package/Dockerfile +35 -11
  7. package/config/default.toml +2 -1
  8. package/copy-static-files.sh +23 -5
  9. package/data/google-crawlers.json +1 -1
  10. package/lib/account.js +26 -1
  11. package/lib/api-routes/bull-board-routes.js +3 -2
  12. package/lib/api-routes/route-helpers.js +8 -0
  13. package/lib/auth-token.js +73 -2
  14. package/lib/autodetect-imap-settings.js +33 -25
  15. package/lib/consts.js +8 -1
  16. package/lib/egress-fetch.js +133 -0
  17. package/lib/export.js +35 -2
  18. package/lib/handlebars-helpers.js +129 -0
  19. package/lib/imap-proxy-auth.js +41 -21
  20. package/lib/imapproxy/imap-core/README.md +1 -0
  21. package/lib/imapproxy/imap-core/lib/tls-options.js +5 -46
  22. package/lib/imapproxy/imap-server.js +9 -10
  23. package/lib/openapi/index.js +3 -0
  24. package/lib/outbox.js +28 -3
  25. package/lib/rate-limit.js +23 -4
  26. package/lib/schemas.js +10 -3
  27. package/lib/security-headers.js +396 -0
  28. package/lib/sentry.js +36 -4
  29. package/lib/smtp-auth.js +86 -7
  30. package/lib/tools.js +265 -120
  31. package/lib/ui-routes/account-routes.js +4 -3
  32. package/lib/ui-routes/export-routes.js +4 -0
  33. package/lib/ui-routes/mcp-consent-routes.js +7 -0
  34. package/lib/ui-routes/network-config-routes.js +4 -3
  35. package/lib/ui-routes/route-helpers.js +24 -8
  36. package/lib/ui-routes/smtp-test-routes.js +7 -0
  37. package/lib/webhook-egress.js +5 -0
  38. package/package.json +21 -24
  39. package/sbom.json +1 -1
  40. package/server.js +37 -36
  41. package/static/js/ace/css/ace.css +1462 -0
  42. package/static/js/ace/css/kuroir-1.png +0 -0
  43. package/static/js/ace/css/kuroir-2.png +0 -0
  44. package/static/js/ace/css/main-1.png +0 -0
  45. package/static/js/ace/css/main-10.svg +4 -0
  46. package/static/js/ace/css/main-11.svg +5 -0
  47. package/static/js/ace/css/main-12.svg +4 -0
  48. package/static/js/ace/css/main-13.png +0 -0
  49. package/static/js/ace/css/main-14.png +0 -0
  50. package/static/js/ace/css/main-15.png +0 -0
  51. package/static/js/ace/css/main-16.png +0 -0
  52. package/static/js/ace/css/main-17.png +0 -0
  53. package/static/js/ace/css/main-18.png +0 -0
  54. package/static/js/ace/css/main-19.png +0 -0
  55. package/static/js/ace/css/main-2.png +0 -0
  56. package/static/js/ace/css/main-20.png +0 -0
  57. package/static/js/ace/css/main-21.png +0 -0
  58. package/static/js/ace/css/main-22.png +0 -0
  59. package/static/js/ace/css/main-23.png +0 -0
  60. package/static/js/ace/css/main-24.png +0 -0
  61. package/static/js/ace/css/main-25.svg +1 -0
  62. package/static/js/ace/css/main-26.png +0 -0
  63. package/static/js/ace/css/main-3.png +0 -0
  64. package/static/js/ace/css/main-4.png +0 -0
  65. package/static/js/ace/css/main-5.svg +7 -0
  66. package/static/js/ace/css/main-6.svg +9 -0
  67. package/static/js/ace/css/main-7.svg +7 -0
  68. package/static/js/ace/css/main-8.svg +9 -0
  69. package/static/js/ace/css/main-9.svg +6 -0
  70. package/static/js/ace/css/theme/kuroir.css +78 -0
  71. package/static/js/ace/css/theme/tomorrow_night.css +128 -0
  72. package/static/js/ace/css/theme/tomorrow_night_eighties.css +128 -0
  73. package/static/js/ace/css/theme/xcode.css +106 -0
  74. package/static/js/ace/css/tomorrow_night-1.png +0 -0
  75. package/static/js/ace/css/tomorrow_night-2.png +0 -0
  76. package/static/js/ace/css/tomorrow_night_eighties-1.png +0 -0
  77. package/static/js/ace/css/tomorrow_night_eighties-2.png +0 -0
  78. package/static/js/ace/css/xcode-1.png +0 -0
  79. package/static/js/ace/css/xcode-2.png +0 -0
  80. package/static/js/ee-client.js +256 -102
  81. package/static/js/public.js +7 -0
  82. package/static/js/ui.js +32 -0
  83. package/static/licenses.html +331 -291
  84. package/static/vendor/simplewebauthn/browser.min.js +2 -2
  85. package/translations/messages.pot +203 -157
  86. package/views/accounts/account.hbs +15 -37
  87. package/views/accounts/browse.hbs +3 -1
  88. package/views/accounts/edit.hbs +1 -1
  89. package/views/accounts/register/imap-server.hbs +1 -1
  90. package/views/config/ai.hbs +1 -1
  91. package/views/config/branding.hbs +2 -2
  92. package/views/config/document-store/chat.hbs +1 -1
  93. package/views/config/document-store/index.hbs +1 -1
  94. package/views/config/imap-proxy.hbs +1 -1
  95. package/views/config/license.hbs +1 -1
  96. package/views/config/mcp.hbs +1 -1
  97. package/views/config/network.hbs +14 -16
  98. package/views/config/oauth/app.hbs +2 -2
  99. package/views/config/service.hbs +1 -1
  100. package/views/config/smtp.hbs +1 -1
  101. package/views/config/webhooks.hbs +2 -2
  102. package/views/error.hbs +4 -2
  103. package/views/internals/index.hbs +1 -1
  104. package/views/layout/app.hbs +3 -11
  105. package/views/mcp/authorize.hbs +1 -1
  106. package/views/partials/ace_assets.hbs +13 -0
  107. package/views/partials/add_account_modal.hbs +1 -1
  108. package/views/partials/address_list.hbs +4 -4
  109. package/views/partials/filter_editor_js.hbs +2 -2
  110. package/views/partials/gateway_js.hbs +1 -1
  111. package/views/partials/oauth_form.hbs +1 -1
  112. package/views/partials/public_theme_init.hbs +1 -1
  113. package/views/partials/template_form.hbs +2 -2
  114. package/views/partials/test_send.hbs +7 -4
  115. package/views/partials/theme_init.hbs +1 -1
  116. package/views/partials/ui/details.hbs +2 -2
  117. package/views/partials/webhooks_editor_functions.hbs +1 -1
  118. package/views/reference/redirect.hbs +1 -1
  119. package/views/templates/template.hbs +2 -2
  120. package/views/tokens/new.hbs +1 -1
  121. package/views/unsubscribe.hbs +1 -1
  122. package/views/webhooks/webhook.hbs +2 -2
  123. package/workers/api.js +42 -112
  124. package/workers/export.js +1 -5
  125. package/workers/imap.js +1 -3
  126. package/workers/smtp.js +12 -43
  127. package/workers/submit.js +6 -12
  128. package/workers/webhooks.js +6 -17
  129. package/static/front/EmailEngine_logo_horiz.png +0 -0
  130. package/static/front/EmailEngine_logo_vert.png +0 -0
  131. package/static/front/index.html +0 -57
  132. package/static/front/logo.png +0 -0
  133. package/static/vendor/handlebars/handlebars.min-v4.7.9.js +0 -29
@@ -285,8 +285,13 @@
285
285
  To
286
286
  {{/if}}
287
287
 
288
+ {{#if account.oauth2.accessTokenInvalidated}}
289
+ {{!-- the expiry was rewound to force a renewal, so the stored end is meaningless --}}
290
+ invalidated, a new token is requested on the next connection
291
+ {{else}}
288
292
  <span class="local-date-time code-link" data-time="{{account.oauth2.expiresStr}}"
289
293
  title="{{account.oauth2.expiresStr}}"></span>
294
+ {{/if}}
290
295
  </dd>
291
296
  {{/if}}
292
297
 
@@ -946,7 +951,7 @@ submitLabel="Delete account"}}
946
951
  {{!-- no #crumb input: the layout already renders the element the script reads --}}
947
952
  <input type="hidden" id="account-id" value="{{account.account}}">
948
953
 
949
- <script>
954
+ <script nonce="{{cspNonce}}">
950
955
  document.addEventListener('DOMContentLoaded', () => {
951
956
 
952
957
  const reconnectAccount = async () => {
@@ -1340,11 +1345,14 @@ submitLabel="Delete account"}}
1340
1345
  const account = document.getElementById('account-id').value.trim();
1341
1346
 
1342
1347
  try {
1343
- await fetch(`/admin/accounts/${account}/export/${currentExportId}`, {
1348
+ // the crumb travels in the header: the route validates DELETE in restful mode
1349
+ const res = await fetch(`/admin/accounts/${account}/export/${currentExportId}`, {
1344
1350
  method: 'DELETE',
1345
- headers: { 'Content-Type': 'application/json' },
1346
- body: JSON.stringify({ crumb: document.getElementById('crumb').value })
1351
+ headers: { 'X-CSRF-Token': document.getElementById('crumb').value }
1347
1352
  });
1353
+ if (!res.ok) {
1354
+ throw new Error(`HTTP ${res.status}`);
1355
+ }
1348
1356
 
1349
1357
  stopPolling();
1350
1358
  currentExportId = null;
@@ -1357,39 +1365,8 @@ submitLabel="Delete account"}}
1357
1365
  });
1358
1366
  </script>
1359
1367
 
1360
- <script id="test-send-template" type="text/x-handlebars-template">{{{testSendTemplate}}}</script>
1361
-
1362
- <script>
1368
+ <script nonce="{{cspNonce}}">
1363
1369
  document.addEventListener('DOMContentLoaded', () => {
1364
- Handlebars.registerHelper('equals', function (compareVal, baseVal, options) {
1365
- if (baseVal == compareVal) {
1366
- return options.fn(this);
1367
- }
1368
- return options.inverse(this);
1369
- });
1370
-
1371
- Handlebars.registerHelper('inc', function (nr, inc, options) {
1372
- return Number(nr) + Number(inc);
1373
- });
1374
-
1375
- // status -> FlyonUI color/icon maps for the delivery-test results template
1376
- const STATUS_COLORS = { pass: 'success', softfail: 'warning', fail: 'error', permerror: 'info', temperror: 'info' };
1377
- Handlebars.registerHelper('statusColor', result => STATUS_COLORS[result] || 'neutral');
1378
-
1379
- Handlebars.registerHelper('statusIcon', result => {
1380
- switch (result) {
1381
- case 'pass':
1382
- return 'icon-[tabler--circle-check]';
1383
- case 'neutral':
1384
- case 'none':
1385
- return 'icon-[tabler--circle-off]';
1386
- default:
1387
- return 'icon-[tabler--alert-triangle]';
1388
- }
1389
- });
1390
-
1391
- const testSendTemplate = Handlebars.compile(document.getElementById('test-send-template').innerHTML);
1392
-
1393
1370
  let aborted = false;
1394
1371
 
1395
1372
  const createSmtpTestAccount = async (account, gateway) => {
@@ -1462,7 +1439,8 @@ submitLabel="Delete account"}}
1462
1439
  return false
1463
1440
  }
1464
1441
  document.getElementById('test-send-results').classList.remove('hidden');
1465
- document.getElementById('test-send-results').innerHTML = testSendTemplate(results);
1442
+ // rendered server-side by /admin/smtp/check-test from views/partials/test_send.hbs
1443
+ document.getElementById('test-send-results').innerHTML = results.html;
1466
1444
  }).catch(err => {
1467
1445
  if (aborted) {
1468
1446
  return false
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
  {{/ui/modal}}
28
28
 
29
- <script type="module">
29
+ <script type="module" nonce="{{cspNonce}}">
30
30
  import { EmailEngineClient } from '/static/js/ee-client.js';
31
31
 
32
32
  // Create client with UI container. The embed follows the admin theme -
@@ -36,6 +36,8 @@
36
36
  apiUrl: window.location.origin,
37
37
  account: '{{account}}',
38
38
  accessToken: '{{sessionToken}}',
39
+ // the widget appends its own stylesheet element; the admin policy accepts it with this nonce
40
+ styleNonce: '{{cspNonce}}',
39
41
  container: document.getElementById('email-client'),
40
42
  darkMode: uiEffectiveTheme() === 'dark',
41
43
  showDarkModeToggle: false,
@@ -140,7 +140,7 @@
140
140
 
141
141
  <input type="hidden" id="availablePaths" value="{{availablePaths}}">
142
142
 
143
- <script>
143
+ <script nonce="{{cspNonce}}">
144
144
  document.addEventListener('DOMContentLoaded', () => {
145
145
  let availablePaths = JSON.parse(document.getElementById('availablePaths').value);
146
146
  // native datalist suggestions for the Sent Mail folder input (the
@@ -290,7 +290,7 @@ focus ring on) the corner close button --}}
290
290
 
291
291
  <input type="hidden" id="autoTest" value="{{#if autoTest}}true{{/if}}">
292
292
 
293
- <script>
293
+ <script nonce="{{cspNonce}}">
294
294
  document.addEventListener('DOMContentLoaded', () => {
295
295
 
296
296
  let formTested = false;
@@ -311,7 +311,7 @@ defaultTestPayload='{"account":"test","path":"INBOX","subject":"test email"}'}}
311
311
 
312
312
  <input type="hidden" id="defaultPromptJson" value="{{defaultPromptJson}}">
313
313
 
314
- <script>
314
+ <script nonce="{{cspNonce}}">
315
315
  document.addEventListener('DOMContentLoaded', () => {
316
316
 
317
317
  const editorPrompt = uiAceEditor("editor-prompt", "markdown", document.getElementById('openAiPromptElement').value, {
@@ -78,10 +78,10 @@
78
78
  </form>
79
79
 
80
80
 
81
- <script src="/static/js/ace/ace.js"></script>
81
+ {{> ace_assets}}
82
82
  <script src="/static/js/ace/ext-language_tools.js"></script>
83
83
 
84
- <script>
84
+ <script nonce="{{cspNonce}}">
85
85
  document.addEventListener('DOMContentLoaded', () => {
86
86
 
87
87
  const editors = new Map();
@@ -171,7 +171,7 @@
171
171
  </form>
172
172
  {{/ui/modal}}
173
173
 
174
- <script>
174
+ <script nonce="{{cspNonce}}">
175
175
  document.addEventListener('DOMContentLoaded', () => {
176
176
 
177
177
  const sendQuestionPayload = async () => {
@@ -116,7 +116,7 @@
116
116
 
117
117
  </form>
118
118
 
119
- <script>
119
+ <script nonce="{{cspNonce}}">
120
120
  document.addEventListener('DOMContentLoaded', () => {
121
121
 
122
122
  const sendTestPayload = async () => {
@@ -140,7 +140,7 @@
140
140
 
141
141
  <input type="hidden" id="availableAddresses" value="{{availableAddresses}}">
142
142
 
143
- <script>
143
+ <script nonce="{{cspNonce}}">
144
144
  document.addEventListener('DOMContentLoaded', () => {
145
145
 
146
146
  let availableAddresses = document.getElementById('availableAddresses').value.split(',').map(e => e.trim()).filter(e => e);
@@ -122,7 +122,7 @@ submitLabel="Remove License"}}
122
122
  Remove the current license key from this EmailEngine instance?
123
123
  {{/ui/confirm-modal}}
124
124
 
125
- <script>
125
+ <script nonce="{{cspNonce}}">
126
126
  document.addEventListener('DOMContentLoaded', () => {
127
127
  let licenseTextElm = document.getElementById('licenseTextElement')
128
128
  let fileSelectElm = document.getElementById('licenseFile');
@@ -291,7 +291,7 @@
291
291
 
292
292
  </div>
293
293
 
294
- <script>
294
+ <script nonce="{{cspNonce}}">
295
295
  (() => {
296
296
  let container = document.getElementById('mcpTokenGen');
297
297
  let presets = JSON.parse(container.dataset.presets || '{}');
@@ -9,13 +9,15 @@
9
9
  <input type="hidden" name="crumb" value="{{crumb}}" />
10
10
 
11
11
  {{#> ui/card title="Proxy Settings" bodyClass="space-y-4"}}
12
- <p>Route all email server connections through a proxy. Supports HTTP CONNECT, SOCKS4, and SOCKS5.</p>
12
+ <p>Route all outbound connections through a proxy: IMAP and SMTP sessions, Gmail API and Microsoft
13
+ Graph requests, OAuth2 token exchange, webhook delivery, and EmailEngine's own requests such as
14
+ license validation. Supports HTTP CONNECT, SOCKS4, and SOCKS5.</p>
13
15
 
14
16
  <div>
15
17
  {{> ui/setting-ref name="proxyEnabled"}}
16
18
  {{> ui/checkbox id="proxy_enabled" name="proxyEnabled" label="Enable Global Proxy" class="proxy-status"
17
19
  checked=values.proxyEnabled error=errors.proxyEnabled
18
- hint="Routes all connections through the proxy below. Individual accounts can override this setting."}}
20
+ hint="Routes all outbound connections through the proxy below. Individual accounts can override it for their IMAP and SMTP connections."}}
19
21
  </div>
20
22
 
21
23
  <div>
@@ -43,14 +45,15 @@
43
45
  {{/ui/card}}
44
46
 
45
47
  {{#> ui/card title="HTTP Proxy Settings" bodyClass="space-y-4"}}
46
- <p>Route all outbound HTTP/HTTPS requests through a proxy. This applies to webhook delivery, OAuth token
47
- exchange, and API calls to Gmail/Outlook. This is separate from the IMAP/SMTP proxy above.</p>
48
+ <p>Optional. Use a different proxy for HTTP/HTTPS requests only: webhook delivery, OAuth2 token exchange,
49
+ Gmail API and Microsoft Graph calls, and license validation. When disabled, these requests use the
50
+ global proxy above.</p>
48
51
 
49
52
  <div>
50
53
  {{> ui/setting-ref name="httpProxyEnabled"}}
51
54
  {{> ui/checkbox id="http_proxy_enabled" name="httpProxyEnabled" label="Enable HTTP Proxy"
52
55
  class="http-proxy-status" checked=values.httpProxyEnabled error=errors.httpProxyEnabled
53
- hint="Routes all outbound HTTP/HTTPS requests through the proxy below."}}
56
+ hint="Routes outbound HTTP/HTTPS requests through the proxy below instead of the global proxy."}}
54
57
  </div>
55
58
 
56
59
  <div>
@@ -181,11 +184,7 @@ Remove this IP from the list? It will be re-added if found during the next scan.
181
184
  {{/ui/confirm-modal}}
182
185
 
183
186
 
184
- <script id="address-list-template" type="text/x-handlebars-template">
185
- {{{addressListTemplate}}}
186
- </script>
187
-
188
- <script>
187
+ <script nonce="{{cspNonce}}">
189
188
  document.addEventListener('DOMContentLoaded', () => {
190
189
  let reloadBtn = document.getElementById('reload-btn');
191
190
 
@@ -223,10 +222,9 @@ Remove this IP from the list? It will be re-added if found during the next scan.
223
222
 
224
223
  checkCheckboxes()
225
224
 
226
- const addressListTemplate = Handlebars.compile(document.getElementById('address-list-template').innerHTML);
227
-
228
- let redrawAddressList = data => {
229
- let html = addressListTemplate(data);
225
+ let redrawAddressList = html => {
226
+ // rendered server-side by /admin/config/network/reload from the same
227
+ // address_list partial as the initial page
230
228
  document.getElementById('address-list').innerHTML = html;
231
229
 
232
230
  for (let elm of document.querySelectorAll('#address-list .checkbox-entry')) {
@@ -250,8 +248,8 @@ Remove this IP from the list? It will be re-added if found during the next scan.
250
248
  return;
251
249
  }
252
250
 
253
- if (data.addresses) {
254
- redrawAddressList(data);
251
+ if (data.html) {
252
+ redrawAddressList(data.html);
255
253
  }
256
254
 
257
255
  }).catch(err => {
@@ -355,7 +355,7 @@ fieldName="app" fieldValue=app.id submitLabel="Delete app" submitIcon="icon-[tab
355
355
  </form>
356
356
  {{/ui/modal}}
357
357
 
358
- <script>
358
+ <script nonce="{{cspNonce}}">
359
359
  document.addEventListener('DOMContentLoaded', () => {
360
360
  document.getElementById('addServiceAccountModal').addEventListener('open.overlay', () => {
361
361
  document.getElementById('service-account-name').focus();
@@ -364,7 +364,7 @@ fieldName="app" fieldValue=app.id submitLabel="Delete app" submitIcon="icon-[tab
364
364
  </script>
365
365
  {{/if}}
366
366
 
367
- <script>
367
+ <script nonce="{{cspNonce}}">
368
368
  document.addEventListener('DOMContentLoaded', () => {
369
369
  const appId = "{{app.id}}";
370
370
  const stepsElm = document.getElementById('verify-steps');
@@ -123,7 +123,7 @@
123
123
 
124
124
  </form>
125
125
 
126
- <script>
126
+ <script nonce="{{cspNonce}}">
127
127
  document.addEventListener('DOMContentLoaded', () => {
128
128
 
129
129
  const sendCleanPayload = async () => {
@@ -144,7 +144,7 @@
144
144
 
145
145
  <input type="hidden" id="availableAddresses" value="{{availableAddresses}}">
146
146
 
147
- <script>
147
+ <script nonce="{{cspNonce}}">
148
148
  document.addEventListener('DOMContentLoaded', () => {
149
149
 
150
150
  let availableAddresses = document.getElementById('availableAddresses').value.split(',').map(e => e.trim()).filter(e => e);
@@ -266,10 +266,10 @@ class="mb-1"}}
266
266
 
267
267
  </form>
268
268
 
269
- <script src="/static/js/ace/ace.js"></script>
269
+ {{> ace_assets}}
270
270
  <script src="/static/js/ace/ext-language_tools.js"></script>
271
271
 
272
- <script>
272
+ <script nonce="{{cspNonce}}">
273
273
  document.addEventListener('DOMContentLoaded', () => {
274
274
 
275
275
  const sendTestPayload = async () => {
package/views/error.hbs CHANGED
@@ -14,9 +14,11 @@ pages, blocked access, failed form submissions without a friendlier page). --}}
14
14
  </div>
15
15
  {{/if}}
16
16
  <div class="ee-form-actions">
17
- <a href="javascript:history.back()" class="ee-btn ee-btn-neutral ee-btn-soft ee-btn-sm">
17
+ {{!-- A button rather than a javascript: link: the Content-Security-Policy on the admin
18
+ surface allows no javascript: URLs; static/js/public.js wires data-ee-back --}}
19
+ <button type="button" data-ee-back class="ee-btn ee-btn-neutral ee-btn-soft ee-btn-sm">
18
20
  <span class="ee-icon ee-icon-arrow-left"></span> {{_ "Go back" templateLocale}}
19
- </a>
21
+ </button>
20
22
  {{!-- The dashboard is an admin destination. A mailbox owner on the hosted form or a
21
23
  list recipient on an unsubscribe link has no business there, so the button only
22
24
  shows for a requester who holds an admin session, or on an instance that has no
@@ -163,7 +163,7 @@ submitLabel="Download Snapshot" submitVariant="info"}}
163
163
  Generate a memory snapshot for debugging? This may briefly affect thread performance.
164
164
  {{/ui/confirm-modal}}
165
165
 
166
- <script>
166
+ <script nonce="{{cspNonce}}">
167
167
  document.addEventListener('DOMContentLoaded', () => {
168
168
  for (let elm of document.querySelectorAll('.kill-thread-btn')) {
169
169
  elm.addEventListener('click', e => {
@@ -143,13 +143,7 @@
143
143
  <span class="bg-{{eeColor level}}/10 text-{{eeColor level}} flex size-8 shrink-0 items-center justify-center rounded-field">
144
144
  <span class="{{icon}} size-4 shrink-0"></span>
145
145
  </span>
146
- <span class="text-sm whitespace-normal">
147
- {{#if verbatim}}
148
- {{{message}}}
149
- {{else}}
150
- {{message}}
151
- {{/if}}
152
- </span>
146
+ <span class="text-sm whitespace-normal">{{message}}</span>
153
147
  </a>
154
148
  </li>
155
149
  {{/each}}
@@ -343,8 +337,6 @@
343
337
  <script src="/static/js/flyonui.js"></script>
344
338
  <script src="/static/js/ui.js"></script>
345
339
 
346
- <script src="/static/vendor/handlebars/handlebars.min-v4.7.9.js"></script>
347
-
348
340
  <script src="/static/js/highlight.min.js"></script>
349
341
 
350
342
  <script src="/static/js/app.js"></script>
@@ -360,7 +352,7 @@
360
352
  Provisioning a trial license, please wait <span class="loading loading-spinner loading-sm align-middle"></span>
361
353
  </div>
362
354
  {{/ui/modal}}
363
- <script>
355
+ <script nonce="{{cspNonce}}">
364
356
  document.addEventListener('DOMContentLoaded', () => {
365
357
  let trialBtn = document.getElementById('start-trial-btn');
366
358
  if (!trialBtn) {
@@ -400,7 +392,7 @@
400
392
 
401
393
  {{#if updateBrowserInfo}}
402
394
  <input type="hidden" id="browser-info-crumb" value="{{crumb}}" />
403
- <script>
395
+ <script nonce="{{cspNonce}}">
404
396
  document.addEventListener('DOMContentLoaded', () => {
405
397
  let sendBrowserInfo = async () => {
406
398
  let timezone = false;
@@ -115,7 +115,7 @@
115
115
  </div>
116
116
  </form>
117
117
 
118
- <script>
118
+ <script nonce="{{cspNonce}}">
119
119
  (() => {
120
120
  // The grant sentences describe the same token under each setting of the radio, so
121
121
  // whichever is showing is the one the operator is about to approve
@@ -0,0 +1,13 @@
1
+ {{!-- ACE editor assets: use this partial rather than a bare ace.js include. ACE runs in
2
+ strict-CSP mode (uiAceEnsureAssets in static/js/ui.js, which every editor goes through),
3
+ so it injects none of its own stylesheets; these are the sheets it would have injected -
4
+ the core one and the four themes uiAceThemes switches between, copied from ace-builds by
5
+ copy-static-files.sh. Linking them here rather than leaving uiAceEnsureAssets to add them
6
+ keeps the editor from painting before its stylesheet arrives. Pages that need an extension
7
+ (ext-language_tools) add it after this partial. --}}
8
+ <link rel="stylesheet" href="/static/js/ace/css/ace.css">
9
+ <link rel="stylesheet" href="/static/js/ace/css/theme/xcode.css">
10
+ <link rel="stylesheet" href="/static/js/ace/css/theme/kuroir.css">
11
+ <link rel="stylesheet" href="/static/js/ace/css/theme/tomorrow_night.css">
12
+ <link rel="stylesheet" href="/static/js/ace/css/theme/tomorrow_night_eighties.css">
13
+ <script src="/static/js/ace/ace.js"></script>
@@ -17,7 +17,7 @@
17
17
  </form>
18
18
  {{/ui/modal}}
19
19
 
20
- <script>
20
+ <script nonce="{{cspNonce}}">
21
21
  document.addEventListener('DOMContentLoaded', () => {
22
22
  let modalElm = document.getElementById('addAccount');
23
23
 
@@ -1,7 +1,7 @@
1
- {{!-- Rendered server-side on first paint AND re-compiled in the browser after
2
- an IP rescan (served via cachedTemplates.addressList, compiled with the
3
- Handlebars runtime in config/network.hbs). Keep it self-contained: no
4
- server-registered partials or helpers, plain FlyonUI markup only. --}}
1
+ {{!-- Rendered server-side on first paint AND again by POST /admin/config/network/reload
2
+ after an IP rescan (compiledFragments.addressList in lib/ui-routes/route-helpers.js,
3
+ which renders without the page's view context - so no inline scripts here, and
4
+ nothing that needs cspNonce or the locale). --}}
5
5
  {{#each addresses}}
6
6
  <tr class="hover:bg-base-200/60">
7
7
  <td>
@@ -21,7 +21,7 @@
21
21
  Render context: examplePayloadsJson, scriptEnvJson and (webhooks pages only)
22
22
  notificationTypesJson, which switches on the event-name autocompleter.
23
23
  --}}
24
- <script src="/static/js/ace/ace.js"></script>
24
+ {{> ace_assets}}
25
25
  <script src="/static/js/ace/ext-language_tools.js"></script>
26
26
 
27
27
  {{#if notificationTypesJson}}
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
  {{/ui/modal}}
52
52
 
53
- <script>
53
+ <script nonce="{{cspNonce}}">
54
54
  document.addEventListener('DOMContentLoaded', () => {
55
55
 
56
56
  let scriptEnv = JSON.parse(document.getElementById('scriptEnvJson').value);
@@ -1,5 +1,5 @@
1
1
  <input type="hidden" id="wellKnownServices" value="{{wellKnownServices}}">
2
- <script>
2
+ <script nonce="{{cspNonce}}">
3
3
  document.addEventListener('DOMContentLoaded', () => {
4
4
  let wellKnownServices = JSON.parse(document.getElementById('wellKnownServices').value);
5
5
 
@@ -983,7 +983,7 @@ open=values.skipScopes}}
983
983
 
984
984
  {{/ui/details}}
985
985
 
986
- <script>
986
+ <script nonce="{{cspNonce}}">
987
987
 
988
988
  document.addEventListener('DOMContentLoaded', () => {
989
989
 
@@ -1,4 +1,4 @@
1
- <script>
1
+ <script nonce="{{cspNonce}}">
2
2
  // Apply the theme before first paint to avoid a flash. Public-page twin of
3
3
  // theme_init.hbs with one extra source, a ?theme= query argument, so the
4
4
  // application that linked or redirected here can make these pages match its
@@ -59,9 +59,9 @@
59
59
 
60
60
  {{!-- Shared by templates/new and templates/edit: both render this exact form
61
61
  (ids included), so the ACE editor bootstrap lives here instead of per page. --}}
62
- <script src="/static/js/ace/ace.js"></script>
62
+ {{> ace_assets}}
63
63
 
64
- <script>
64
+ <script nonce="{{cspNonce}}">
65
65
  document.addEventListener('DOMContentLoaded', () => {
66
66
 
67
67
  const editors = new Map();
@@ -1,8 +1,11 @@
1
1
  {{!--
2
- Client-side rendered delivery-test results (SPF/DKIM/DMARC). This template
3
- is injected into the page as text and compiled by the browser Handlebars
4
- runtime (see accounts/account.hbs), which registers the statusColor and
5
- statusIcon helpers it relies on. Native details/summary panels - no JS.
2
+ Delivery-test results (SPF/DKIM/DMARC). Rendered on the server by
3
+ POST /admin/smtp/check-test (compiledFragments.testSend in
4
+ lib/ui-routes/route-helpers.js) and returned as the `html` field the
5
+ account page drops into the results panel. Relies on the statusColor and
6
+ statusIcon helpers from lib/handlebars-helpers.js. Rendered without the
7
+ page's view context, so no inline scripts here. Native details/summary
8
+ panels - no JS.
6
9
  --}}
7
10
  <div class="space-y-2 mb-4">
8
11
  <details class="group card border border-base-content/10">
@@ -1,4 +1,4 @@
1
- <script>
1
+ <script nonce="{{cspNonce}}">
2
2
  // Apply the stored theme before first paint to avoid a flash; when unset, the
3
3
  // stylesheet falls back to prefers-color-scheme. The "eeTheme" storage contract
4
4
  // is shared with the theme toggle in static/js/ui.js.
@@ -12,8 +12,8 @@
12
12
  summaryClass - extra/override padding classes on the summary
13
13
  (default "px-6 py-4")
14
14
  bodyClass - extra classes on the body (optional)
15
- Not usable from browser-compiled templates (test_send.hbs) - those cannot
16
- resolve server-side partials.
15
+ Usable from the fragments compiled outside vision too (test_send.hbs,
16
+ address_list.hbs): partials resolve on the shared handlebars instance.
17
17
  --}}
18
18
  <details {{#if id}}id="{{id}}" {{/if}}class="group {{#if class}}{{class}}{{else}}card bg-base-100 shadow-md{{/if}}"
19
19
  {{#if open}}open {{/if}}>
@@ -3,7 +3,7 @@
3
3
  configured target URL). --}}
4
4
  {{> filter_editor_js hasMap=true}}
5
5
 
6
- <script>
6
+ <script nonce="{{cspNonce}}">
7
7
  document.addEventListener('DOMContentLoaded', () => {
8
8
 
9
9
  const sendTestPayload = async () => {
@@ -13,7 +13,7 @@
13
13
  redirectMap is serialized by jsonForScript() in lib/api-reference/index.js, which escapes
14
14
  `<` so the literal cannot terminate this script element.
15
15
  --}}
16
- <script>
16
+ <script nonce="{{cspNonce}}">
17
17
  (() => {
18
18
  const map = {{{redirectMap}}};
19
19
  const fallback = '/admin/reference';
@@ -130,8 +130,8 @@ fieldName="template" fieldValue=template.id submitLabel="Delete template"}}
130
130
  </div>
131
131
  {{/ui/modal}}
132
132
 
133
- <script src="/static/js/ace/ace.js"></script>
134
- <script>
133
+ {{> ace_assets}}
134
+ <script nonce="{{cspNonce}}">
135
135
  document.addEventListener('DOMContentLoaded', () => {
136
136
 
137
137
  function showAlert(title, content) {
@@ -294,7 +294,7 @@
294
294
  </div>
295
295
  {{/ui/modal}}
296
296
 
297
- <script>
297
+ <script nonce="{{cspNonce}}">
298
298
  document.addEventListener('DOMContentLoaded', () => {
299
299
 
300
300
  let showTokenValueElm = document.getElementById('showTokenValue');
@@ -37,7 +37,7 @@ focus ring on) the corner close button --}}
37
37
  </div>
38
38
  </dialog>
39
39
 
40
- <script>
40
+ <script nonce="{{cspNonce}}">
41
41
  document.addEventListener('DOMContentLoaded', () => {
42
42
 
43
43
  document.getElementById('resubscribe-link').addEventListener('click', e => {
@@ -151,9 +151,9 @@ fieldName="webhook" fieldValue=webhook.id submitLabel="Delete route"}}
151
151
  <p>Are you sure you want to delete <strong>{{webhook.name}}</strong>? This action cannot be undone.</p>
152
152
  {{/ui/confirm-modal}}
153
153
 
154
- <script src="/static/js/ace/ace.js"></script>
154
+ {{> ace_assets}}
155
155
 
156
- <script>
156
+ <script nonce="{{cspNonce}}">
157
157
  document.addEventListener('DOMContentLoaded', () => {
158
158
 
159
159
  {{!-- useWorker is false, so the JSHint options machinery the editable