mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Correct internet device GUI and udev config
This commit is contained in:
parent
e8d0fab463
commit
76e2eecaec
9 changed files with 46 additions and 35 deletions
|
@ -88,7 +88,7 @@ if (isset($_POST['interface'])) {
|
|||
$cfg['static'] = $_POST[$int.'-static'];
|
||||
$cfg['failover'] = $_POST[$int.'-failover'];
|
||||
}
|
||||
if (write_php_ini($cfg, RASPI_CONFIG_NETWORKING.'/'.$file)) {
|
||||
if (write_php_ini($cfg, RASPI_CONFIG.'/networking/'.$file)) {
|
||||
$jsonData = ['return'=>0,'output'=>['Successfully Updated Network Configuration']];
|
||||
} else {
|
||||
$jsonData = ['return'=>1,'output'=>['Error saving network configuration to file']];
|
||||
|
|
|
@ -130,8 +130,8 @@ function setupBtns() {
|
|||
$('#btnSummaryRefresh').click(function(){getAllInterfaces();});
|
||||
$('.intsave').click(function(){
|
||||
var int = $(this).data('int');
|
||||
saveNetDeviceSettings(int);
|
||||
saveNetworkSettings(int);
|
||||
var opts = $(this).data('opts');
|
||||
saveNetDeviceSettings(int,opts);
|
||||
});
|
||||
$('.intapply').click(function(){
|
||||
applyNetworkSettings();
|
||||
|
|
|
@ -25,6 +25,8 @@ define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc');
|
|||
define('RASPI_LIGHTTPD_CONFIG', '/etc/lighttpd/lighttpd.conf');
|
||||
define('RASPI_ACCESS_CHECK_IP', '1.1.1.1');
|
||||
define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one');
|
||||
define('RASPI_CLIENT_CONFIG_PATH', '/etc/raspap/networking/client_udev_prototypes.json');
|
||||
define('RASPI_CLIENT_SCRIPT_PATH', '/usr/local/sbin');
|
||||
|
||||
// Constant for the 5GHz wireless regulatory domain
|
||||
define('RASPI_5GHZ_ISO_ALPHA2', array('NL','US'));
|
||||
|
|
|
@ -96,12 +96,12 @@ function DisplayDashboard(&$extraFooterScripts)
|
|||
$clientinfo=array("name"=>"none","type"=>-1,"connected"=>"n");
|
||||
$raspi_client=$_SESSION['wifi_client_interface'];
|
||||
load_client_config();
|
||||
$clients = getClients(false);
|
||||
if(!empty($clients)) {
|
||||
$ncl=$clients["clients"];
|
||||
$client_devs = getClients(false);
|
||||
if(!empty($client_devs)) {
|
||||
$ncl=$client_devs["clients"];
|
||||
if($ncl > 0) {
|
||||
$ty=-1;
|
||||
foreach($clients["device"] as $dev) {
|
||||
foreach($client_devs["device"] as $dev) {
|
||||
if(($id=array_search($dev["type"],$_SESSION["net-device-types"])) > $ty && !$dev["isAP"]) {
|
||||
$ty=$id;
|
||||
$clientinfo=$dev;
|
||||
|
@ -162,6 +162,7 @@ function DisplayDashboard(&$extraFooterScripts)
|
|||
$client_interface = $clientinfo["name"];
|
||||
}
|
||||
$apInterface = $_SESSION['ap_interface'];
|
||||
$clientInterface = $raspi_client;
|
||||
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
|
||||
if (getBridgedState()) {
|
||||
$moreLink = "hostapd_conf";
|
||||
|
|
|
@ -728,6 +728,8 @@ function getNightmode(){
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// search array for matching string and return only first matching group
|
||||
function preg_only_match($pat,$haystack) {
|
||||
$match = "";
|
||||
|
@ -738,5 +740,6 @@ function preg_only_match($pat,$haystack) {
|
|||
}
|
||||
return $match;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
@ -137,6 +137,10 @@ function getClients($simple=true) {
|
|||
break;
|
||||
default:
|
||||
}
|
||||
if (!isset($cl["device"][$i]["signal"])){
|
||||
$cl["device"][$i]["signal"]= $cl["device"][$i]["connected"] == "n" ? "-100 dB (0%)": "0 dB (100%)";;
|
||||
}
|
||||
if (!isset($cl["device"][$i]["isAP"])) $cl["device"][$i]["isAP"]=false;
|
||||
}
|
||||
}
|
||||
return $cl;
|
||||
|
|
|
@ -157,3 +157,4 @@ function getWifiInterface()
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -107,7 +107,7 @@
|
|||
<?php endif; ?>
|
||||
<?php foreach (array_slice($clients,0, 2) as $client) : ?>
|
||||
<tr>
|
||||
<?php if ($arrHostapdConf['BridgedEnable'] == 1): ?>
|
||||
<?php if ($bridgedEnable == 1): ?>
|
||||
<td><?php echo htmlspecialchars($client, ENT_QUOTES) ?></td>
|
||||
<?php else : ?>
|
||||
<?php $props = explode(' ', $client) ?>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="nav-item"><a class="nav-link active" href="#summary" aria-controls="summary" role="tab" data-toggle="tab"><?php echo _("Summary"); ?></a></li>
|
||||
<?php if (!$bridgedEnabled) : // no interface details when bridged ?>
|
||||
<li role="presentation" class="nav-item"><a class="nav-link" href="#mobiledata" aria-controls="mobiledata" role="tab" data-toggle="tab">Mobile Data Settings</a></li>
|
||||
<li role="presentation" class="nav-item"><a class="nav-link" href="#netdevices" aria-controls="netdevices" role="tab" data-toggle="tab">Network Devices</a></li>
|
||||
<li role="presentation" class="nav-item"><a class="nav-link" href="#mobiledata" aria-controls="mobiledata" role="tab" data-toggle="tab">Mobile Data Settings</a></li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
@ -84,31 +84,6 @@
|
|||
<?php $arrMD = parse_ini_file('/etc/raspap/networking/mobiledata.ini');
|
||||
if ($arrMD==false) { $arrMD=[]; $arrMD["pin"]=$arrMD["apn"]=$arrMD["apn_user"]=$arrMD["apn_pw"]=$arrMD["router_user"]=$arrMD["router_pw"]=""; }
|
||||
?>
|
||||
<div role="tabpanel" class="tab-pane fade in" id="mobiledata">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<h4 class="mt-3"><?php echo _("Settings for Mobile Data Devices") ?></h4>
|
||||
<hr />
|
||||
<form id="frm-mobiledata">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<div class="form-group">
|
||||
<label for="pin-mobile"><?php echo _("PIN of SIM card") ?></label>
|
||||
<input type="number" class="form-control" id="pin-mobile" placeholder="1234" value="<?php echo $arrMD["pin"]?>" >
|
||||
</div>
|
||||
<h4 class="mt-3"><?php echo _("APN Settings (Modem device ppp0)") ?></h4>
|
||||
<div class="form-group">
|
||||
<label for="apn-mobile"><?php echo _("Access Point Name (APN)") ?></label>
|
||||
<input type="text" class="form-control" id="apn-mobile" placeholder="web.myprovider.com" value="<?php echo $arrMD["apn"]?>" >
|
||||
<label for="apn-user-mobile"><?php echo _("Username") ?></label>
|
||||
<input type="text" class="form-control" id="apn-user-mobile" value="<?php echo $arrMD["apn_user"]?>" >
|
||||
<label for="apn-pw-mobile"><?php echo _("Password") ?></label>
|
||||
<input type="text" class="form-control" id="apn-pw-mobile" value="<?php echo $arrMD["apn_pw"]?>" >
|
||||
</div>
|
||||
<a href="#" class="btn btn-outline btn-primary intsave" data-int="mobiledata"><?php echo _("Save settings") ?></a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-panel -->
|
||||
<div role="tabpanel" class="tab-pane fade in" id="netdevices">
|
||||
<h4 class="mt-3"><?php echo _("Properties of network devices") ?></h4>
|
||||
<div class="row">
|
||||
|
@ -194,6 +169,31 @@
|
|||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-panel -->
|
||||
<div role="tabpanel" class="tab-pane fade in" id="mobiledata">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<h4 class="mt-3"><?php echo _("Settings for Mobile Data Devices") ?></h4>
|
||||
<hr />
|
||||
<form id="frm-mobiledata">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<div class="form-group">
|
||||
<label for="pin-mobile"><?php echo _("PIN of SIM card") ?></label>
|
||||
<input type="number" class="form-control" id="pin-mobile" placeholder="1234" value="<?php echo $arrMD["pin"]?>" >
|
||||
</div>
|
||||
<h4 class="mt-3"><?php echo _("APN Settings (Modem device ppp0)") ?></h4>
|
||||
<div class="form-group">
|
||||
<label for="apn-mobile"><?php echo _("Access Point Name (APN)") ?></label>
|
||||
<input type="text" class="form-control" id="apn-mobile" placeholder="web.myprovider.com" value="<?php echo $arrMD["apn"]?>" >
|
||||
<label for="apn-user-mobile"><?php echo _("Username") ?></label>
|
||||
<input type="text" class="form-control" id="apn-user-mobile" value="<?php echo $arrMD["apn_user"]?>" >
|
||||
<label for="apn-pw-mobile"><?php echo _("Password") ?></label>
|
||||
<input type="text" class="form-control" id="apn-pw-mobile" value="<?php echo $arrMD["apn_pw"]?>" >
|
||||
</div>
|
||||
<a href="#" class="btn btn-outline btn-primary intsave" data-int="mobiledata"><?php echo _("Save settings") ?></a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-panel -->
|
||||
</div>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"><?php echo _("Information provided by /sys/class/net"); ?></div>
|
||||
|
|
Loading…
Reference in a new issue