mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-24 16:10:47 -06:00
Optimizations for output handling
This commit is contained in:
parent
6eead46fa6
commit
d313a06d5c
@ -184,12 +184,9 @@ class Monitor extends BeanModel {
|
|||||||
let dnsRes = await dnsResolve(this.hostname, this.dns_resolve_server, this.dns_resolve_type);
|
let dnsRes = await dnsResolve(this.hostname, this.dns_resolve_server, this.dns_resolve_type);
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
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: ";
|
dnsMessage += "Records: ";
|
||||||
dnsRes.forEach(record => {
|
dnsMessage += dnsRes.join(" | ");
|
||||||
dnsMessage += `${record} | `;
|
|
||||||
});
|
|
||||||
dnsMessage = dnsMessage.slice(0, -2)
|
|
||||||
} else if (this.dns_resolve_type == "CNAME" || this.dns_resolve_type == "PTR") {
|
} else if (this.dns_resolve_type == "CNAME" || this.dns_resolve_type == "PTR") {
|
||||||
dnsMessage = dnsRes[0];
|
dnsMessage = dnsRes[0];
|
||||||
} else if (this.dns_resolve_type == "CAA") {
|
} else if (this.dns_resolve_type == "CAA") {
|
||||||
@ -201,10 +198,7 @@ class Monitor extends BeanModel {
|
|||||||
dnsMessage = dnsMessage.slice(0, -2)
|
dnsMessage = dnsMessage.slice(0, -2)
|
||||||
} else if (this.dns_resolve_type == "NS") {
|
} else if (this.dns_resolve_type == "NS") {
|
||||||
dnsMessage += "Servers: ";
|
dnsMessage += "Servers: ";
|
||||||
dnsRes.forEach(record => {
|
dnsMessage += dnsRes.join(" | ");
|
||||||
dnsMessage += `${record} | `;
|
|
||||||
});
|
|
||||||
dnsMessage = dnsMessage.slice(0, -2)
|
|
||||||
} else if (this.dns_resolve_type == "SOA") {
|
} 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}`;
|
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") {
|
} 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 += `Name: ${record.name} | Port: ${record.port} | Priority: ${record.priority} | Weight: ${record.weight} | `;
|
||||||
});
|
});
|
||||||
dnsMessage = dnsMessage.slice(0, -2)
|
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;
|
bean.msg = dnsMessage;
|
||||||
|
Loading…
Reference in New Issue
Block a user