From 44d9fa63f06ec97f72bc258404a48a87c651954c Mon Sep 17 00:00:00 2001 From: Ponkhy Date: Tue, 24 Aug 2021 11:47:12 +0200 Subject: [PATCH] Adjusted the output for A and AAAA records --- server/model/monitor.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index bdfa59555..40abf1f1d 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -184,18 +184,25 @@ class Monitor extends BeanModel { let dnsRes = await dnsResolve(this.hostname, this.dns_resolve_server, this.dns_resolve_type); bean.ping = dayjs().valueOf() - startTime; - if (this.dns_resolve_type == "A" || this.dns_resolve_type == "AAAA" || this.dns_resolve_type == "CNAME" || this.dns_resolve_type == "PTR") { + if (this.dns_resolve_type == "A" || this.dns_resolve_type == "AAAA") { + dnsMessage += "Records: "; + dnsRes.forEach(record => { + dnsMessage += `${record} | `; + }); + dnsMessage = dnsMessage.slice(0, -2) + } else if (this.dns_resolve_type == "CNAME" || this.dns_resolve_type == "PTR") { dnsMessage = dnsRes[0]; } else if (this.dns_resolve_type == "CAA") { dnsMessage = dnsRes[0].issue; } else if (this.dns_resolve_type == "MX") { dnsRes.forEach(record => { - dnsMessage += `Server: ${record.exchange} - Priority: ${record.priority} | `; + dnsMessage += `Hostname: ${record.exchange} - Priority: ${record.priority} | `; }); dnsMessage = dnsMessage.slice(0, -2) } else if (this.dns_resolve_type == "NS") { + dnsMessage += "Servers: "; dnsRes.forEach(record => { - dnsMessage += `Server: ${record} | `; + dnsMessage += `${record} | `; }); dnsMessage = dnsMessage.slice(0, -2) } else if (this.dns_resolve_type == "SOA") {