feat: accept hidden boolean as true/false or 1/0 and default to false

This commit is contained in:
etiennecollin
2025-08-14 12:45:19 -04:00
parent 339e7bbc0a
commit 83a39b3a37
2 changed files with 4 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ To configure the WiFi QR code, you are required to configure the `WIFI_SSID` and
| `WIFI_SSID` | Optional | WiFi SSID used for the QR code. (required for QR code to be generated) | `My WiFi SSID` | `string` |
| `WIFI_PASSWORD` | Optional | WiFi password used for the QR code (required for QR code to be generated) | `My WiFi Password` | `string` |
| `WIFI_TYPE` | Optional | WiFi security type used. Defaults to `WPA` if a password is provided and `nopass` otherwise. | `WPA` | `WPA\|WEP\|nopass` |
| `WIFI_HIDDEN` | Optional | Whether the WiFi SSID is hidden or broadcasted. | `true` (default) | `bool` |
| `WIFI_HIDDEN` | Optional | Whether the WiFi SSID is hidden or broadcasted. | `false` (default) | `bool` |
### Getting UniFi API Credentials

View File

@@ -64,16 +64,18 @@ export function generateWifiConfig(): WifiConfig {
let hidden_parsed: boolean;
if (hidden == null) {
hidden_parsed = true;
hidden_parsed = false;
console.log(
`WiFi Configuration: hidden state not provided, defaulting to 'hidden=${hidden_parsed}' `,
);
} else {
switch (hidden.trim().toLowerCase()) {
case "true":
case "1":
hidden_parsed = true;
break;
case "false":
case "0":
hidden_parsed = false;
break;
default: