Update public source

This commit is contained in:
2026-10-16 09:23:03 +03:00
parent bb85bfc417
commit 8996648901
+63
View File
@@ -613,6 +613,69 @@ def get_nm_wifi_devices():
return devices, None return devices, None
def get_active_vpn_connections():
command = [
"nmcli",
"--terse",
"--escape",
"yes",
"--fields",
"TYPE,DEVICE",
"connection",
"show",
"--active"
]
try:
result = subprocess.run(
command,
capture_output=True,
text=True,
timeout=10,
env={
**os.environ,
"LC_ALL": "C"
}
)
except Exception as error:
return [], f"NetworkManager VPN query failed: {error}"
if result.returncode != 0:
error = (
result.stderr.strip()
or
f"nmcli exited with code {result.returncode}"
)
return [], error
vpn_connections = []
for line in result.stdout.splitlines():
parts = line.split(":", 1)
if len(parts) != 2:
continue
connection_type, device = parts
if connection_type in ("vpn", "wireguard"):
vpn_connections.append(
{
"type": connection_type,
"device": device
}
)
return vpn_connections, None
def get_wifi_interfaces(): def get_wifi_interfaces():
try: try: