From 9121eff8d8ca52632f2b0b4feb59bf61113aa1e1 Mon Sep 17 00:00:00 2001 From: hstyi Date: Tue, 27 May 2025 09:57:12 +0800 Subject: [PATCH] feat: support importing RDP protocol from CSV (#600) --- src/main/kotlin/app/termora/NewHostTree.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/termora/NewHostTree.kt b/src/main/kotlin/app/termora/NewHostTree.kt index 87bbd9d..5cccf64 100644 --- a/src/main/kotlin/app/termora/NewHostTree.kt +++ b/src/main/kotlin/app/termora/NewHostTree.kt @@ -856,7 +856,8 @@ class NewHostTree : SimpleTree() { val port = map["Port"]?.toIntOrNull() ?: 22 val username = map["Username"] ?: StringUtils.EMPTY val protocol = map["Protocol"] ?: "SSH" - if (!StringUtils.equalsIgnoreCase(protocol, "SSH")) continue + // 仅支持 SSH、RDP 协议 + if (StringUtils.equalsAnyIgnoreCase(protocol, "SSH", "RDP").not()) continue if (StringUtils.isAllBlank(hostname, label)) continue var p: HostTreeNode? = null @@ -891,7 +892,7 @@ class NewHostTree : SimpleTree() { host = hostname, port = port, username = username, - protocol = Protocol.SSH, + protocol = runCatching { Protocol.valueOf(protocol) }.getOrNull() ?: Protocol.SSH, parentId = p?.host?.id ?: StringUtils.EMPTY, ) )