diff --git a/ajax/networking/get_frequencies.php b/ajax/networking/get_frequencies.php new file mode 100644 index 00000000..7fb29990 --- /dev/null +++ b/ajax/networking/get_frequencies.php @@ -0,0 +1,42 @@ +0) { + $flags += NL80211_BAND_24GHZ; + } + if (count(preg_grep('/^5[0-9]{3}/i', $frequencies)) >0) { + $flags += NL80211_BAND_5GHZ; + } + + switch ($flags) { + case NL80211_BAND_24GHZ: + $msg = sprintf(_("The selected interface (%s) has support for the 2.4 GHz wireless band only."), $iface); + break; + case NL80211_BAND_5GHZ: + $msg = sprintf(_("The selected interface (%s) has support for the 5 GHz wireless band only."), $iface); + break; + case NL80211_BAND_24GHZ | NL80211_BAND_5GHZ: + $msg = sprintf(_("The selected interface (%s) has support for both the 2.4 and 5 GHz wireless bands."), $iface); + break; + default: + $msg = sprintf(_("The selected interface (%s) does not support wireless mode operation."), $iface); + } + echo json_encode($msg); +} + diff --git a/app/icons/site.webmanifest b/app/icons/site.webmanifest index 321ab7db..5d0d01c4 100644 --- a/app/icons/site.webmanifest +++ b/app/icons/site.webmanifest @@ -3,7 +3,7 @@ "short_name": "RaspAP", "icons": [ { - "src": "/dist/icons/android-chrome-192x192.png", + "src": "/app/icons/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" } diff --git a/app/js/custom.js b/app/js/custom.js index 6483614b..1412b44f 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -183,6 +183,7 @@ function contentLoaded() { break; case "hostapd_conf": loadChannel(); + setHardwareModeTooltip(); break; case "dhcpd_conf": loadInterfaceDHCPSelect(); @@ -387,6 +388,21 @@ function loadChannelSelect(selected) { }); } +/* Sets hardware mode tooltip text for selected interface. + */ +function setHardwareModeTooltip() { + var iface = $('#cbxinterface').val(); + var hwmodeText = ''; + // Explanatory text if 802.11ac is disabled + if ($('#cbxhwmode').find('option[value="ac"]').prop('disabled') == true ) { + var hwmodeText = $('#hwmode').attr('data-tooltip'); + } + $.post('ajax/networking/get_frequencies.php?',{'interface': iface},function(data){ + var responseText = JSON.parse(data); + $('#tiphwmode').attr('data-original-title', responseText + '\n' + hwmodeText ); + }); +} + /* Updates the selected blocklist * Request is passed to an ajax handler to download the associated list. * Interface elements are updated to indicate current progress, status. diff --git a/includes/firewall.php b/includes/firewall.php old mode 100644 new mode 100755 diff --git a/includes/functions.php b/includes/functions.php index 2971a329..35d285cf 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -792,3 +792,14 @@ function get_public_ip() return $public_ip[0]; } +/* Returns a standardized tooltip + * + * @return string $tooltip + */ +function getTooltip($msg, $id, $visible = true, $data_html = false) +{ + ($visible) ? $opt1 = 'visible' : $opt1 = 'invisible'; + ($data_html) ? $opt2 = 'data-html="true"' : $opt2 = 'data-html="false"'; + echo ''; +} + diff --git a/includes/get_clients.php b/includes/get_clients.php old mode 100644 new mode 100755 diff --git a/includes/hostapd.php b/includes/hostapd.php index d1160d6d..7f47cd7d 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -25,7 +25,7 @@ function DisplayHostAPDConfig() 'b' => '802.11b - 2.4 GHz', 'g' => '802.11g - 2.4 GHz', 'n' => '802.11n - 2.4 GHz', - 'ac' => '802.11.ac - 5 GHz' + 'ac' => '802.11ac - 5 GHz' ]; $arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None")); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); @@ -109,6 +109,30 @@ function DisplayHostAPDConfig() $txpower = $_POST['txpower']; } + $countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2; + $selectedHwMode = $arrConfig['hw_mode']; + if (isset($arrConfig['ieee80211n'])) { + if (strval($arrConfig['ieee80211n']) === '1') { + $selectedHwMode = 'n'; + } + } + if (isset($arrConfig['ieee80211ac'])) { + if (strval($arrConfig['ieee80211ac']) === '1') { + $selectedHwMode = 'ac'; + } + } + if (isset($arrConfig['ieee80211w'])) { + if (strval($arrConfig['ieee80211w']) === '2') { + $selectedHwMode = 'w'; + } + } + if (!in_array($arrConfig['country_code'], $countries_5Ghz_max48ch)) { + $hwModeDisabled = 'ac'; + if ($selectedHwMode === $hwModeDisabled) { + unset($selectedHwMode); + } + } + echo renderTemplate( "hostapd", compact( "status", @@ -124,7 +148,9 @@ function DisplayHostAPDConfig() "arrTxPower", "txpower", "arrHostapdConf", - "operatingSystem" + "operatingSystem", + "selectedHwMode", + "hwModeDisabled" ) ); } diff --git a/includes/wireguard.php b/includes/wireguard.php old mode 100644 new mode 100755 diff --git a/locale/en_US/LC_MESSAGES/messages.mo b/locale/en_US/LC_MESSAGES/messages.mo index f8d9ba40..c1a7c5c7 100644 Binary files a/locale/en_US/LC_MESSAGES/messages.mo and b/locale/en_US/LC_MESSAGES/messages.mo differ diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po index 1b51ca08..fd1ff0c1 100644 --- a/locale/en_US/LC_MESSAGES/messages.po +++ b/locale/en_US/LC_MESSAGES/messages.po @@ -585,6 +585,21 @@ msgstr "Sets the txpower option for the AP interface and the config msgid "dBm is a unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). 30 dBm is equal to 1000 mW, while 0 dBm equals 1.25 mW." msgstr "dBm is a unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). 30 dBm is equal to 1000 mW, while 0 dBm equals 1.25 mW." +msgid "The selected interface (%s) has support for the 2.4 GHz wireless band only." +msgstr "The selected interface (%s) has support for the 2.4 GHz wireless band only." + +msgid "The selected interface (%s) has support for the 2.5 GHz wireless band only." +msgstr "The selected interface (%s) has support for the 2.5 GHz wireless band only." + +msgid "The selected interface (%s) has support for both the 2.4 and 5 GHz wireless bands." +msgstr "The selected interface (%s) has support for both the 2.4 and 5 GHz wireless bands." + +msgid "The selected interface (%s) does not support wireless mode operation." +msgstr "The selected interface (%s) does not support wireless mode operation." + +msgid "The 802.11ac 5 GHz option is disabled until a compatible wireless regulatory domain is set." +msgstr "The 802.11ac 5 GHz option is disabled until a compatible wireless regulatory domain is set." + #: includes/networking.php msgid "Summary" msgstr "Summary" diff --git a/templates/hostapd/advanced.php b/templates/hostapd/advanced.php index 89d90c72..d765d34c 100644 --- a/templates/hostapd/advanced.php +++ b/templates/hostapd/advanced.php @@ -56,10 +56,8 @@
- "> - + + txpower option for the AP interface and the configured country."); ?>
diff --git a/templates/hostapd/basic.php b/templates/hostapd/basic.php index 90fd18d2..f421490d 100644 --- a/templates/hostapd/basic.php +++ b/templates/hostapd/basic.php @@ -3,9 +3,7 @@
- +
@@ -17,32 +15,9 @@
- + + +
">