mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Merge pull request #37 from RaspAP/zbchristian-openvpn-fix
Fix openvpn activation and config display
This commit is contained in:
commit
daffef71c8
3 changed files with 10 additions and 7 deletions
|
@ -291,7 +291,7 @@ $('#ovpn-confirm-delete').on('show.bs.modal', function (e) {
|
|||
});
|
||||
|
||||
$('#ovpn-confirm-activate').on('click', '.btn-activate', function (e) {
|
||||
var cfg_id = $(this).data('recordId');
|
||||
var cfg_id = $(this).data('record-id');
|
||||
$.post('ajax/openvpn/activate_ovpncfg.php',{'cfg_id':cfg_id},function(data){
|
||||
jsonData = JSON.parse(data);
|
||||
$("#ovpn-confirm-activate").modal('hide');
|
||||
|
|
|
@ -54,6 +54,8 @@ function DisplayOpenVPNConfig()
|
|||
$authPassword = next($auth);
|
||||
}
|
||||
$clients = preg_grep('/_client.(conf)$/', scandir(pathinfo(RASPI_OPENVPN_CLIENT_CONFIG, PATHINFO_DIRNAME)));
|
||||
exec("readlink ".RASPI_OPENVPN_CLIENT_CONFIG." | xargs basename", $ret);
|
||||
$conf_default = empty($ret) ? "none" : $ret[0];
|
||||
|
||||
$logEnable = 0;
|
||||
if (!empty($_POST) && !isset($_POST['log-openvpn'])) {
|
||||
|
@ -79,7 +81,8 @@ function DisplayOpenVPNConfig()
|
|||
"public_ip",
|
||||
"authUser",
|
||||
"authPassword",
|
||||
"clients"
|
||||
"clients",
|
||||
"conf_default"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
</p>
|
||||
<div class="openvpn-configs js-openvpn-configs-container">
|
||||
<?php foreach ($clients as $client) :
|
||||
if ($client == "client.conf") {
|
||||
$label = file_get_meta(RASPI_OPENVPN_CLIENT_CONFIG,'#\sfilename\s(.*)');
|
||||
if ($client == $conf_default) {
|
||||
$btn_class = "active";
|
||||
} else {
|
||||
$label = preg_replace('/_client$/','',pathinfo($client, PATHINFO_FILENAME));
|
||||
$client = $label;
|
||||
$btn_class = "disabled";
|
||||
}?>
|
||||
}
|
||||
$label = preg_replace('/_client$/','',pathinfo($client, PATHINFO_FILENAME));
|
||||
$client = $label;
|
||||
?>
|
||||
<div class="row mt-2" id="openvpn-client-row-<?php echo htmlspecialchars($client, ENT_QUOTES); ?>" >
|
||||
<div class="col-md-6 col-xs-4">
|
||||
<label><?php echo htmlspecialchars($label, ENT_QUOTES); ?></label>
|
||||
|
|
Loading…
Reference in a new issue