From 0b6362e61109d352738e8947cb1837fdd65ba831 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 26 Dec 2019 06:14:03 +0000 Subject: [PATCH 01/20] Updated with loadChannelSelect() --- app/js/custom.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/app/js/custom.js b/app/js/custom.js index 40d62ba8..1444f0db 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -190,6 +190,44 @@ function loadWifiStations(refresh) { $(".js-reload-wifi-stations").on("click", loadWifiStations(true)); +/* +Sets the wirelss channel select options based on hw_mode and country_code. + +Methodology: In North America up to channel 11 is the maximum allowed WiFi 2.4Ghz channel, +except for the US that allows channel 12 & 13 in low power mode with additional restrictions. +Canada allows channel 12 in low power mode. Because it's unsure if low powered mode can be +supported the channels are not selectable for those countries. +Source: https://en.wikipedia.org/wiki/List_of_WLAN_channels#Interference_concerns +Also Uzbekistan and Colombia allow up to channel 11 as maximum channel on the 2.4Ghz WiFi band. +*/ +function loadChannelSelect() { + var hw_mode = $('#cbxhwmode').val(); + var country_code = $('#cbxcountries').val(); + var selectablechannels = Array.range(1,14); + var countries_2_4Ghz_max11ch = Array('AG', 'BS', 'BB', 'BZ', 'CR', 'CU', 'DM', 'DO', 'SV', 'GD', 'GT', + 'HT', 'HN', 'JM', 'MX', 'NI', 'PA', 'KN', 'LC', 'VC', 'TT', + 'US', 'CA', 'UZ', 'CO'); + var countries_2_4Ghz_max14ch = Array('JP'); + var countries_5Ghz_max48ch = Array('US'); + if (($.inArray(country_code, countries_2_4Ghz_max11ch) !== -1) && (hw_mode !== 'ac') ) { + selectablechannels = Array.range(1,12); + } else if (($.inArray(country_code, countries_2_4Ghz_max14ch) !== -1) && (hw_mode === 'b')) { + selectablechannels = Array.range(1,15); + } else if (($.inArray(country_code, countries_5Ghz_max48ch) !== -1) && (hw_mode === 'ac')) { + selectablechannels = Array(36, 40, 44, 48); + } + + // Set channel select with available values + var channel_select = $('#cbxchannel'); + channel_select.empty(); + $.each(selectablechannels, function(key,value) { + channel_select.append($("").attr("value", value).text(value)); + }); +} + +// Static Array method +Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start); + $(document).on("click", ".js-toggle-password", function(e) { var button = $(e.target) var field = $(button.data("target")); From bbe430028c9e73a970e8968dccbc8e74123df580 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 26 Dec 2019 06:15:04 +0000 Subject: [PATCH 02/20] Updated wpa, wpa_pairwise --- config/hostapd.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/hostapd.conf b/config/hostapd.conf index eea43887..be164e30 100644 --- a/config/hostapd.conf +++ b/config/hostapd.conf @@ -9,8 +9,8 @@ channel=1 hw_mode=g wpa_passphrase=ChangeMe interface=wlan0 -wpa=1 -wpa_pairwise=TKIP +wpa=2 +wpa_pairwise=CCMP country_code= ## Rapberry Pi 3 specific to on board WLAN/WiFi #ieee80211n=1 # 802.11n support (Raspberry Pi 3) @@ -18,4 +18,5 @@ country_code= #ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] # (Raspberry Pi 3) ## RaspAP wireless client AP mode -#interface=uap0 \ No newline at end of file +#interface=uap0 + From 6d7aa1b40105352f3e2edd4580835ec7ba7fb62c Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 26 Dec 2019 06:16:13 +0000 Subject: [PATCH 03/20] Added optional $event param to SelectorOptions() --- includes/functions.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 1c4c5150..0eef6694 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -142,19 +142,21 @@ function isAssoc($arr) /** * * Display a selector field for a form. Arguments are: -* $name: Field name -* $options: Array of options -* $selected: Selected option (optional) -* If $options is an associative array this should be the key -* +* @param string $name: Field name +* @param array $options: Array of options +* @param string $selected: Selected option (optional) +* @param string $id: $options is an associative array this should be the key +* @param string $event: onChange event (optional) */ -function SelectorOptions($name, $options, $selected = null, $id = null) +function SelectorOptions($name, $options, $selected = null, $id = null, $event = null) { echo ' - From 6a961e09b87a7ed8224040297f8af5934f22433f Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 26 Dec 2019 21:37:23 +0000 Subject: [PATCH 07/20] Added loadChannelSelect() to document.ready --- app/js/custom.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/js/custom.js b/app/js/custom.js index 1444f0db..b3d66b81 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -196,13 +196,15 @@ Sets the wirelss channel select options based on hw_mode and country_code. Methodology: In North America up to channel 11 is the maximum allowed WiFi 2.4Ghz channel, except for the US that allows channel 12 & 13 in low power mode with additional restrictions. Canada allows channel 12 in low power mode. Because it's unsure if low powered mode can be -supported the channels are not selectable for those countries. +supported the channels are not selectable for those countries. Also Uzbekistan and Colombia +allow up to channel 11 as maximum channel on the 2.4Ghz WiFi band. Source: https://en.wikipedia.org/wiki/List_of_WLAN_channels#Interference_concerns -Also Uzbekistan and Colombia allow up to channel 11 as maximum channel on the 2.4Ghz WiFi band. +Additional: https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git */ function loadChannelSelect() { var hw_mode = $('#cbxhwmode').val(); var country_code = $('#cbxcountries').val(); + var channel_select = $('#cbxchannel'); var selectablechannels = Array.range(1,14); var countries_2_4Ghz_max11ch = Array('AG', 'BS', 'BB', 'BZ', 'CR', 'CU', 'DM', 'DO', 'SV', 'GD', 'GT', 'HT', 'HN', 'JM', 'MX', 'NI', 'PA', 'KN', 'LC', 'VC', 'TT', @@ -218,7 +220,6 @@ function loadChannelSelect() { } // Set channel select with available values - var channel_select = $('#cbxchannel'); channel_select.empty(); $.each(selectablechannels, function(key,value) { channel_select.append($("").attr("value", value).text(value)); @@ -334,4 +335,5 @@ $(window).bind("load", function() { $(document) .ajaxSend(setCSRFTokenHeader) .ready(contentLoaded) - .ready(loadWifiStations()); + .ready(loadWifiStations()) + .ready(loadChannelSelect()); From 93514a678704c2e9b9075a20472588d5060248ef Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 27 Dec 2019 01:26:37 +0000 Subject: [PATCH 08/20] Minor: comments + formatting --- app/js/custom.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/js/custom.js b/app/js/custom.js index b3d66b81..721f5b35 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -198,7 +198,7 @@ except for the US that allows channel 12 & 13 in low power mode with additional Canada allows channel 12 in low power mode. Because it's unsure if low powered mode can be supported the channels are not selectable for those countries. Also Uzbekistan and Colombia allow up to channel 11 as maximum channel on the 2.4Ghz WiFi band. -Source: https://en.wikipedia.org/wiki/List_of_WLAN_channels#Interference_concerns +Source: https://en.wikipedia.org/wiki/List_of_WLAN_channels Additional: https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git */ function loadChannelSelect() { @@ -207,8 +207,7 @@ function loadChannelSelect() { var channel_select = $('#cbxchannel'); var selectablechannels = Array.range(1,14); var countries_2_4Ghz_max11ch = Array('AG', 'BS', 'BB', 'BZ', 'CR', 'CU', 'DM', 'DO', 'SV', 'GD', 'GT', - 'HT', 'HN', 'JM', 'MX', 'NI', 'PA', 'KN', 'LC', 'VC', 'TT', - 'US', 'CA', 'UZ', 'CO'); + 'HT', 'HN', 'JM', 'MX', 'NI', 'PA', 'KN', 'LC', 'VC', 'TT', 'US', 'CA', 'UZ', 'CO'); var countries_2_4Ghz_max14ch = Array('JP'); var countries_5Ghz_max48ch = Array('US'); if (($.inArray(country_code, countries_2_4Ghz_max11ch) !== -1) && (hw_mode !== 'ac') ) { From 3292bc580b3d52f390c495fc5fcf9f708bf8aaf9 Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 27 Dec 2019 03:08:51 +0000 Subject: [PATCH 09/20] Added disabled param to SelectorOptions() --- includes/functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 0eef6694..d43c7b89 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -147,8 +147,9 @@ function isAssoc($arr) * @param string $selected: Selected option (optional) * @param string $id: $options is an associative array this should be the key * @param string $event: onChange event (optional) +* @param string $disabled (optional) */ -function SelectorOptions($name, $options, $selected = null, $id = null, $event = null) +function SelectorOptions($name, $options, $selected = null, $id = null, $event = null, $disabled = null) { echo '