@wtfalch/email 0.19.1 → 0.19.2
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/dist/postmaster/org-mail.js +17 -0
- package/package.json +1 -1
|
@@ -185,6 +185,7 @@ export async function applyOrgMail(client, org, options) {
|
|
|
185
185
|
else {
|
|
186
186
|
id = await client.create('Domain', value);
|
|
187
187
|
}
|
|
188
|
+
await repairRoute(client);
|
|
188
189
|
const [wire] = await client.get('Domain', [id]);
|
|
189
190
|
const records = [
|
|
190
191
|
...mxAndSpf(domain, org.mode, options),
|
|
@@ -286,6 +287,22 @@ async function rebuildRoute(client) {
|
|
|
286
287
|
await client.update('MtaOutboundStrategy', 'singleton', { route });
|
|
287
288
|
await client.create('Action', { '@type': 'ReloadSettings' });
|
|
288
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Rewrite the route expression when it is not the one this version writes. A
|
|
292
|
+
* server last written by a version before 0.19.1 has no local-delivery rule,
|
|
293
|
+
* and nothing else rewrites the expression while every relay is healthy.
|
|
294
|
+
*/
|
|
295
|
+
async function repairRoute(client) {
|
|
296
|
+
const [strategy] = await client.get('MtaOutboundStrategy', [
|
|
297
|
+
'singleton',
|
|
298
|
+
]);
|
|
299
|
+
const routes = await client.list('MtaRoute');
|
|
300
|
+
const wanted = await outboundRoute(client);
|
|
301
|
+
if (!routes.some((r) => r.name === LOCAL_ROUTE) ||
|
|
302
|
+
JSON.stringify(strategy?.route) !== JSON.stringify(wanted)) {
|
|
303
|
+
await rebuildRoute(client);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
289
306
|
/**
|
|
290
307
|
* Give an org its own Lettermint relay, or replace its token. Idempotent: the
|
|
291
308
|
* route is upserted by name, so calling it twice leaves one route and one
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wtfalch/email",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "The wtfalch estate: reading a mailbox over JMAP, administering the Stalwart server it lives on, and iTIP scheduling over iMIP. Three entries with no code in common.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|