mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-13 00:42:49 -05:00
VPN profiles: include vpn.service-type for TYPE=vpn; show friendly protocol label in popout (OpenVPN, WireGuard, IPsec, etc.); fix active icon to support multi-active
This commit is contained in:
@@ -240,7 +240,7 @@ DankPopout {
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: modelData.uuid === VpnService.activeUuid ? "vpn_lock" : "vpn_key_off"
|
||||
name: VpnService.isActiveUuid(modelData.uuid) ? "vpn_lock" : "vpn_key_off"
|
||||
size: Theme.iconSize - 4
|
||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
@@ -257,7 +257,25 @@ DankPopout {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: (modelData.type === "wireguard" ? "WireGuard" : (modelData.type ? modelData.type.toUpperCase() : "VPN"))
|
||||
text: {
|
||||
if (modelData.type === "wireguard") return "WireGuard"
|
||||
var svc = modelData.serviceType || ""
|
||||
if (svc.indexOf("openvpn") !== -1) return "OpenVPN"
|
||||
if (svc.indexOf("wireguard") !== -1) return "WireGuard (plugin)"
|
||||
if (svc.indexOf("openconnect") !== -1) return "OpenConnect"
|
||||
if (svc.indexOf("fortissl") !== -1 || svc.indexOf("forti") !== -1) return "Fortinet"
|
||||
if (svc.indexOf("strongswan") !== -1) return "IPsec (strongSwan)"
|
||||
if (svc.indexOf("libreswan") !== -1) return "IPsec (Libreswan)"
|
||||
if (svc.indexOf("l2tp") !== -1) return "L2TP/IPsec"
|
||||
if (svc.indexOf("pptp") !== -1) return "PPTP"
|
||||
if (svc.indexOf("vpnc") !== -1) return "Cisco (vpnc)"
|
||||
if (svc.indexOf("sstp") !== -1) return "SSTP"
|
||||
if (svc) {
|
||||
var parts = svc.split('.')
|
||||
return parts[parts.length-1]
|
||||
}
|
||||
return "VPN"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ Singleton {
|
||||
|
||||
Process {
|
||||
id: getProfiles
|
||||
command: ["nmcli", "-t", "-f", "NAME,UUID,TYPE", "connection", "show"]
|
||||
command: ["bash", "-lc", "nmcli -t -f NAME,UUID,TYPE connection show | while IFS=: read -r name uuid type; do case \"$type\" in vpn) svc=$(nmcli -g vpn.service-type connection show uuid \"$uuid\" 2>/dev/null); echo \"$name:$uuid:$type:$svc\" ;; wireguard) echo \"$name:$uuid:$type:\" ;; *) : ;; esac; done"]
|
||||
running: false
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
@@ -81,7 +81,8 @@ Singleton {
|
||||
for (const line of lines) {
|
||||
const parts = line.split(':')
|
||||
if (parts.length >= 3 && (parts[2] === "vpn" || parts[2] === "wireguard")) {
|
||||
out.push({ name: parts[0], uuid: parts[1], type: parts[2] })
|
||||
const svc = parts.length >= 4 ? parts[3] : ""
|
||||
out.push({ name: parts[0], uuid: parts[1], type: parts[2], serviceType: svc })
|
||||
}
|
||||
}
|
||||
root.profiles = out
|
||||
|
||||
Reference in New Issue
Block a user