From 25102ca71010951fb592c6d8bdb4852976a49c1e Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Thu, 1 Feb 2024 12:29:05 +0200 Subject: [PATCH] fix(api): added endpoint to list locked domains --- lib/api-server.js | 17 +++++++++++++++++ lib/sender.js | 10 ++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/api-server.js b/lib/api-server.js index 6c3d0b3..94ebbd8 100644 --- a/lib/api-server.js +++ b/lib/api-server.js @@ -617,6 +617,23 @@ class APIServer { return next(); }); + // list skipped domains for a zone + this.server.get('/skipdomains/:zone', (req, res, next) => { + if (!this.queue) { + res.json(500, { + error: 'Service not yet started' + }); + return next(); + } + + let skipDomains = this.queue.locks.listSkipDomains(req.params.zone); + + res.json({ + skipDomains + }); + next(); + }); + // list queued recipients for a zone this.server.get('/suppressionlist', (req, res, next) => { if (!this.queue) { diff --git a/lib/sender.js b/lib/sender.js index c5e56df..0f4e94c 100644 --- a/lib/sender.js +++ b/lib/sender.js @@ -25,10 +25,12 @@ const base32 = require('base32.js'); // handle DNS resolving require('./ip-tools'); -const DEFAULT_DEFER_TIMES = [ - 5 /* 5 */, 7 /* 12 */, 8 /* 20 */, 25 /* 45 */, 75 /* 2h */, 120 /* 4h */, 240 /* 8h */, 240 /* 12h */, 240 /* 16h */, 240 /* 20h */, 240 /* 24h */, - 240 /* 28h */, 240 /* 32h */, 240 /* 36h */, 240 /* 40h */, 240 /* 44h */, 240 /* 48h */ -].map(v => v * 60 * 1000); +const DEFAULT_DEFER_TIMES = + config.queue.deferTimes || + [ + 5 /* 5 */, 7 /* 12 */, 8 /* 20 */, 25 /* 45 */, 75 /* 2h */, 120 /* 4h */, 240 /* 8h */, 240 /* 12h */, 240 /* 16h */, 240 /* 20h */, 240 /* 24h */, + 240 /* 28h */, 240 /* 32h */, 240 /* 36h */, 240 /* 40h */, 240 /* 44h */, 240 /* 48h */ + ].map(v => v * 60 * 1000); const POLICY_RESPONSE = 'Failed to establish a TLS connection to the MX server as requested by policy';