emailengine-app 2.79.9 → 2.80.1

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 (146) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +73 -0
  3. package/README.md +6 -0
  4. package/config/default.toml +5 -1
  5. package/data/google-crawlers.json +1 -1
  6. package/encrypt.js +43 -0
  7. package/lib/account/account-state.js +62 -0
  8. package/lib/account.js +34 -2
  9. package/lib/api-routes/account-routes.js +101 -1
  10. package/lib/api-routes/blocklist-routes.js +24 -0
  11. package/lib/api-routes/delivery-test-routes.js +6 -0
  12. package/lib/api-routes/gateway-routes.js +30 -0
  13. package/lib/api-routes/index.js +1 -1
  14. package/lib/api-routes/license-routes.js +10 -0
  15. package/lib/api-routes/mcp-oauth-routes.js +3 -3
  16. package/lib/api-routes/mcp-routes.js +39 -21
  17. package/lib/api-routes/oauth2-app-routes.js +38 -1
  18. package/lib/api-routes/outbox-routes.js +6 -0
  19. package/lib/api-routes/permission-map.js +208 -43
  20. package/lib/api-routes/pubsub-routes.js +8 -0
  21. package/lib/api-routes/route-helpers.js +58 -11
  22. package/lib/api-routes/settings-routes.js +67 -6
  23. package/lib/api-routes/stats-routes.js +6 -0
  24. package/lib/api-routes/template-routes.js +21 -0
  25. package/lib/api-routes/token-routes.js +34 -2
  26. package/lib/api-routes/webhook-route-routes.js +13 -0
  27. package/lib/autodetect-imap-settings.js +349 -47
  28. package/lib/cert-handler.js +62 -0
  29. package/lib/consts.js +50 -6
  30. package/lib/db.js +12 -0
  31. package/lib/egress-fetch.js +21 -9
  32. package/lib/email-client/base-client.js +238 -67
  33. package/lib/email-client/credential-errors.js +122 -0
  34. package/lib/email-client/gmail/gmail-api.js +2 -1
  35. package/lib/email-client/gmail-client.js +70 -64
  36. package/lib/email-client/imap/connection-errors.js +52 -0
  37. package/lib/email-client/imap/listing-diff.js +47 -6
  38. package/lib/email-client/imap/login-failure.js +52 -0
  39. package/lib/email-client/imap/mailbox.js +457 -379
  40. package/lib/email-client/imap/subconnection.js +17 -12
  41. package/lib/email-client/imap/sync-operations.js +46 -59
  42. package/lib/email-client/imap-client.js +139 -101
  43. package/lib/email-client/message-builder.js +11 -11
  44. package/lib/email-client/outlook/graph-api.js +2 -1
  45. package/lib/email-client/outlook-client.js +219 -106
  46. package/lib/enum-descriptions.js +12 -2
  47. package/lib/imap-proxy-auth.js +58 -3
  48. package/lib/imapproxy/imap-server.js +53 -62
  49. package/lib/lua/h-del-if-equals.lua +39 -0
  50. package/lib/lua/h-set-if-equals.lua +39 -0
  51. package/lib/mcp/oauth.js +46 -8
  52. package/lib/mcp/protocol.js +78 -35
  53. package/lib/mcp/tools.js +53 -17
  54. package/lib/privileged-settings.js +147 -0
  55. package/lib/routes-ui.js +4 -34
  56. package/lib/schemas.js +92 -16
  57. package/lib/security-headers.js +15 -0
  58. package/lib/settings.js +13 -0
  59. package/lib/tls/catalog.js +428 -0
  60. package/lib/tls/context.js +302 -0
  61. package/lib/tls/der.js +223 -0
  62. package/lib/tls/listeners.js +62 -0
  63. package/lib/tls/provision.js +555 -0
  64. package/lib/tls/self-signed.js +282 -0
  65. package/lib/tls/status.js +480 -0
  66. package/lib/tls/store.js +667 -0
  67. package/lib/token-permission-view.js +252 -102
  68. package/lib/token-permissions.js +176 -26
  69. package/lib/tokens.js +7 -6
  70. package/lib/tools.js +73 -27
  71. package/lib/ui-routes/account-routes.js +43 -30
  72. package/lib/ui-routes/admin-config-routes.js +63 -22
  73. package/lib/ui-routes/admin-entities-routes.js +23 -13
  74. package/lib/ui-routes/auth-routes.js +16 -1
  75. package/lib/ui-routes/internals-routes.js +3 -5
  76. package/lib/ui-routes/mcp-consent-routes.js +72 -31
  77. package/lib/ui-routes/network-config-routes.js +54 -45
  78. package/lib/ui-routes/tls-config-routes.js +628 -0
  79. package/lib/utils/mailbox-path.js +51 -0
  80. package/lib/utils/severity.js +31 -0
  81. package/package.json +12 -12
  82. package/sbom.json +1 -1
  83. package/server.js +23 -1
  84. package/static/css/flyonui.css +1 -1
  85. package/static/css/src/app.tailwind.css +11 -0
  86. package/static/js/app.js +34 -0
  87. package/static/js/public.js +6 -2
  88. package/static/js/ui.js +97 -61
  89. package/static/licenses.html +341 -1252
  90. package/translations/messages.pot +62 -56
  91. package/views/account/login-redirect.hbs +22 -0
  92. package/views/account/passkeys.hbs +2 -2
  93. package/views/accounts/account.hbs +2 -2
  94. package/views/accounts/browse.hbs +1 -1
  95. package/views/accounts/edit.hbs +1 -1
  96. package/views/accounts/register/imap-server.hbs +1 -1
  97. package/views/config/ai.hbs +1 -1
  98. package/views/config/branding.hbs +2 -2
  99. package/views/config/document-store/chat.hbs +1 -1
  100. package/views/config/document-store/index.hbs +1 -1
  101. package/views/config/imap-proxy.hbs +1 -4
  102. package/views/config/license.hbs +1 -1
  103. package/views/config/mcp.hbs +88 -52
  104. package/views/config/network.hbs +1 -1
  105. package/views/config/oauth/app.hbs +2 -2
  106. package/views/config/service.hbs +1 -1
  107. package/views/config/smtp.hbs +1 -4
  108. package/views/config/tls-upload.hbs +81 -0
  109. package/views/config/tls.hbs +593 -0
  110. package/views/config/webhooks.hbs +2 -2
  111. package/views/internals/index.hbs +1 -1
  112. package/views/layout/app.hbs +6 -6
  113. package/views/layout/login.hbs +5 -5
  114. package/views/layout/main.hbs +2 -2
  115. package/views/layout/prompt.hbs +3 -3
  116. package/views/layout/public.hbs +1 -1
  117. package/views/mcp/authorize.hbs +47 -45
  118. package/views/partials/ace_assets.hbs +1 -1
  119. package/views/partials/add_account_modal.hbs +1 -1
  120. package/views/partials/filter_editor_js.hbs +2 -2
  121. package/views/partials/gateway_js.hbs +1 -1
  122. package/views/partials/mcp_access_levels.hbs +16 -9
  123. package/views/partials/mcp_tool_count.hbs +15 -14
  124. package/views/partials/oauth_form.hbs +1 -1
  125. package/views/partials/public_theme_init.hbs +1 -1
  126. package/views/partials/side_menu.hbs +1 -0
  127. package/views/partials/template_form.hbs +1 -1
  128. package/views/partials/theme_init.hbs +1 -1
  129. package/views/partials/tls_security_card.hbs +25 -53
  130. package/views/partials/ui/alert-banner.hbs +3 -2
  131. package/views/partials/ui/badge.hbs +6 -2
  132. package/views/partials/ui/btn.hbs +5 -2
  133. package/views/partials/webhooks_editor_functions.hbs +1 -1
  134. package/views/reference/index.hbs +1 -1
  135. package/views/reference/redirect.hbs +1 -1
  136. package/views/reference/tag.hbs +1 -1
  137. package/views/reference/token.hbs +1 -1
  138. package/views/templates/template.hbs +1 -1
  139. package/views/tokens/new.hbs +175 -74
  140. package/views/unsubscribe.hbs +1 -1
  141. package/views/webhooks/webhook.hbs +1 -1
  142. package/workers/api.js +102 -142
  143. package/workers/imap-proxy.js +4 -1
  144. package/workers/smtp.js +51 -44
  145. package/views/partials/tls_security_js.hbs +0 -64
  146. package/views/partials/tls_security_modal.hbs +0 -22
