1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 02:52:07 -04:00

Fix VPN UI for active transient entries (#2312)

Co-authored-by: louzt <18044171+louzt@users.noreply.github.com>
This commit is contained in:
David Mireles
2026-04-30 09:41:41 -06:00
committed by GitHub
parent 2877c63c97
commit 23ed795e85
4 changed files with 58 additions and 7 deletions

View File

@@ -81,7 +81,46 @@ Singleton {
property string pendingVpnUuid: ""
property var vpnBusyStartTime: 0
property alias profiles: root.vpnProfiles
property var profiles: {
const mergedProfiles = vpnProfiles ? vpnProfiles.slice() : [];
const seen = new Set();
for (const profile of mergedProfiles) {
if (profile?.uuid)
seen.add("uuid:" + profile.uuid);
if (profile?.name)
seen.add("name:" + profile.name);
}
for (const active of vpnActive || []) {
const entryUuid = active?.uuid || active?.name || "";
const uuidKey = active?.uuid ? "uuid:" + active.uuid : "";
const nameKey = active?.name ? "name:" + active.name : "";
if ((uuidKey && seen.has(uuidKey)) || (!uuidKey && nameKey && seen.has(nameKey)))
continue;
mergedProfiles.unshift({
uuid: entryUuid,
name: active?.name || I18n.tr("Active VPN"),
serviceType: active?.serviceType || "",
type: active?.type || "",
typeLabel: active?.typeLabel || active?.vpnType || "",
state: active?.state || "",
device: active?.device || "",
transient: true,
canDelete: false,
canExpand: false
});
if (uuidKey)
seen.add(uuidKey);
if (nameKey)
seen.add(nameKey);
}
return mergedProfiles;
}
property alias activeConnections: root.vpnActive
property var activeUuids: vpnActive.map(v => v.uuid).filter(u => !!u)
property var activeNames: vpnActive.map(v => v.name).filter(n => !!n)