mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-13 05:53:06 +01:00
allow to change the Wifi AP Ip address and mask
This commit is contained in:
@@ -119,6 +119,22 @@
|
||||
"category": "system",
|
||||
"capabilities":{"apPwChange":["true"]}
|
||||
},
|
||||
{
|
||||
"name": "apIp",
|
||||
"type": "string",
|
||||
"default":"192.168.15.1",
|
||||
"check": "checkApIp",
|
||||
"description": "The IP address for the access point. Clients will get addresses within the same subnet.",
|
||||
"category":"system"
|
||||
},
|
||||
{
|
||||
"name": "apMask",
|
||||
"type": "string",
|
||||
"default":"255.255.255.0",
|
||||
"check": "checkNetMask",
|
||||
"description": "The net mask for the access point",
|
||||
"category":"system"
|
||||
},
|
||||
{
|
||||
"name": "useAdminPass",
|
||||
"type": "boolean",
|
||||
|
||||
15
web/index.js
15
web/index.js
@@ -186,6 +186,21 @@ function checkAdminPass(v){
|
||||
return checkApPass(v);
|
||||
}
|
||||
|
||||
function checkApIp(v,allValues){
|
||||
if (! v) return "cannot be empty";
|
||||
let err1="must be in the form 192.168.x.x";
|
||||
if (! v.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/))return err1;
|
||||
let parts=v.split(".");
|
||||
if (parts.length != 4) return err1;
|
||||
for (let idx=0;idx < 4;idx++){
|
||||
let iv=parseInt(parts[idx]);
|
||||
if (iv < 0 || iv > 255) return err1;
|
||||
}
|
||||
}
|
||||
function checkNetMask(v,allValues){
|
||||
return checkApIp(v,allValues);
|
||||
}
|
||||
|
||||
function checkIpAddress(v,allValues,def){
|
||||
if (allValues.tclEnabled != "true") return;
|
||||
if (! v) return "cannot be empty";
|
||||
|
||||
Reference in New Issue
Block a user