@@ -46,14 +46,14 @@
46
46
 
47
47
  </div>
48
48
 
49
- <script src="/static/js/flyonui.js"></script>
50
- <script src="/static/js/ui.js"></script>
49
+ <script data-cfasync="false" src="/static/js/flyonui.js"></script>
50
+ <script data-cfasync="false" src="/static/js/ui.js"></script>
51
51
 
52
- <script src="/static/js/app.js"></script>
52
+ <script data-cfasync="false" src="/static/js/app.js"></script>
53
53
 
54
54
  {{#if passkeysAvailable}}
55
- <script src="/static/vendor/simplewebauthn/browser.min.js"></script>
56
- <script src="/static/js/login-passkey.js"></script>
55
+ <script data-cfasync="false" src="/static/vendor/simplewebauthn/browser.min.js"></script>
56
+ <script data-cfasync="false" src="/static/js/login-passkey.js"></script>
57
57
  {{/if}}
58
58
 
59
59
  </body>
@@ -44,8 +44,8 @@
44
44
  </div>
45
45
  </footer>
46
46
 
47
- <script src="/static/js/flyonui.js"></script>
48
- <script src="/static/js/ui.js"></script>
47
+ <script data-cfasync="false" src="/static/js/flyonui.js"></script>
48
+ <script data-cfasync="false" src="/static/js/ui.js"></script>
49
49
  </body>
50
50
 
51
51
  </html>
@@ -52,10 +52,10 @@
52
52
 
53
53
  </div>
54
54
 
55
- <script src="/static/js/flyonui.js"></script>
56
- <script src="/static/js/ui.js"></script>
55
+ <script data-cfasync="false" src="/static/js/flyonui.js"></script>
56
+ <script data-cfasync="false" src="/static/js/ui.js"></script>
57
57
 
58
- <script src="/static/js/app.js"></script>
58
+ <script data-cfasync="false" src="/static/js/app.js"></script>
59
59
 
60
60
  </body>
61
61
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  </main>
58
58
 
59
- <script src="/static/js/public.js"></script>
59
+ <script data-cfasync="false" src="/static/js/public.js"></script>
60
60
 
61
61
  </body>
62
62
 
@@ -25,8 +25,9 @@
25
25
  the one MCP surface a person can reach without passing one of those first, so it is
26
26
  also the one where the label would otherwise be missing. --}}
