Update public source
This commit is contained in:
+11
-11
@@ -617,7 +617,7 @@ def get_nm_wifi_devices():
|
||||
|
||||
return devices, None
|
||||
|
||||
def get_active_vpn_connections():
|
||||
def get_active_wireguard_connections():
|
||||
|
||||
command = [
|
||||
"nmcli",
|
||||
@@ -646,7 +646,7 @@ def get_active_vpn_connections():
|
||||
|
||||
except Exception as error:
|
||||
|
||||
return [], f"NetworkManager VPN query failed: {error}"
|
||||
return [], str(error)
|
||||
|
||||
if result.returncode != 0:
|
||||
|
||||
@@ -658,7 +658,7 @@ def get_active_vpn_connections():
|
||||
|
||||
return [], error
|
||||
|
||||
vpn_connections = []
|
||||
wireguard_connections = []
|
||||
|
||||
for line in result.stdout.splitlines():
|
||||
|
||||
@@ -669,16 +669,16 @@ def get_active_vpn_connections():
|
||||
|
||||
connection_type, device = parts
|
||||
|
||||
if connection_type in ("vpn", "wireguard"):
|
||||
if connection_type == "wireguard":
|
||||
|
||||
vpn_connections.append(
|
||||
wireguard_connections.append(
|
||||
{
|
||||
"type": connection_type,
|
||||
"device": device
|
||||
}
|
||||
)
|
||||
|
||||
return vpn_connections, None
|
||||
return wireguard_connections, None
|
||||
|
||||
def get_wifi_interfaces():
|
||||
|
||||
@@ -2441,8 +2441,8 @@ def api_network_wifi_devices():
|
||||
|
||||
devices, error = get_nm_wifi_devices()
|
||||
|
||||
vpn_connections, vpn_error = (
|
||||
get_active_vpn_connections()
|
||||
wireguard_connections, wireguard_error = (
|
||||
get_active_wireguard_connections()
|
||||
)
|
||||
|
||||
if error:
|
||||
@@ -2517,9 +2517,9 @@ def api_network_wifi_devices():
|
||||
if not devices
|
||||
else None
|
||||
),
|
||||
"vpn_active": bool(vpn_connections),
|
||||
"vpn_connections": vpn_connections,
|
||||
"vpn_error": vpn_error
|
||||
"wireguard_active": bool(wireguard_connections),
|
||||
"wireguard_connections": wireguard_connections,
|
||||
"wireguard_error": wireguard_error
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user