1
0
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:
wellenvogel
2021-12-12 12:46:17 +01:00
parent de04e5443b
commit 2f1ea8e726
4 changed files with 23 additions and 5 deletions

View File

@@ -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"
},

View File

@@ -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');