Update w/ common public_ip function

This commit is contained in:
billz
2021-07-07 23:25:23 +01:00
parent 84fcedc203
commit 8374d032b3
3 changed files with 10 additions and 4 deletions

View File

@@ -42,11 +42,9 @@ function DisplayOpenVPNConfig()
}
exec('pidof openvpn | wc -l', $openvpnstatus);
exec('wget https://ipinfo.io/ip -qO -', $return);
$serviceStatus = $openvpnstatus[0] == 0 ? "down" : "up";
$auth = file(RASPI_OPENVPN_CLIENT_LOGIN, FILE_IGNORE_NEW_LINES);
$public_ip = $return[0];
$public_ip = get_public_ip();
// parse client auth credentials
if (!empty($auth)) {

View File

@@ -58,12 +58,14 @@ function DisplayWireGuardConfig()
exec('pidof wg-crypt-wg0 | wc -l', $wgstatus);
$serviceStatus = $wgstatus[0] == 0 ? "down" : "up";
$wg_state = ($wgstatus[0] > 0);
$public_ip = get_public_ip();
echo renderTemplate(
"wireguard", compact(
"status",
"wg_state",
"serviceStatus",
"public_ip",
"optRules",
"wg_log",
"peer_id",
@@ -132,7 +134,7 @@ function SaveWireGuardUpload($status, $file, $optRules)
file_put_contents($tmp_wgconfig, $tmp_contents);
}
// Move uploaded file from to destination
// Move processed file from tmp to destination
system("sudo mv $tmp_wgconfig ". RASPI_WIREGUARD_CONFIG, $return);
if ($return ==0) {