27
27
  {{> ui/badge label="Beta" variant="info" soft=true class="badge-sm align-middle"}}</h1>
28
- <p class="text-base-content/60 mt-2 text-sm">An MCP client is asking for access to the email accounts on this
29
- EmailEngine instance. Once you decide, the browser returns to <code>{{redirectHost}}</code>.</p>
28
+ <p class="text-base-content/60 mt-2 text-sm">An MCP client is asking for access to this EmailEngine instance. Decide
29
+ what it may manage and whether it may read mail; once you decide, the browser returns to
30
+ <code>{{redirectHost}}</code>.</p>
30
31
  </div>
31
32
 
32
33
  {{#unless canProvision}}
@@ -46,40 +47,38 @@
46
47
  <input type="hidden" name="code_challenge" value="{{values.code_challenge}}" />
47
48
  <input type="hidden" name="resource" value="{{values.resource}}" />
48
49
 
49
- <div class="space-y-4">
50
-
50
+ <div class="space-y-5">
51
+
52
+ {{!-- One block per section, in table order: management first, because it is what the
53
+ endpoint is for by default, then mail, declined unless the person or the client's
54
+ scope request said otherwise. The radio group of a section is named after its key,
55
+ which is the field the route reads and what ui.js reads the selection back from.
56
+ Under each group, one grant sentence per level, generated from the table rather than
57
+ written per level: the grant word lists come from the surface tables the enforcement
58
+ reads (never written out here), so this screen cannot promise less than the token
59
+ grants after the tool set changes, and the caveat travels with the level it
60
+ describes. One is visible at a time - the one describing the selected level. --}}
61
+ {{#each mcpSections}}
51
62
  <fieldset class="space-y-2">
52
- <legend class="label-text mb-1">Access level</legend>
53
- {{> mcp_access_levels name="access" idPrefix="access" selected=accessLevel}}
63
+ <legend class="label-text mb-1">{{label}}</legend>
64
+ {{> mcp_access_levels section=this name=@key idPrefix=@key selected=(lookup ../selectedLevels @key) includeNone=true}}
54
65
  </fieldset>
55
66
 
56
- {{!-- The grant word lists come from MCP_GRANT_WORDING (derived from SURFACE_GRANTS.mcp,
57
- never written out here), so this screen cannot promise less than the token grants
58
- after the tool set changes. The framing prose around them is bespoke per level - a
59
- level added to MCP_ACCESS_LEVELS needs its own alert block here. One is visible at
60
- a time - the one describing the selected access level. --}}
61
- <div data-access="read" class="consent-grant alert alert-soft alert-info text-sm{{#equals accessLevel 'read'}}{{else}} hidden{{/equals}}">
62
- <span class="icon-[tabler--info-circle] size-5 shrink-0"></span>
63
- <span>Through the MCP tool set the client will be able to <strong>{{grantWording.read.actions}}</strong>
64
- {{grantWording.read.groups}} on the accounts its token can reach. It cannot send email, delete anything,
65
- change anything, read stored credentials, or change instance settings.</span>
66
- </div>
67
-
68
- <div data-access="mail" class="consent-grant alert alert-soft alert-warning text-sm{{#equals accessLevel 'mail'}}{{else}} hidden{{/equals}}">
69
- <span class="icon-[tabler--alert-triangle] size-5 shrink-0"></span>
70
- <span>Through the MCP tool set the client will be able to <strong>{{grantWording.mail.actions}}</strong>
71
- across {{grantWording.mail.groups}} on the accounts its token can reach - everything except the delete
72
- tool. Instructions inside received mail are a real prompt-injection risk once sending is granted. It
73
- cannot read stored credentials or change instance settings.</span>
67
+ {{#each levels}}
68
+ <div data-section="{{@../key}}" data-level="{{value}}"
69
+ class="consent-grant alert alert-soft alert-{{variant}} text-sm{{#equals (lookup ../../selectedLevels @../key) value}}{{else}} hidden{{/equals}}">
70
+ <span class="{{#equals variant 'info'}}icon-[tabler--info-circle]{{else}}icon-[tabler--alert-triangle]{{/equals}} size-5 shrink-0"></span>
71
+ <span>{{../lead}} <strong>{{actions}}</strong> across {{groups}}. {{caveat}}</span>
74
72
  </div>
73
+ {{/each}}
74
+ {{/each}}
75
75
 
76
- <div data-access="full" class="consent-grant alert alert-soft alert-warning text-sm{{#equals accessLevel 'full'}}{{else}} hidden{{/equals}}">
77
- <span class="icon-[tabler--alert-triangle] size-5 shrink-0"></span>
78
- <span>Through the MCP tool set the client will be able to <strong>{{grantWording.full.actions}}</strong>
79
- across {{grantWording.full.groups}} on the accounts its token can reach. Instructions inside received
80
- mail are a real prompt-injection risk once sending is granted. It cannot read stored credentials or
81
- change instance settings.</span>
76
+ {{#if errors.access}}
77
+ <div class="alert alert-soft alert-error text-sm">
78
+ <span class="icon-[tabler--alert-circle] size-5 shrink-0"></span>
79
+ <span>{{errors.access}}</span>
82
80
  </div>
81
+ {{/if}}
83
82
 
84
83
  <div>
85
84
  {{> mcp_account_limit id="account" value=values.account selected=selectedAccount error=errors.account}}
@@ -88,8 +87,9 @@
88
87
  {{!-- The grant sentences above say what a level allows in the permission vocabulary; this
89
88
  says which tools the client ends up holding, which is closer to the thing being
90
89
  approved. Follows the account field too, because limiting the client to one account
91
- takes the instance-wide tools away from it. --}}
92
- {{> mcp_tool_count id="consentToolCount" levelName="access" accountId="account"}}
90
+ takes the instance-wide tools away from it - what is left of a management grant is
91
+ then the tools that operate that one account. --}}
92
+ {{> mcp_tool_count id="consentToolCount" autoWire=true levelPrefix="" accountId="account"}}
93
93
 
94
94
  <div class="flex gap-3 pt-2">
95
95
  <button type="submit" name="decision" value="deny" class="btn btn-neutral btn-outline grow">
@@ -108,29 +108,31 @@
108
108
  TTL, so an approved client holds its token until someone takes it away. Said here
109
109
  because this is the screen where the decision is made, and the person making it has
110
110
  no other place to learn it. --}}
111
- <p class="text-base-content/60 text-center text-xs">Approving creates an access token with the <code>mcp</code>
112
- scope. It does not expire - it appears on the <a href="/admin/tokens?scope=mcp" class="link">Access
113
- Tokens</a> page and stays valid until you revoke it there.</p>
111
+ <p class="text-base-content/60 text-center text-xs">Approving creates an access token with the MCP scopes you
112
+ chose (<code>mcp-manage</code> for the instance, <code>mcp</code> for mail) and exactly the grants shown
113
+ above. It does not expire - it appears on the <a href="/admin/tokens?scope=mcp-manage&amp;scope=mcp"
114
+ class="link">Access Tokens</a> page and stays valid until you revoke it there.</p>
114
115
 
115
116
  </div>
116
117
  </form>
117
118
 
118
- <script nonce="{{cspNonce}}">
119
- (() => {
120
- // The grant sentences describe the same token under each setting of the radio, so
121
- // whichever is showing is the one the operator is about to approve
122
- let radios = Array.from(document.querySelectorAll('input[name="access"]'));
119
+ <script data-cfasync="false" nonce="{{cspNonce}}">
120
+ // The grant sentences describe the same token under each setting of the radios, so whichever
121
+ // are showing are the ones the operator is about to approve. The tool count is wired by ui.js
122
+ // off the count element's data attributes; this only follows the alerts. On DOMContentLoaded
123
+ // because the prompt layout loads ui.js after the page body, and the helper lives there.
124
+ document.addEventListener('DOMContentLoaded', () => {
125
+ let sections = JSON.parse(document.getElementById('consentToolCount').dataset.mcpSections || '{}');
123
126
  let grants = Array.from(document.querySelectorAll('.consent-grant'));
124
127
 
125
128
  let sync = () => {
126
- let selected = radios.find(radio => radio.checked);
127
- let access = (selected && selected.value) || 'read';
128
- grants.forEach(grant => grant.classList.toggle('hidden', grant.dataset.access !== access));
129
+ let choice = uiMcpLevelChoice(sections, '');
130
+ grants.forEach(grant => grant.classList.toggle('hidden', grant.dataset.level !== choice[grant.dataset.section]));
129
131
  };
130
132
 
131
- radios.forEach(radio => radio.addEventListener('change', sync));
133
+ document.querySelectorAll('input[type="radio"]').forEach(radio => radio.addEventListener('change', sync));
132
134
  sync();
133
- })();
135
+ });
134
136
  </script>
135
137
 
136
138
  {{/if}}
@@ -10,4 +10,4 @@
10
10
  <link rel="stylesheet" href="/static/js/ace/css/theme/kuroir.css">
11
11
  <link rel="stylesheet" href="/static/js/ace/css/theme/tomorrow_night.css">
12
12
  <link rel="stylesheet" href="/static/js/ace/css/theme/tomorrow_night_eighties.css">
13
- <script src="/static/js/ace/ace.js"></script>
13
+ <script data-cfasync="false" src="/static/js/ace/ace.js"></script>
@@ -17,7 +17,7 @@
17
17
  </form>
18
18
  {{/ui/modal}}
19
19
 
20
- <script nonce="{{cspNonce}}">
20
+ <script data-cfasync="false" nonce="{{cspNonce}}">
21
21
  document.addEventListener('DOMContentLoaded', () => {
22
22
  let modalElm = document.getElementById('addAccount');
23
23
 
@@ -22,7 +22,7 @@
22
22
  notificationTypesJson, which switches on the event-name autocompleter.
23
23
  --}}
24
24
  {{> ace_assets}}
25
- <script src="/static/js/ace/ext-language_tools.js"></script>
25
+ <script data-cfasync="false" src="/static/js/ace/ext-language_tools.js"></script>
26
26
 
27
27
  {{#if notificationTypesJson}}
28
28
  <input type="hidden" id="notificationTypesJson" value="{{notificationTypesJson}}">
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
  {{/ui/modal}}
52
52
 
53
- <script nonce="{{cspNonce}}">
53
+ <script data-cfasync="false" 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 nonce="{{cspNonce}}">
2
+ <script data-cfasync="false" nonce="{{cspNonce}}">
3
3
  document.addEventListener('DOMContentLoaded', () => {
4
4
  let wellKnownServices = JSON.parse(document.getElementById('wellKnownServices').value);
5
5
 
@@ -1,13 +1,20 @@
1
1
  {{!--
2
- The MCP access-level radio group, rendered identically by the OAuth consent prompt and the
3
- admin token generator so the two cannot drift on what each level promises. The options come
4
- from MCP_ACCESS_LEVEL_OPTIONS (lib/token-permission-view.js) through the accessOptions
5
- context value.
2
+ The radio group of one MCP access section (instance management or email access), rendered
3
+ identically by the OAuth consent prompt, the MCP config page's generator and the token form
4
+ so the three cannot drift on what each level promises. The options come from MCP_SECTIONS
5
+ (lib/token-permission-view.js), which also carries the pair list each level mints.
6
6
  Params:
7
- name - input name shared by the radio group (required)
8
- idPrefix - per-page prefix for the input ids (required)
9
- selected - the selected value (required; pass "read" for the static default)
7
+ section - the section object from MCP_SECTIONS (required)
8
+ name - input name shared by the radio group (required; the pages name it
9
+ <prefix><section key>, which is what static/js/ui.js reads back)
10
+ idPrefix - per-page prefix for the input ids; ids are <idPrefix>_<level> (required)
11
+ selected - the selected level (required)
12
+ includeNone - true to offer the section's decline option first (the consent prompt and the
13
+ generator; the token form declines a section by leaving its scope unticked)
10
14
  --}}
11
- {{#each accessOptions}}
12
- {{> ui/radio id=(concat ../idPrefix value) name=../name value=value label=label selected=../selected hint=hint}}
15
+ {{#if includeNone}}
16
+ {{> ui/radio id=(concat idPrefix "_none") name=name value="none" label=section.none.label selected=selected hint=section.none.hint}}
17
+ {{/if}}
18
+ {{#each section.levels}}
19
+ {{> ui/radio id=(concat ../idPrefix "_" value) name=../name value=value label=label selected=../selected hint=hint}}
13
20
  {{/each}}
@@ -1,19 +1,20 @@
1
1
  {{!--
2
- The "N of M MCP tools available" line, shown by every page that mints an mcp-scoped token so
3
- the three cannot disagree about what a credential will actually be offered. The counting rule
4
- is uiMcpToolCount() in static/js/ui.js - the browser's copy of toolVisibleTo(), pinned to it by
5
- test/mcp-tools-test.js. Reads mcpTools (and mcpAccessPresets, when auto-wired) from the
6
- page context.
2
+ The "N of M MCP tools available" line, shown by every page that mints an MCP token so the
3
+ three cannot disagree about what a credential will actually be offered. The counting rule is
4
+ uiMcpToolCount() in static/js/ui.js - the browser's copy of toolVisibleTo(), pinned to it by
5
+ test/mcp-tools-test.js. Reads mcpTools (and mcpSections, when auto-wired) from the page
6
+ context.
7
7
 
8
- Pass levelName to have ui.js drive the count from a named access level (the MCP config
9
- generator and the consent prompt); leave it out and the page repaints the element itself,
10
- which is what the access-token form does for its custom-permissions option.
8
+ Pass levelPrefix to have ui.js drive the count from the section radio groups named
9
+ <levelPrefix><section key> (the MCP config generator and the consent prompt); leave it out
10
+ and the page repaints the element itself, which is what the access-token form does.
11
11
  Params:
12
- id - element id (required; the page's own script needs it, and so does nothing else)
13
- levelName - the radio group name to follow, for the auto-wired pages (optional)
14
- accountId - id of the "limit to one account" field to follow (optional, with levelName)
15
- class - extra classes on the wrapper (optional)
12
+ id - element id (required; the page's own script needs it, and so does nothing else)
13
+ autoWire - true to let ui.js drive the count (optional)
14
+ levelPrefix - the radio group name prefix, with autoWire; may be empty (optional)
15
+ accountId - id of the "limit to one account" field to follow, with autoWire (optional)
16
+ class - extra classes on the wrapper (optional)
16
17
  --}}
17
18
  <div id="{{id}}" class="text-sm space-y-1{{#if class}} {{class}}{{/if}}" data-mcp-tools="{{json mcpTools}}"
18
- {{#if levelName}}data-mcp-level-name="{{levelName}}" data-mcp-account-id="{{accountId}}"
19
- data-mcp-presets="{{json mcpAccessPresets}}"{{/if}}></div>
19
+ {{#if autoWire}}data-mcp-auto-wire="1" data-mcp-level-prefix="{{levelPrefix}}" data-mcp-account-id="{{accountId}}"
20
+ data-mcp-sections="{{json mcpSections}}"{{/if}}></div>
@@ -983,7 +983,7 @@ open=values.skipScopes}}
983
983
 
984
984
  {{/ui/details}}
985
985
 
986
- <script nonce="{{cspNonce}}">
986
+ <script data-cfasync="false" nonce="{{cspNonce}}">
987
987
 
988
988
  document.addEventListener('DOMContentLoaded', () => {
989
989
 
@@ -1,4 +1,4 @@
1
- <script nonce="{{cspNonce}}">
1
+ <script data-cfasync="false" 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
@@ -29,6 +29,7 @@
29
29
  {{> ui/menu-item href="/admin/config/ai" label="AI Processing" active=menuConfigAi}}
30
30
  {{> ui/menu-item href="/admin/config/mcp" label="MCP" badge="Beta" active=menuConfigMcp}}
31
31
  {{> ui/menu-item href="/admin/config/network" label="Network" active=menuConfigNetwork}}
32
+ {{> ui/menu-item href="/admin/config/tls" label="TLS Certificates" active=menuConfigTls}}
32
33
  {{> ui/menu-item href="/admin/config/smtp" label="SMTP Server" active=menuConfigSmtp}}
33
34
  {{> ui/menu-item href="/admin/config/imap-proxy" label="IMAP Proxy" active=menuConfigImapProxy}}
34
35
  {{> ui/menu-item href="/admin/config/branding" label="Branding" active=menuConfigBranding}}
@@ -61,7 +61,7 @@
61
61
  (ids included), so the ACE editor bootstrap lives here instead of per page. --}}
62
62
  {{> ace_assets}}
63
63
 
64
- <script nonce="{{cspNonce}}">
64
+ <script data-cfasync="false" nonce="{{cspNonce}}">
65
65
  document.addEventListener('DOMContentLoaded', () => {
66
66
 
67
67
  const editors = new Map();
@@ -1,4 +1,4 @@
1
- <script nonce="{{cspNonce}}">
1
+ <script data-cfasync="false" 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.
@@ -1,6 +1,13 @@
1
1
  {{!-- Security (TLS) card shared by the SMTP and IMAP proxy config pages.
2
- Renders inside the settings form; pair with tls_security_modal (after
3
- the form) and tls_security_js (inside the page script).
2
+ The checkbox decides whether this listener speaks TLS; which certificate
3
+ it serves is decided on /admin/config/tls and only summarized here.
4
+
5
+ It used to do both. Ticking it fired an ACME order in the foreground,
6
+ before the setting had been saved, and unticked itself when the order
7
+ failed - so the page stopped matching the stored setting, and the reason
8
+ was never shown. The listener now always has a certificate to start with
9
+ (a self-signed one if nothing better exists), which is what lets this be
10
+ an ordinary checkbox again.
4
11
  Params:
5
12
  field - the TLS-enabled setting name, also the checkbox id/name
6
13
  (smtpServerTLSEnabled / imapProxyServerTLSEnabled) --}}
@@ -12,65 +19,30 @@
12
19
  <div>
13
20
  {{> ui/setting-ref name=field}}
14
21
 
15
- {{!-- hand-rolled checkbox: the label carries the #tls-label
16
- badge whose badge-{type} class and tooltip body are
17
- repainted by paintCertData() from ui.js. Certificates can
18
- only be provisioned for a real domain (serviceDomain is
19
- false when the Service URL is unset, an IP or localhost),
20
- so without one the checkbox is disabled - except when TLS
21
- is already on, so it can still be turned off. --}}
22
22
  <div class="flex items-center gap-2">
23
- <input type="checkbox"
24
- class="checkbox checkbox-sm trigger-example-render{{#if (lookup errors field)}} is-invalid{{/if}}"
25
- id="{{field}}" {{#if certificateData}}data-certificate="{{certificateData.fingerprint}}" {{/if}}
26
- {{#if serviceDomain}}data-domain="{{serviceDomain}}" {{/if}}name="{{field}}" {{#if (lookup values
27
- field)}}checked{{/if}}
28
- {{#unless serviceDomain}}{{#unless (lookup values field)}}disabled{{/unless}}{{/unless}} />
23
+ {{> ui/checkbox id=field name=field label="Enable TLS Encryption" class="trigger-example-render"
24
+ checked=(lookup values field) error=(lookup errors field)}}
29
25
 
30
- <label class="label-text p-0" for="{{field}}">Enable TLS Encryption
31
-
32
- {{#if certificateData.label}}
33
- {{#> ui/tooltip text=certificateData.label.title}}
34
- <span id="tls-label" class="badge badge-{{eeColor certificateData.label.type}}"
35
- data-labeltype="{{certificateData.label.type}}">{{certificateData.label.text}}</span>
36
- {{/ui/tooltip}}
37
- {{/if}}
38
-
39
- </label>
26
+ {{#if tlsSummary.label}}
27
+ {{#> ui/tooltip text=tlsSummary.label.title}}
28
+ {{> ui/badge label=tlsSummary.label.text variant=tlsSummary.label.type elId="tls-label"}}
29
+ {{/ui/tooltip}}
30
+ {{/if}}
40
31
  </div>
41
32
 
42
- {{#if (lookup errors field)}}
43
- <span class="helper-text text-error">{{lookup errors field}}</span>
44
- {{/if}}
45
-
46
33
  <span class="helper-text">
47
- {{#if serviceDomain}}
48
-
49
- Certificates will be provisioned for <em>{{serviceDomain}}</em>. Change the domain in <a
50
- href="/admin/config/service#settingsServiceUrl" class="link link-animated">Service URL
51
- settings</a>.
52
-
34
+ {{#if tlsSummary.hostname}}
35
+ Clients connect to <em>{{tlsSummary.hostname}}</em>, which is served with
36
+ {{#if tlsSummary.certificate}}a {{tlsSummary.certificate.sourceLabel}} certificate{{else}}no
37
+ certificate yet{{/if}}. Manage certificates on the <a href="/admin/config/tls"
38
+ class="link link-animated">TLS Certificates</a> page.
53
39
  {{else}}
54
-
55
- Set a domain name in <a href="/admin/config/service#settingsServiceUrl"
56
- class="link link-animated">Service URL settings</a> to enable automatic TLS certificates.
57
-
40
+ No hostname is configured, so this listener serves a self-signed certificate. Set a <a
41
+ href="/admin/config/service#settingsServiceUrl" class="link link-animated">Service URL</a> and
42
+ manage certificates on the <a href="/admin/config/tls" class="link link-animated">TLS
43
+ Certificates</a> page.
58
44
  {{/if}}
59
-
60
45
  </span>
61
46
  </div>
62
-
63
47
  </div>
64
-
65
- {{#if serviceDomain}}
66
- <div class="card-footer border-base-content/10 border-t px-6 py-4">
67
- <small class="text-base-content/60">
68
- <span class="icon-[tabler--info-circle] size-4 align-text-bottom"></span>
69
- EmailEngine must be publicly accessible at <em><a href="{{serviceUrl}}" target="_blank"
70
- rel="noopener noreferrer" class="link link-animated">{{serviceUrl}}</a></em> for automatic
71
- certificates. Otherwise, a self-signed certificate will be used.
72
- </small>
73
- </div>
74
- {{/if}}
75
-
76
48
  </div>
@@ -11,13 +11,14 @@
11
11
  variant - error|warning|info|success (default error); sets alert-<variant>
12
12
  title - bold heading text (optional)
13
13
  icon - override the leading icon (default icon-[tabler--alert-triangle])
14
+ class - extra classes, e.g. "mb-4" to override the default page-level spacing (optional)
14
15
  --}}
15
- <div class="alert alert-soft alert-{{#if variant}}{{variant}}{{else}}error{{/if}} mb-6 flex items-start gap-3"
16
+ <div class="alert alert-soft alert-{{#if variant}}{{variant}}{{else}}error{{/if}}{{#unless class}} mb-6{{/unless}} flex items-start gap-3{{#if class}} {{class}}{{/if}}"
16
17
  role="alert">
17
18
  <span class="{{#if icon}}{{icon}}{{else}}icon-[tabler--alert-triangle]{{/if}} size-5 shrink-0"></span>
18
19
  <div class="min-w-0">
19
20
  {{#if title}}<div class="font-semibold">{{title}}</div>{{/if}}
20
21
  {{!-- body content; own hash params neutralized so they do not fall through into nested ui/* calls --}}
21
- {{> @partial-block variant="" title="" icon=""}}
22
+ {{> @partial-block variant="" title="" icon="" class=""}}
22
23
  </div>
23
24
  </div>
@@ -9,9 +9,13 @@
9
9
  elId - element id (optional). NOT named `id`: Handlebars merges hash params
10
10
  into the caller's context, so a partial reading `id` also inherits one
11
11
  that merely happens to be in scope - a row's id inside {{#each}}
12
+ title - native tooltip text, for a badge whose one word needs a sentence
13
+ behind it (optional)
14
+ dataName/dataValue - one data-* attribute, e.g. dataName="cert-badge", for a
15
+ page script that repaints this badge later (optional)
12
16
  class - extra classes, e.g. "state-info" hooks (optional)
13
17
  --}}
14
- <span {{#if elId}}id="{{elId}}" {{/if}}class="badge badge-{{eeColor variant}}{{#if soft}} badge-soft{{/if}}{{#if class}} {{class}}{{/if}}">
18
+ <span {{#if elId}}id="{{elId}}" {{/if}}{{#if title}}title="{{title}}" {{/if}}{{#if dataName}}data-{{dataName}}="{{dataValue}}" {{/if}}class="badge badge-{{eeColor variant}}{{#if soft}} badge-soft{{/if}}{{#if class}} {{class}}{{/if}}">
15
19
  {{~#if icon}}<span class="{{icon}} size-3.5 shrink-0"></span>{{/if~}}
16
- {{~#if label includeZero=true}}{{label}}{{else if @partial-block}}{{> @partial-block label="" variant="" soft="" icon="" id="" class=""}}{{/if~}}
20
+ {{~#if label includeZero=true}}{{label}}{{else if @partial-block}}{{> @partial-block label="" variant="" soft="" icon="" id="" elId="" title="" dataName="" dataValue="" class=""}}{{/if~}}
17
21
  </span>
@@ -18,6 +18,9 @@
18
18
  id - element id (optional)
19
19
  class - extra classes (optional)
20
20
  overlay - value for data-overlay to open/close a ui/modal (optional)
21
+ dataName/dataValue - one data-* attribute, e.g. dataName="file-target", for a
22
+ delegated handler that reads it (optional). Pass literals only: the
23
+ attribute name is interpolated unescaped, so it must never come from data
21
24
  disabled - truthy to render the button disabled. Also adds pointer-events-none,
22
25
  because a disabled control dispatches no mouse events and a wrapping
23
26
  {{#> ui/tooltip}} would never see the hover that is meant to explain
@@ -32,7 +35,7 @@ btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unles
32
35
  {{#if icon}}<span class="{{icon}} size-4 shrink-0"></span>{{/if}}{{label}}
33
36
  {{~/inline}}
34
37
  {{#if href}}
35
- <a href="{{href}}" {{#if id}}id="{{id}}" {{/if}}{{#if external}}target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" {{/if}}class="{{> btnClasses}}">{{> btnContent}}</a>
38
+ <a href="{{href}}" {{#if id}}id="{{id}}" {{/if}}{{#if dataName}}data-{{dataName}}="{{dataValue}}" {{/if}}{{#if external}}target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" {{/if}}class="{{> btnClasses}}">{{> btnContent}}</a>
36
39
  {{else}}
37
- <button type="{{#if type}}{{type}}{{else}}button{{/if}}" {{#if id}}id="{{id}}" {{/if}}{{#if overlay}}data-overlay="{{overlay}}" {{/if}}{{#if disabled}}disabled {{/if}}class="{{> btnClasses}}">{{> btnContent}}</button>
40
+ <button type="{{#if type}}{{type}}{{else}}button{{/if}}" {{#if id}}id="{{id}}" {{/if}}{{#if overlay}}data-overlay="{{overlay}}" {{/if}}{{#if dataName}}data-{{dataName}}="{{dataValue}}" {{/if}}{{#if disabled}}disabled {{/if}}class="{{> btnClasses}}">{{> btnContent}}</button>
38
41
  {{/if}}
@@ -3,7 +3,7 @@
3
3
  configured target URL). --}}
4
4
  {{> filter_editor_js hasMap=true}}
5
5
 
6
- <script nonce="{{cspNonce}}">
6
+ <script data-cfasync="false" nonce="{{cspNonce}}">
7
7
  document.addEventListener('DOMContentLoaded', () => {
8
8
 
9
9
  const sendTestPayload = async () => {
@@ -73,4 +73,4 @@ subtitle="Every EmailEngine REST endpoint, generated from the same schemas the A
73
73
  </div>
74
74
 
75
75
  {{!-- deferred highlighting, sidebar filter and try-it runner; the page content itself is server-rendered --}}
76
- <script src="/static/js/reference.js" defer></script>
76
+ <script data-cfasync="false" src="/static/js/reference.js" defer></script>
@@ -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 nonce="{{cspNonce}}">
16
+ <script data-cfasync="false" nonce="{{cspNonce}}">
17
17
  (() => {
18
18
  const map = {{{redirectMap}}};
19
19
  const fallback = '/admin/reference';
@@ -25,4 +25,4 @@
25
25
  {{/each}}
26
26
 
27
27
  {{!-- deferred highlighting, sidebar filter and try-it runner; the page content itself is server-rendered --}}
28
- <script src="/static/js/reference.js" defer></script>
28
+ <script data-cfasync="false" src="/static/js/reference.js" defer></script>
@@ -50,4 +50,4 @@ subtitle="Enables the Try it panels on the endpoint pages."}}
50
50
  {{/ui/card}}
51
51
 
52
52
  {{!-- deferred highlighting, sidebar filter and try-it runner; the page content itself is server-rendered --}}
53
- <script src="/static/js/reference.js" defer></script>
53
+ <script data-cfasync="false" src="/static/js/reference.js" defer></script>
@@ -131,7 +131,7 @@ fieldName="template" fieldValue=template.id submitLabel="Delete template"}}
131
131
  {{/ui/modal}}
132
132
 
133
133
  {{> ace_assets}}
134
- <script nonce="{{cspNonce}}">
134
+ <script data-cfasync="false" nonce="{{cspNonce}}">
135
135
  document.addEventListener('DOMContentLoaded', () => {
136
136
 
137
137
  function showAlert(title, content) {