fix: saved data causes tags to be lost

This commit is contained in:
hstyi
2025-06-30 00:32:27 +08:00
committed by hstyi
parent 885c0a6337
commit e21e9f9ed9

View File

@@ -206,6 +206,14 @@ class NewHostDialogV2(owner: Window, private val editHost: Host? = null) : Dialo
var host = panel.getHost() var host = panel.getHost()
if (editHost != null) { if (editHost != null) {
val extras = mutableMapOf<String, String>()
extras.putAll(editHost.options.extras)
extras.putAll(host.options.extras)
val tags = mutableListOf<String>()
tags.addAll(editHost.options.tags)
tags.addAll(host.options.tags)
host = editHost.copy( host = editHost.copy(
name = host.name, name = host.name,
protocol = host.protocol, protocol = host.protocol,
@@ -215,7 +223,7 @@ class NewHostDialogV2(owner: Window, private val editHost: Host? = null) : Dialo
authentication = host.authentication, authentication = host.authentication,
proxy = host.proxy, proxy = host.proxy,
remark = host.remark, remark = host.remark,
options = host.options, options = host.options.copy(extras = extras, tags = tags),
tunnelings = host.tunnelings, tunnelings = host.tunnelings,
) )
} }