domains: remove unused wildcard check
This commit is contained in:
@@ -28,12 +28,11 @@ async function add(req, res, next) {
|
||||
if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider must be a string'));
|
||||
|
||||
if (!req.body.config || typeof req.body.config !== 'object') return next(new HttpError(400, 'config must be an object'));
|
||||
if ('wildcard' in req.body.config && typeof req.body.config.wildcard !== 'boolean') return next(new HttpError(400, 'wildcard must be a boolean'));
|
||||
|
||||
if ('zoneName' in req.body && typeof req.body.zoneName !== 'string') return next(new HttpError(400, 'zoneName must be a string'));
|
||||
if ('fallbackCertificate' in req.body && typeof req.body.fallbackCertificate !== 'object') return next(new HttpError(400, 'fallbackCertificate must be a object with cert and key strings'));
|
||||
if (req.body.fallbackCertificate) {
|
||||
let fallbackCertificate = req.body.fallbackCertificate;
|
||||
const fallbackCertificate = req.body.fallbackCertificate;
|
||||
if (!fallbackCertificate.cert || typeof fallbackCertificate.cert !== 'string') return next(new HttpError(400, 'fallbackCertificate.cert must be a string'));
|
||||
if (!fallbackCertificate.key || typeof fallbackCertificate.key !== 'string') return next(new HttpError(400, 'fallbackCertificate.key must be a string'));
|
||||
}
|
||||
@@ -46,7 +45,7 @@ async function add(req, res, next) {
|
||||
// some DNS providers like DigitalOcean take a really long time to verify credentials (https://github.com/expressjs/timeout/issues/26)
|
||||
req.clearTimeout();
|
||||
|
||||
let data = {
|
||||
const data = {
|
||||
zoneName: req.body.zoneName || '',
|
||||
provider: req.body.provider,
|
||||
config: req.body.config,
|
||||
@@ -71,11 +70,10 @@ async function get(req, res, next) {
|
||||
}
|
||||
|
||||
async function list(req, res, next) {
|
||||
let [error, results] = await safe(domains.list());
|
||||
const [error, results] = await safe(domains.list());
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
results = results.map(domains.removeRestrictedFields);
|
||||
next(new HttpSuccess(200, { domains: results }));
|
||||
next(new HttpSuccess(200, { domains: results.map(domains.removeRestrictedFields) }));
|
||||
}
|
||||
|
||||
async function setConfig(req, res, next) {
|
||||
@@ -90,7 +88,7 @@ async function setConfig(req, res, next) {
|
||||
if ('zoneName' in req.body && typeof req.body.zoneName !== 'string') return next(new HttpError(400, 'zoneName must be a string'));
|
||||
if ('fallbackCertificate' in req.body && typeof req.body.fallbackCertificate !== 'object') return next(new HttpError(400, 'fallbackCertificate must be a object with cert and key strings'));
|
||||
if (req.body.fallbackCertificate) {
|
||||
let fallbackCertificate = req.body.fallbackCertificate;
|
||||
const fallbackCertificate = req.body.fallbackCertificate;
|
||||
if (!fallbackCertificate.cert || typeof fallbackCertificate.cert !== 'string') return next(new HttpError(400, 'fallbackCertificate.cert must be a string'));
|
||||
if (!fallbackCertificate.key || typeof fallbackCertificate.key !== 'string') return next(new HttpError(400, 'fallbackCertificate.key must be a string'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user