From bee32920883028571849500fb81b8c572efb0965 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 May 2022 15:23:34 +0200 Subject: [PATCH] fixes --- src/routes/settings/check.json.ts | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/routes/settings/check.json.ts b/src/routes/settings/check.json.ts index 66cbe7dbf..dd312995d 100644 --- a/src/routes/settings/check.json.ts +++ b/src/routes/settings/check.json.ts @@ -45,11 +45,21 @@ export const post: RequestHandler = async (event) => { resolves = await dns.resolve4(event.url.hostname); } console.log({ resolves }); - if (resolves.includes(ipDomain) || resolves.includes(ipDomainDualCert)) { - console.log('OK'); - } else { - throw false; + for (const ip of ipDomain) { + if (resolves.includes(ip)) { + return { + status: 200 + }; + } } + for (const ip of ipDomainDualCert) { + if (resolves.includes(ip)) { + return { + status: 200 + }; + } + } + throw false; } else { throw false; } @@ -70,11 +80,14 @@ export const post: RequestHandler = async (event) => { resolves = await dns.resolve4(event.url.hostname); } console.log({ resolves }); - if (resolves.includes(ipDomain)) { - console.log('OK'); - } else { - throw false; + for (const ip of ipDomain) { + if (resolves.includes(ip)) { + return { + status: 200 + }; + } } + throw false; } catch (error) { console.log(error); throw {