Fixed ESLint Errors

This commit is contained in:
Ponkhy 2021-08-23 16:30:11 +02:00
parent e5981b10ce
commit b2041cb36b
3 changed files with 10 additions and 10 deletions

View File

@ -184,28 +184,28 @@ 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' || this.dns_resolve_type == 'CNAME' || this.dns_resolve_type == 'PTR') { if (this.dns_resolve_type == "A" || this.dns_resolve_type == "AAAA" || 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") {
dnsMessage = dnsRes[0].issue; dnsMessage = dnsRes[0].issue;
} else if (this.dns_resolve_type == 'MX') { } else if (this.dns_resolve_type == "MX") {
dnsRes.forEach(record => { dnsRes.forEach(record => {
dnsMessage += `Server: ${record.exchange} - Priority: ${record.priority} | `; dnsMessage += `Server: ${record.exchange} - Priority: ${record.priority} | `;
}); });
dnsMessage = dnsMessage.slice(0, -2) dnsMessage = dnsMessage.slice(0, -2)
} else if (this.dns_resolve_type == 'NS') { } else if (this.dns_resolve_type == "NS") {
dnsRes.forEach(record => { dnsRes.forEach(record => {
dnsMessage += `Server: ${record} | `; dnsMessage += `Server: ${record} | `;
}); });
dnsMessage = dnsMessage.slice(0, -2) 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") {
dnsRes.forEach(record => { dnsRes.forEach(record => {
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') { } else if (this.dns_resolve_type == "TXT") {
dnsRes.forEach(record => { dnsRes.forEach(record => {
dnsMessage += `Record: ${record} | `; dnsMessage += `Record: ${record} | `;
}); });

View File

@ -4,7 +4,7 @@ const { R } = require("redbean-node");
const { debug } = require("../src/util"); const { debug } = require("../src/util");
const passwordHash = require("./password-hash"); const passwordHash = require("./password-hash");
const dayjs = require("dayjs"); const dayjs = require("dayjs");
const { Resolver } = require('dns'); const { Resolver } = require("dns");
/** /**
* Init or reset JWT secret * Init or reset JWT secret
@ -81,7 +81,7 @@ exports.dnsResolve = function (hostname, resolver_server, rrtype) {
const resolver = new Resolver(); const resolver = new Resolver();
resolver.setServers([resolver_server]); resolver.setServers([resolver_server]);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (rrtype == 'PTR') { if (rrtype == "PTR") {
resolver.reverse(hostname, (err, records) => { resolver.reverse(hostname, (err, records) => {
if (err) { if (err) {
reject(err); reject(err);

View File

@ -64,7 +64,7 @@
<div v-if="monitor.type === 'dns'" class="my-3"> <div v-if="monitor.type === 'dns'" class="my-3">
<label for="dns_resolve_server" class="form-label">Resolver Server</label> <label for="dns_resolve_server" class="form-label">Resolver Server</label>
<input id="dns_resolve_server" v-model="monitor.dns_resolve_server" type="text" class="form-control" :pattern="this.ipRegex" required> <input id="dns_resolve_server" v-model="monitor.dns_resolve_server" type="text" class="form-control" :pattern="ipRegex" required>
<div class="form-text"> <div class="form-text">
Cloudflare is the default server, you can change the resolver server anytime. Cloudflare is the default server, you can change the resolver server anytime.
</div> </div>