mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Merge pull request #1314 from RaspAP/mode-compatibility
Wireless mode tooltip
This commit is contained in:
commit
8be62bb811
12 changed files with 119 additions and 36 deletions
42
ajax/networking/get_frequencies.php
Normal file
42
ajax/networking/get_frequencies.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
require '../../includes/csrf.php';
|
||||
require_once '../../includes/config.php';
|
||||
require_once '../../includes/locale.php';
|
||||
|
||||
if (isset($_POST['interface'])) {
|
||||
|
||||
define( 'NL80211_BAND_24GHZ', 0x1 );
|
||||
define( 'NL80211_BAND_5GHZ', 0x2 );
|
||||
$iface = escapeshellcmd($_POST['interface']);
|
||||
|
||||
// get physical device for selected interface
|
||||
exec("iw dev | awk '/$iface/ {print line}{line = $0}'", $return);
|
||||
$phy = $return[0];
|
||||
|
||||
// get frequencies supported by device
|
||||
exec('iw '.$phy.' info | sed -rn "s/^.*\*\s([0-9]{4})\sMHz.*/\1/p"', $frequencies);
|
||||
|
||||
if (count(preg_grep('/^24[0-9]{2}/i', $frequencies)) >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);
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
0
includes/firewall.php
Normal file → Executable file
0
includes/firewall.php
Normal file → Executable file
|
@ -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 '<i class="fas fa-question-circle text-muted ' .$opt1.'" id="' .$id. '" data-toggle="tooltip" ' .$opt2. ' data-placement="auto" title="' . _($msg). '"></i>';
|
||||
}
|
||||
|
||||
|
|
0
includes/get_clients.php
Normal file → Executable file
0
includes/get_clients.php
Normal file → Executable file
|
@ -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"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
0
includes/wireguard.php
Normal file → Executable file
0
includes/wireguard.php
Normal file → Executable file
Binary file not shown.
|
@ -585,6 +585,21 @@ msgstr "Sets the <code>txpower</code> 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"
|
||||
|
|
|
@ -56,10 +56,8 @@
|
|||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cbxtxpower"><?php echo _("Transmit power (dBm)") ?></label>
|
||||
<i class="fas fa-question-circle text-muted" data-toggle="tooltip" data-placement="auto" title="<?php echo _("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."); ?>"></i>
|
||||
<?php
|
||||
SelectorOptions('txpower', $arrTxPower, $txpower, 'cbxtxpower');
|
||||
?>
|
||||
<?php getTooltip('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.', 'tiptxpower'); ?>
|
||||
<?php SelectorOptions('txpower', $arrTxPower, $txpower, 'cbxtxpower'); ?>
|
||||
<small id="txpower_help" class="text-muted"><?php echo _("Sets the <code>txpower</code> option for the AP interface and the configured country."); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cbxinterface"><?php echo _("Interface") ;?></label>
|
||||
<?php
|
||||
SelectorOptions('interface', $interfaces, $arrConfig['interface'], 'cbxinterface');
|
||||
?>
|
||||
<?php SelectorOptions('interface', $interfaces, $arrConfig['interface'], 'cbxinterface', 'setHardwareModeTooltip'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -17,32 +15,9 @@
|
|||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cbxhwmode"><?php echo _("Wireless Mode") ;?></label>
|
||||
<?php
|
||||
$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);
|
||||
}
|
||||
}
|
||||
SelectorOptions('hw_mode', $arr80211Standard, $selectedHwMode, 'cbxhwmode', 'loadChannelSelect', $hwModeDisabled); ?>
|
||||
<?php getTooltip(null, 'tiphwmode', true); ?>
|
||||
<?php SelectorOptions('hw_mode', $arr80211Standard, $selectedHwMode, 'cbxhwmode', 'loadChannelSelect', $hwModeDisabled); ?>
|
||||
<div id="hwmode" data-tooltip="<?php echo _("The 802.11ac 5 GHz option is disabled until a compatible wireless regulatory domain is set."); ?>"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
Loading…
Reference in a new issue