add wifi-bands to admin-ui

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-09-19 18:56:04 +02:00
parent 1ff9122006
commit 3bef6a0b57
4 changed files with 53 additions and 0 deletions

View File

@@ -30,6 +30,8 @@
],
};
if (admin_ui.wifi_bands)
interface.ssids[0].wifi_bands = admin_ui.wifi_bands;
if (admin_ui.wifi_key) {
interface.ssids[0].encryption.proto = 'psk2';
interface.ssids[0].encryption.key = admin_ui.wifi_key;

View File

@@ -13,6 +13,19 @@ properties:
type: string
maxLength: 63
minLength: 8
wifi-bands:
description:
The band that the SSID should be broadcasted on. The configuration layer
will use the first matching band.
type: array
items:
type: string
enum:
- 2G
- 5G
- 5G-lower
- 5G-upper
- 6G
offline-trigger:
description:
The admin-ui will be spawned when this offline threshold was exceeded.

View File

@@ -8825,6 +8825,31 @@ function instantiateServiceAdminUi(location, value, errors) {
obj.wifi_key = parseWifiKey(location + "/wifi-key", value["wifi-key"], errors);
}
function parseWifiBands(location, value, errors) {
if (type(value) == "array") {
function parseItem(location, value, errors) {
if (type(value) != "string")
push(errors, [ location, "must be of type string" ]);
if (!(value in [ "2G", "5G", "5G-lower", "5G-upper", "6G" ]))
push(errors, [ location, "must be one of \"2G\", \"5G\", \"5G-lower\", \"5G-upper\" or \"6G\"" ]);
return value;
}
return map(value, (item, i) => parseItem(location + "/" + i, item, errors));
}
if (type(value) != "array")
push(errors, [ location, "must be of type array" ]);
return value;
}
if (exists(value, "wifi-bands")) {
obj.wifi_bands = parseWifiBands(location + "/wifi-bands", value["wifi-bands"], errors);
}
function parseOfflineTrigger(location, value, errors) {
if (!(type(value) in [ "int", "double" ]))
push(errors, [ location, "must be of type number" ]);

View File

@@ -3145,6 +3145,19 @@
"maxLength": 63,
"minLength": 8
},
"wifi-bands": {
"type": "array",
"items": {
"type": "string",
"enum": [
"2G",
"5G",
"5G-lower",
"5G-upper",
"6G"
]
}
},
"offline-trigger": {
"type": "number"
}