mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Optimizations for output handling
This commit is contained in:
parent
6eead46fa6
commit
d313a06d5c
1 changed files with 3 additions and 14 deletions
|
@ -184,12 +184,9 @@ 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") {
|
||||
if (this.dns_resolve_type == "A" || this.dns_resolve_type == "AAAA" || this.dns_resolve_type == "TXT") {
|
||||
dnsMessage += "Records: ";
|
||||
dnsRes.forEach(record => {
|
||||
dnsMessage += `${record} | `;
|
||||
});
|
||||
dnsMessage = dnsMessage.slice(0, -2)
|
||||
dnsMessage += dnsRes.join(" | ");
|
||||
} else if (this.dns_resolve_type == "CNAME" || this.dns_resolve_type == "PTR") {
|
||||
dnsMessage = dnsRes[0];
|
||||
} else if (this.dns_resolve_type == "CAA") {
|
||||
|
@ -201,10 +198,7 @@ class Monitor extends BeanModel {
|
|||
dnsMessage = dnsMessage.slice(0, -2)
|
||||
} else if (this.dns_resolve_type == "NS") {
|
||||
dnsMessage += "Servers: ";
|
||||
dnsRes.forEach(record => {
|
||||
dnsMessage += `${record} | `;
|
||||
});
|
||||
dnsMessage = dnsMessage.slice(0, -2)
|
||||
dnsMessage += dnsRes.join(" | ");
|
||||
} else if (this.dns_resolve_type == "SOA") {
|
||||
dnsMessage += `NS-Name: ${dnsRes.nsname} | Hostmaster: ${dnsRes.hostmaster} | Serial: ${dnsRes.serial} | Refresh: ${dnsRes.refresh} | Retry: ${dnsRes.retry} | Expire: ${dnsRes.expire} | MinTTL: ${dnsRes.minttl}`;
|
||||
} else if (this.dns_resolve_type == "SRV") {
|
||||
|
@ -212,11 +206,6 @@ class Monitor extends BeanModel {
|
|||
dnsMessage += `Name: ${record.name} | Port: ${record.port} | Priority: ${record.priority} | Weight: ${record.weight} | `;
|
||||
});
|
||||
dnsMessage = dnsMessage.slice(0, -2)
|
||||
} else if (this.dns_resolve_type == "TXT") {
|
||||
dnsRes.forEach(record => {
|
||||
dnsMessage += `Record: ${record} | `;
|
||||
});
|
||||
dnsMessage = dnsMessage.slice(0, -2)
|
||||
}
|
||||
|
||||
bean.msg = dnsMessage;
|
||||
|
|
Loading…
Reference in a new issue