diff --git a/config_panel.toml b/config_panel.toml index a4ef335..7b11364 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -6,19 +6,24 @@ name = "Configuration" [main.service] name = "" optional = false - + [main.service.no_antenna] + # The value is filled via a custom getter + type = "boolean" + visible = "false" + + [main.service.no_antenna_alert] ask = "No wifi antenna has been detected! If you use a wifi USB dongle and that this one is not listed here, try to unplug and replug it, then reload this page." type = "alert" style = "danger" visible = "no_antenna" - + [main.service.status] ask = "The status of your VPN is unknown." type = "alert" style = "info" visible = "! no_antenna" - + [main.service.service_enabled] ask = "Enable Hotspot" type = "boolean" @@ -29,7 +34,7 @@ name = "Configuration" type = "select" choices.wlan0 = "wlan0" visible = "! no_antenna" - + [main.service.wifi_channel] ask = "Channel" type = "select" @@ -46,7 +51,7 @@ name = "Configuration" choices.11 = "11" visible = "! no_antenna" help = "Changing the channel may help with signal strength depending on neighbour WiFis" - + [main.service.multissid] ask = "Number of hotspots to broadcast" type = "select" @@ -54,7 +59,7 @@ name = "Configuration" choices.2 = "2" choices.3 = "3" visible = "! no_antenna" - + [main.hotspot1] name = "Hotspot 1" optional = false @@ -66,7 +71,7 @@ name = "Configuration" bind = "array_settings()" pattern.regexp = '^[\w \-]{1,32}$' pattern.error = "SSID in this app are limited to letter, number space, dash and underscores." - + [main.hotspot1.wifi_secure__1] ask = "Secure" type = "boolean" @@ -78,15 +83,15 @@ name = "Configuration" bind = "array_settings()" redact = true optional = true - visible = "wifi_secure__1" + visible = "wifi_secure__1" pattern.regexp = '^[a-zA-Z0-9]{8,63}$' pattern.error = "Only printable alphanumeric characters are permitted in your password. Maximal size 63 chars" - + [main.hotspot1.advanced__1] ask = "Advanced settings" type = "boolean" bind = "array_settings()" - + [main.hotspot1.ip4_nat_prefix__1] ask = "IPv4 NAT prefix (/24)" type = "string" @@ -94,7 +99,7 @@ name = "Configuration" visible = "advanced__1" pattern.regexp = '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' pattern.error = "Please provide a private /24 range in the format xxx.xxx.xxx" - + [main.hotspot1.ip6_net__1] ask = "IPv6 delegated prefix" type = "string" @@ -103,13 +108,13 @@ name = "Configuration" visible = "advanced__1" pattern.regexp = '^[0-9a-fA-F:]+$' pattern.error = "Please provide a valid IPv6 Prefix" - + [main.hotspot1.ip6_firewall__1] ask = "IPv6 firewall" type = "boolean" bind = "array_settings()" visible = "advanced__1" - + [main.hotspot1.dns__1] ask = "DNS resolvers" type = "tags" @@ -117,7 +122,7 @@ name = "Configuration" visible = "advanced__1" pattern.regexp = '^([0-9.]{7,15}|[0-9a-fA-F:]+)$' pattern.error = "Not an ip" - + [main.hotspot2] name = "Hotspot 2" visible = "! no_antenna && multissid >= 2" @@ -128,7 +133,7 @@ name = "Configuration" bind = "array_settings()" pattern.regexp = '^[\w \-]{1,32}$' pattern.error = "SSID in this app are limited to letter, number space, dash and underscores." - + [main.hotspot2.wifi_secure__2] ask = "Secure" type = "boolean" @@ -139,15 +144,15 @@ name = "Configuration" type = "string" bind = "array_settings()" redact = true - visible = "wifi_secure__2" + visible = "wifi_secure__2" pattern.regexp = '^[a-zA-Z0-9]{8,63}$' pattern.error = "Only printable alphanumeric characters are permitted in your password. Maximal size 63 chars" - + [main.hotspot2.advanced__2] ask = "Advanced settings" type = "boolean" bind = "array_settings()" - + [main.hotspot2.ip4_nat_prefix__2] ask = "IPv4 NAT prefix (/24)" type = "string" @@ -155,7 +160,7 @@ name = "Configuration" visible = "advanced__2" pattern.regexp = '^[0-9.]{7,15}$' pattern.error = "Please provide a valid IP" - + [main.hotspot2.ip6_net__2] ask = "IPv6 delegated prefix" type = "string" @@ -163,13 +168,13 @@ name = "Configuration" visible = "advanced__2" pattern.regexp = '^[0-9a-fA-F:]+$' pattern.error = "Please provide a valid IPv6 Prefix" - + [main.hotspot2.ip6_firewall__2] ask = "IPv6 firewall" type = "boolean" bind = "array_settings()" visible = "advanced__2" - + [main.hotspot2.dns__2] ask = "DNS resolvers" type = "tags" @@ -177,7 +182,7 @@ name = "Configuration" visible = "advanced__2" pattern.regexp = '^([0-9.]{7,15}|[0-9a-fA-F:]+)$' pattern.error = "Not an ip" - + [main.hotspot3] name = "Hotspot 3" visible = "! no_antenna && multissid >= 3" @@ -188,7 +193,7 @@ name = "Configuration" bind = "array_settings()" pattern.regexp = '^[\w \-]{1,32}$' pattern.error = "SSID in this app are limited to letter, number space, dash and underscores." - + [main.hotspot3.wifi_secure__3] ask = "Secure" type = "boolean" @@ -199,15 +204,15 @@ name = "Configuration" type = "string" bind = "array_settings()" redact = true - visible = "wifi_secure__3" + visible = "wifi_secure__3" pattern.regexp = '^[a-zA-Z0-9]{8,63}$' pattern.error = "Only printable alphanumeric characters are permitted in your password. Maximal size 63 chars" - + [main.hotspot3.advanced__3] ask = "Advanced settings" type = "boolean" bind = "array_settings()" - + [main.hotspot3.ip4_nat_prefix__3] ask = "IPv4 NAT prefix (/24)" type = "string" @@ -215,7 +220,7 @@ name = "Configuration" visible = "advanced__3" pattern.regexp = '^[0-9.]{7,15}$' pattern.error = "Please provide a valid IP" - + [main.hotspot3.ip6_net__3] ask = "IPv6 delegated prefix" type = "string" @@ -223,13 +228,13 @@ name = "Configuration" visible = "advanced__3" pattern.regexp = '^[0-9a-fA-F:]+$' pattern.error = "Please provide a valid IPv6 Prefix" - + [main.hotspot3.ip6_firewall__3] ask = "IPv6 firewall" type = "boolean" bind = "array_settings()" visible = "advanced__3" - + [main.hotspot3.dns__3] ask = "DNS resolvers" type = "tags" @@ -237,4 +242,4 @@ name = "Configuration" visible = "advanced__3" pattern.regexp = '^([0-9.]{7,15}|[0-9a-fA-F:]+)$' pattern.error = "Not an ip" - + diff --git a/scripts/config b/scripts/config index fbf29b6..2d2e253 100644 --- a/scripts/config +++ b/scripts/config @@ -31,11 +31,7 @@ get__no_antenna() { then echo "value: false" else - cat << EOF -value: false -ask: Wifi antenna correctly detected -style: info -EOF + echo "value: true" fi } @@ -92,6 +88,8 @@ EOF echo " $device: $device" done fi + + echo "value: '$(ynh_app_setting_get $app wifi_device)'" } get__array_settings() { diff --git a/scripts/upgrade b/scripts/upgrade index 86387d2..6844d1a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,7 +45,7 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping the hotspot service ... (this may take some time)" ynh_systemd_action --service_name=$service_name --action="stop" --log_path=systemd #--line_match="Started YunoHost Wifi Hotspot" @@ -160,7 +160,7 @@ yunohost service add $service_name --description "Creates a Wi-Fi access point" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting the hotspot service..." hot_reload_usb_wifi_cards wifi_device=$(iw_devices | awk -F\| '{ print $1 }')