mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-12 13:33:06 +01:00
limit tcp clients to 6
This commit is contained in:
@@ -372,10 +372,10 @@
|
||||
"name": "maxClients",
|
||||
"label": "max. TCP clients",
|
||||
"type": "number",
|
||||
"default": "10",
|
||||
"default": "6",
|
||||
"check": "checkMinMax",
|
||||
"min": 0,
|
||||
"max": 10,
|
||||
"max": 6,
|
||||
"description": "the number of clients we allow to connect to us",
|
||||
"category": "TCP port"
|
||||
},
|
||||
|
||||
14
web/index.js
14
web/index.js
@@ -92,6 +92,20 @@ function resetForm(ev) {
|
||||
let el = document.querySelector("[name='" + k + "']");
|
||||
if (el) {
|
||||
let v = jsonData[k];
|
||||
let def=getConfigDefition(k);
|
||||
if (def.check == 'checkMinMax'){
|
||||
//simple migration if the current value is outside the range
|
||||
//we even "hide" this from the user
|
||||
v=parseFloat(v);
|
||||
if (! isNaN(v)){
|
||||
if (def.min !== undefined){
|
||||
if (v < parseFloat(def.min)) v=parseFloat(def.min);
|
||||
}
|
||||
if (def.max !== undefined){
|
||||
if (v > parseFloat(def.max)) v=parseFloat(def.max);
|
||||
}
|
||||
}
|
||||
}
|
||||
el.value = v;
|
||||
el.setAttribute('data-loaded', v);
|
||||
let changeEvent = new Event('change');
|
||||
|
||||
Reference in New Issue
Block a user