mirror of
https://github.com/etiennecollin/unifi-voucher-manager.git
synced 2025-10-23 08:12:15 +00:00
feat: accept hidden boolean as true/false or 1/0 and default to false
This commit is contained in:
@@ -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_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_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_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
|
### Getting UniFi API Credentials
|
||||||
|
|
||||||
|
@@ -64,16 +64,18 @@ export function generateWifiConfig(): WifiConfig {
|
|||||||
|
|
||||||
let hidden_parsed: boolean;
|
let hidden_parsed: boolean;
|
||||||
if (hidden == null) {
|
if (hidden == null) {
|
||||||
hidden_parsed = true;
|
hidden_parsed = false;
|
||||||
console.log(
|
console.log(
|
||||||
`WiFi Configuration: hidden state not provided, defaulting to 'hidden=${hidden_parsed}' `,
|
`WiFi Configuration: hidden state not provided, defaulting to 'hidden=${hidden_parsed}' `,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
switch (hidden.trim().toLowerCase()) {
|
switch (hidden.trim().toLowerCase()) {
|
||||||
case "true":
|
case "true":
|
||||||
|
case "1":
|
||||||
hidden_parsed = true;
|
hidden_parsed = true;
|
||||||
break;
|
break;
|
||||||
case "false":
|
case "false":
|
||||||
|
case "0":
|
||||||
hidden_parsed = false;
|
hidden_parsed = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user