diff --git a/app/js/custom.js b/app/js/custom.js index d5c1abe5..3523fc56 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -120,6 +120,11 @@ $(document).on("click", "#gen_wpa_passphrase", function(e) { $('#txtwpapassphrase').val(genPassword(63)); }); +// Enable Bootstrap tooltips +$(function () { + $('[data-toggle="tooltip"]').tooltip() +}) + function genPassword(pwdLen) { var pwdChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var rndPass = Array(pwdLen).fill(pwdChars).map(function(x) { return x[Math.floor(Math.random() * x.length)] }).join(''); diff --git a/config/defaults.json b/config/defaults.json index faab15b6..67948d0d 100644 --- a/config/defaults.json +++ b/config/defaults.json @@ -49,6 +49,9 @@ "AllowedIPs": ["10.8.2.0/24"], "PersistentKeepalive": [ "15" ] } + }, + "txpower": { + "dbm": [ "auto", "30", "20", "17", "10", "6", "3", "1", "0" ] } } diff --git a/includes/functions.php b/includes/functions.php index 2f1c502b..a3ffbf45 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -152,15 +152,16 @@ function getDefaultNetValue($svc,$iface,$key) * Returns default options for the specified service * * @param string $svc + * @param string $key * @return object $json */ -function getDefaultNetOpts($svc) +function getDefaultNetOpts($svc,$key) { $json = json_decode(file_get_contents(RASPI_CONFIG_NETWORK), true); if ($json === null) { return false; } else { - return $json[$svc]['options']; + return $json[$svc][$key]; } } @@ -774,4 +775,4 @@ function preg_only_match($pat,$haystack) { function qr_encode($str) { return preg_replace('/(? 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None")); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); + $arrTxPower = getDefaultNetOpts('txpower','dbm'); $managedModeEnabled = false; exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); sort($interfaces); @@ -102,6 +103,7 @@ function DisplayHostAPDConfig() "selectedHwMode", "arrSecurity", "arrEncType", + "arrTxPower", "arrHostapdConf" ) ); @@ -306,13 +308,13 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $ip_address.= (!preg_match('/.*\/\d+/', $ip_address)) ? '/'.mask2cidr($netmask) : null; if ($bridgedEnable == 1) { - $config = array_keys(getDefaultNetOpts('dhcp')); + $config = array_keys(getDefaultNetOpts('dhcp','options')); $config[] = PHP_EOL.'# RaspAP br0 configuration'; $config[] = 'denyinterfaces eth0 wlan0'; $config[] = 'interface br0'; $config[] = PHP_EOL; } elseif ($wifiAPEnable == 1) { - $config = array_keys(getDefaultNetOpts('dhcp')); + $config = array_keys(getDefaultNetOpts('dhcp','options')); $config[] = PHP_EOL.'# RaspAP uap0 configuration'; $config[] = 'interface uap0'; $config[] = 'static ip_address='.$ip_address; diff --git a/installers/raspap.sudoers b/installers/raspap.sudoers index 93389d4d..355fd8eb 100644 --- a/installers/raspap.sudoers +++ b/installers/raspap.sudoers @@ -32,6 +32,7 @@ www-data ALL=(ALL) NOPASSWD:/sbin/ip link set wlan[0-9] up www-data ALL=(ALL) NOPASSWD:/sbin/ip -s a f label wlan[0-9] www-data ALL=(ALL) NOPASSWD:/sbin/ifup * www-data ALL=(ALL) NOPASSWD:/sbin/ifdown * +www-data ALL=(ALL) NOPASSWD:/sbin/iw www-data ALL=(ALL) NOPASSWD:/bin/cp /etc/raspap/networking/dhcpcd.conf /etc/dhcpcd.conf www-data ALL=(ALL) NOPASSWD:/etc/raspap/hostapd/enablelog.sh www-data ALL=(ALL) NOPASSWD:/etc/raspap/hostapd/disablelog.sh diff --git a/templates/hostapd/advanced.php b/templates/hostapd/advanced.php index f7c9ee93..579e166c 100644 --- a/templates/hostapd/advanced.php +++ b/templates/hostapd/advanced.php @@ -1,3 +1,4 @@ +' . var_export($arrTxPower, true) . ''; ?>