From e62bb9c04e70d175e0e0301f941346ff1f8f7cf0 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Sat, 12 Jun 2021 14:28:09 +0200 Subject: [PATCH 1/5] Fix display of active openvpn config --- templates/openvpn/configs.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/openvpn/configs.php b/templates/openvpn/configs.php index dc624c63..a7955739 100644 --- a/templates/openvpn/configs.php +++ b/templates/openvpn/configs.php @@ -7,6 +7,10 @@
openvpn-client service.") ?>

+ Date: Sat, 12 Jun 2021 14:29:37 +0200 Subject: [PATCH 2/5] Fix openvpn activation of configuration --- app/js/custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/js/custom.js b/app/js/custom.js index b834aa30..4ba0436b 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -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'); From a963c0564f2a407ae70821b748ca9a556bb11139 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Sat, 12 Jun 2021 14:36:03 +0200 Subject: [PATCH 3/5] Correct displayed configuration name --- templates/openvpn/configs.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/openvpn/configs.php b/templates/openvpn/configs.php index a7955739..dad4a795 100644 --- a/templates/openvpn/configs.php +++ b/templates/openvpn/configs.php @@ -12,14 +12,14 @@ $conf_default = empty($ret) ? "none" : $ret[0]; ?> + } + $label = preg_replace('/_client$/','',pathinfo($client, PATHINFO_FILENAME)); + $client = $label; + ?>
From 4bfbfc40f1130bf787f91d5938bbde6a43223b6d Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Sat, 12 Jun 2021 16:19:31 +0200 Subject: [PATCH 4/5] Remove determination of the default config --- templates/openvpn/configs.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/templates/openvpn/configs.php b/templates/openvpn/configs.php index dad4a795..c3e578ee 100644 --- a/templates/openvpn/configs.php +++ b/templates/openvpn/configs.php @@ -7,10 +7,6 @@
openvpn-client service.") ?>

- Date: Sat, 12 Jun 2021 16:21:20 +0200 Subject: [PATCH 5/5] Insert determination of the default config --- includes/openvpn.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/openvpn.php b/includes/openvpn.php index 711c1c45..67084df4 100755 --- a/includes/openvpn.php +++ b/includes/openvpn.php @@ -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" ) ); }