diff --git a/apiServer.js b/apiServer.js index c7d5cd0e9..213bde919 100644 --- a/apiServer.js +++ b/apiServer.js @@ -24,17 +24,17 @@ let initialHash = hash(fs.readFileSync(path.join(__dirname, '/config/userconfig. function validIpv4Address(ip) { const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/; - if (ipv4Regex.test(ip)) { - const parts = ip.split('.'); - // eslint-disable-next-line no-restricted-syntax - for (const part of parts) { - if (parseInt(part, 10) > 255) { - return false; - } - } + + if (!ipv4Regex.test(ip)) return false; + + const parts = ip.split('.'); + + const isValid = parts.every((part) => { + if (parseInt(part, 10) > 255) return false; return true; - } - return false; + }) + + return isValid; } function validateTags() { diff --git a/package.json b/package.json index c2dd13052..1226ff796 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "docs": "jsdoc -d docs --configure jsconf.json -r" }, "dependencies": { - "@megachips/fluxport-controller": "^0.0.20", + "@megachips/fluxport-controller": "^0.1.0", "@megachips/nat-upnp": "^1.1.1", "apicache": "~1.6.3", "archiver": "~6.0.1",