Merge First Edition of RaspAP/raspap-insiders

This commit is contained in:
billz
2021-11-25 09:02:59 +00:00
parent bf5de0a81d
commit 2ca5f25dff
15 changed files with 177 additions and 379 deletions

View File

@@ -378,7 +378,7 @@ tspan, rect {
fill: #d2d2d2;
}
text-muted {
.text-muted {
font-size: 0.8rem;
}

View File

@@ -10,12 +10,25 @@ if (!isset($_SERVER['HTTP_REFERER'])) {
exit;
}
function qr_encode($str)
{
return preg_replace('/(?<!\\\)([\":;,])/', '\\\\\1', $str);
}
$hostapd = parse_ini_file(RASPI_HOSTAPD_CONFIG, false, INI_SCANNER_RAW);
// assume wpa encryption and get the passphrase
$type = "WPA";
$password = isset($hostapd['wpa_psk']) ? $hostapd['wpa_psk'] : $hostapd['wpa_passphrase'];
// use wep if configured
$wep_default_key = intval($hostapd['wep_default_key']);
$wep_key = 'wep_key' . $wep_default_key;
if (array_key_exists($wep_key, $hostapd)) {
$type = "WEP";
$password = $hostapd[$wep_key];
}
// if password is still empty, assume nopass
if (empty($password)) {
$type = "nopass";

View File

@@ -1,6 +1,5 @@
function msgShow(retcode,msg) {
if(retcode == 0) {
var alertType = 'success';
if(retcode == 0) { var alertType = 'success';
} else if(retcode == 2 || retcode == 1) {
var alertType = 'danger';
}
@@ -138,8 +137,7 @@ function setupBtns() {
$('#btnSummaryRefresh').click(function(){getAllInterfaces();});
$('.intsave').click(function(){
var int = $(this).data('int');
var opts = $(this).data('opts');
saveNetDeviceSettings(int,opts);
saveNetworkSettings(int);
});
$('.intapply').click(function(){
applyNetworkSettings();
@@ -182,24 +180,6 @@ function loadWifiStations(refresh) {
}
$(".js-reload-wifi-stations").on("click", loadWifiStations(true));
function saveNetDeviceSettings(int,opts="") {
var frmInt = $('#frm-'+int).find(':input');
var arrFormData = {};
$.each(frmInt,function(i3,v3){
if($(v3).attr('type') == 'radio') {
arrFormData[$(v3).attr('id')] = $(v3).prop('checked');
} else {
arrFormData[$(v3).attr('id')] = $(v3).val();
}
});
arrFormData['interface'] = int;
arrFormData['opts'] = opts;
$.post('ajax/networking/save_net_dev_config.php',arrFormData,function(data){
var jsonData = JSON.parse(data);
$('#msgNetworking').html(msgShow(jsonData['return'],jsonData['output']));
});
}
/*
Populates the DHCP server form fields
Option toggles are set dynamically depending on the loaded configuration