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