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
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
DankIcon {
|
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
|
size: Theme.iconSize - 4
|
||||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
@@ -250,17 +250,35 @@ DankPopout {
|
|||||||
spacing: 2
|
spacing: 2
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: modelData.name
|
text: modelData.name
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: (modelData.type === "wireguard" ? "WireGuard" : (modelData.type ? modelData.type.toUpperCase() : "VPN"))
|
text: {
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
if (modelData.type === "wireguard") return "WireGuard"
|
||||||
color: Theme.surfaceTextMedium
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Item { Layout.fillWidth: true; height: 1 }
|
Item { Layout.fillWidth: true; height: 1 }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: getProfiles
|
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
|
running: false
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
@@ -81,7 +81,8 @@ Singleton {
|
|||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const parts = line.split(':')
|
const parts = line.split(':')
|
||||||
if (parts.length >= 3 && (parts[2] === "vpn" || parts[2] === "wireguard")) {
|
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
|
root.profiles = out
|
||||||
|
|||||||
Reference in New Issue
Block a user