From 01af0d7a48fd45182db325f72d2aa4fcb7378acc Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Sun, 22 Nov 2026 10:05:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(desktop):=20=E5=9B=BA=E5=AE=9A=20Core=20mai?= =?UTF-8?q?n=202e4be2c=EF=BC=8C=E8=BF=9E=E6=8E=A5=E6=8E=A5=E5=8F=97=20Wind?= =?UTF-8?q?ows=20=E5=9F=9F=E7=94=A8=E6=88=B7=EF=BC=8CMotty=20=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=8A=8A=E8=A2=AB=E6=8B=92=E7=9A=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=A0=87=E5=88=B0=E5=AF=B9=E5=BA=94=E5=AD=97=E6=AE=B5=20(#2231?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Core #166:已保存的连接接受 DOMAIN\name 和 name@domain;remote.mottyHosts 对 Lithe 不接受的设置给 invalid 状态,并标在被拒的字段上,不再一律显示“非 SSH”、 错标在地址上。 - Core #165:远程会话结束时释放它建立的搜索索引 (#2277)。 - remote_helpers.go 更新 RemoteImportInvalid、RemoteImportUnsupported 和 Connection 为空时的注释。 - 新增 TestRemoteConnectionsKeepWindowsDomainUsers,经真实 Core 保存两种域用户写法, 只有域的写法报在 user 字段上。 - 功能矩阵 remote-connections 写明域用户导入和“无效”状态。 --- desktop/internal/core/remote_helpers.go | 7 ++-- desktop/internal/core/remote_helpers_test.go | 32 +++++++++++++++++++ scripts/desktop/build-desktop-core.sh | 5 ++- .../features/remote-connections.json | 4 +-- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/desktop/internal/core/remote_helpers.go b/desktop/internal/core/remote_helpers.go index d97ece04d..46be92132 100644 --- a/desktop/internal/core/remote_helpers.go +++ b/desktop/internal/core/remote_helpers.go @@ -99,7 +99,8 @@ const ( RemoteImportExists RemoteImportStatus = "exists" // RemoteImportPattern is a Host line with wildcards or a negation, naming no single host. RemoteImportPattern RemoteImportStatus = "pattern" - // RemoteImportInvalid is a host name Lithe refuses. + // RemoteImportInvalid is a host name Lithe refuses, or a Motty SSH host with a setting Lithe + // refuses; the refused field is marked RemoteMottySkipInvalid. RemoteImportInvalid RemoteImportStatus = "invalid" // RemoteImportUnreadable is a host `ssh -G` failed or timed out for. RemoteImportUnreadable RemoteImportStatus = "unreadable" @@ -197,8 +198,8 @@ type RemoteMottyField struct { // RemoteMottyCandidate is one Motty host. Name is the label an import saves it under, Address // `[user@]host[:port]` and System Motty's operating system tag. Connection is what the import -// saves, nil for RemoteImportUnsupported; ExistingID names the saved entry of a -// RemoteImportExists host. +// saves, nil for RemoteImportUnsupported and RemoteImportInvalid; ExistingID names the saved +// entry of a RemoteImportExists host. type RemoteMottyCandidate struct { Key string `json:"key"` Name string `json:"name"` diff --git a/desktop/internal/core/remote_helpers_test.go b/desktop/internal/core/remote_helpers_test.go index 5890c36b2..a43411190 100644 --- a/desktop/internal/core/remote_helpers_test.go +++ b/desktop/internal/core/remote_helpers_test.go @@ -94,6 +94,38 @@ func TestRemoteParseAddressSplitsTheFields(t *testing.T) { } } +// A Windows domain user, DOMAIN\name or name@domain, is saved as typed; one with only a domain is +// refused on the user field. +func TestRemoteConnectionsKeepWindowsDomainUsers(t *testing.T) { + client := NewClient() + ctx := testContext(t) + var document *string + for _, user := range []string{`CONTOSO\admin`, "admin@contoso.example"} { + saved, err := client.EditRemoteConnections(ctx, document, RemoteConnectionEdit{Save: &RemoteConnectionSave{ + Name: user, Connection: SSHConnection{Host: "192.0.2.10", User: user}, + }}) + if err != nil || saved.ID == "" { + t.Fatalf("save domain user #%d: err = %v", len(user), err) + } + document = saved.Document + } + listed, err := client.SearchRemoteConnections(ctx, document, "") + if err != nil || len(listed.Connections) != 2 { + t.Fatalf("list: %d connections, err = %v", len(listed.Connections), err) + } + for _, entry := range listed.Connections { + if entry.Connection.User != entry.Name { + t.Fatalf("a domain user changed on save (%d bytes saved, %d typed)", len(entry.Connection.User), len(entry.Name)) + } + } + _, err = client.EditRemoteConnections(ctx, document, RemoteConnectionEdit{Save: &RemoteConnectionSave{ + Name: "Domain only", Connection: SSHConnection{Host: "192.0.2.10", User: `CONTOSO\`}, + }}) + if field, reason, ok := RemoteConnectionFieldError(err); !ok || field != "user" || reason != "invalid" { + t.Fatalf("domain only: field %q, reason %q, want user and invalid", field, reason) + } +} + // A port, host:port or URL typed into the Ports window becomes a forward target; a URL keeps its // scheme and path and gives its default port, and a user name or password is refused by reason. func TestRemoteParseForwardAddressReadsPortsAndURLs(t *testing.T) { diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index acbfcd1ee..0c51463b8 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -336,7 +336,10 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the running ones; remote.devcontainerConfigs and remote.devcontainerUp build and start the # container of a devcontainer.json; #163 remote.portRecords keeps a workspace's ports and forwards; # #164 fs.readFile reads only regular files, so a named pipe no longer blocks it (#2231, #2270). -PINNED_CORE_REVISION="57e55d6eb1769afffd15029f408def469fe7d3ab" +# Lithe-core-rust main at 2e4be2c: #166 a connection accepts a Windows domain user (DOMAIN\name, +# name@domain) and remote.mottyHosts marks a refused setting on its own field with the invalid +# status; #165 ending a remote session releases the search indexes it built (#2231, #2277). +PINNED_CORE_REVISION="2e4be2ca23bd8ba83bea93278067b566a7194ead" PROFILE="debug" CHECKOUT_ONLY="no" while [[ $# -gt 0 ]]; do diff --git a/shared/platform-feature-matrix/features/remote-connections.json b/shared/platform-feature-matrix/features/remote-connections.json index a867d921e..164628f3b 100644 --- a/shared/platform-feature-matrix/features/remote-connections.json +++ b/shared/platform-feature-matrix/features/remote-connections.json @@ -46,6 +46,6 @@ ] }, "owner": "Remote", - "verification": "从欢迎页的“远程开发”按钮和标题栏项目菜单打开“远程开发”:新建连接只填主机,保存后列表以主机名命名并选中这一行,右侧显示概览;点“编辑”进入表单,改名称和端口后保存,回到概览且列表与偏好目录 remote/connections.json 同步;编辑中点“取消”回到原连接、不写文件;删除先在底部确认。选颜色并选“新建分组…”输入分组名后保存,左侧出现带数量的分组标题和颜色条,未分组的连接排在最后的“未分组”下,第二个连接可从下拉框选同一分组(大小写不同视为同一分组)。概览的“连接设置”逐项列出设置,未填的项显示回退规则(例如“自动(SSH 配置,否则 22)”);测试成功后概览的“主机信息”显示本次运行最近一次测试的结果,关闭再打开窗口仍在,未测试的连接显示提示。主机填 user@host、端口填非数字、分组超过 64 个字符时,错误显示在对应字段下且不写文件。对一台 Linux SSH 主机分别用 SSH Agent、私钥文件和密码测试连接:密码和带口令私钥的询问出现在窗口中,输入以圆点显示,取消或关闭窗口立即停止测试且不再追问;成功后显示系统、架构、CPU、内存和主目录磁盘。首次连接时 OpenSSH 确认主机指纹的询问同样出现在窗口中,由用户回答,Lithe 不替用户接受;拒绝指纹或指纹已改变时测试失败并说明原因。日志只有 remote.connections.open、remote.connection.new/select/edit/edit.cancel/save/remove/test/test.stop 和 remote.authentication.answer/cancel 等动作,不含主机、用户名、私钥路径、分组名、询问原文或答案。 窗口按原型(#2276)验收:左侧连接行有连接颜色的竖条和选中底色,已连接的显示绿点;面包屑显示“编辑 <名称>”或“新建连接”;高级选项折叠时标题旁显示当前连接超时和保活间隔;测试结果显示在表单最下方,成功是绿框和系统、主机名、核数、内存、磁盘标签,失败是红框、检查提示和默认展开的 OpenSSH 输出。从 Motty 导入只读 config.db、不读 vault.json,表格列出每台主机的结果,展开后逐项列出设置映射或不导入的原因;从 SSH 配置导入列出 Host 别名、ssh -G 生效值和 ProxyJump,通配符 Host 跳过;已保存的主机不计入可导入数量。选文件夹页保留左侧列表,含 .git 的子文件夹标“Git”;信任页列出主机与文件夹和两种打开方式的说明。", - "notes": "Viva:连接列表的格式和字段规则在 Core(remote.connections、remote.editConnections),桌面端只读写偏好目录里的 remote/connections.json,按读取时的字节原子写回 Core 返回的文档,文件被改过时不覆盖;测试连接由 Core 运行 PATH 中的 OpenSSH,SSH 询问经 SSH_ASKPASS 指向 lithe 可执行文件的助手模式回到窗口,和 Git 认证共用同一个提问队列。Lithe 只把私钥路径交给 OpenSSH,不读取私钥内容,也不接受粘贴的私钥。macOS 用无头截图和真实 Core 的单元测试覆盖;Windows 上 OpenSSH 调用 GUI 子系统助手读取答案仍待实机验证。连接后选择主机文件夹并打开远程工作区见 remote-workspace。 2026-11-21(#2231 窗口重设计):颜色(六种固定色或无)和分组随连接保存在 Core 的 connections.json(Lithe-IDEA/Lithe-core-rust#152),分组顺序由 Core 的 sections 给出(按首次使用的顺序,未分组在最后),桌面端只展示;概览的“主机信息”只保存在本次运行的内存里,不写文件。搜索、从 Motty 或 SSH 配置导入、ssh -G 实际生效值、连接阶段和远程信任由 Core #154(crates/remote)给出,桌面端只展示(#2275 与本次补齐);选文件夹页的 Git 标记由桌面端组合 Core 已有的 remote.stat(前 64 个子文件夹、最多 8 个并行)。概览“⋯”菜单的“在新窗口打开”未实现:远程会话属于当前进程的 Core,新窗口要重新连接或交接会话。自动化:TestRemoteConnectionsColorAndGroup、TestRemoteCancelGoesBackToTheSavedConnection、TestRemoteOverviewShowsTheTestedHost、TestRemoteImportCountsLeaveOutSavedHosts、TestRemoteImportNewGroupsAreTheChosenOnesTheListLacks、TestRemoteBrowserTagsGitRepositories 与 TestVisualRemoteConnections。" + "verification": "从欢迎页的“远程开发”按钮和标题栏项目菜单打开“远程开发”:新建连接只填主机,保存后列表以主机名命名并选中这一行,右侧显示概览;点“编辑”进入表单,改名称和端口后保存,回到概览且列表与偏好目录 remote/connections.json 同步;编辑中点“取消”回到原连接、不写文件;删除先在底部确认。选颜色并选“新建分组…”输入分组名后保存,左侧出现带数量的分组标题和颜色条,未分组的连接排在最后的“未分组”下,第二个连接可从下拉框选同一分组(大小写不同视为同一分组)。概览的“连接设置”逐项列出设置,未填的项显示回退规则(例如“自动(SSH 配置,否则 22)”);测试成功后概览的“主机信息”显示本次运行最近一次测试的结果,关闭再打开窗口仍在,未测试的连接显示提示。主机填 user@host、端口填非数字、分组超过 64 个字符时,错误显示在对应字段下且不写文件。对一台 Linux SSH 主机分别用 SSH Agent、私钥文件和密码测试连接:密码和带口令私钥的询问出现在窗口中,输入以圆点显示,取消或关闭窗口立即停止测试且不再追问;成功后显示系统、架构、CPU、内存和主目录磁盘。首次连接时 OpenSSH 确认主机指纹的询问同样出现在窗口中,由用户回答,Lithe 不替用户接受;拒绝指纹或指纹已改变时测试失败并说明原因。日志只有 remote.connections.open、remote.connection.new/select/edit/edit.cancel/save/remove/test/test.stop 和 remote.authentication.answer/cancel 等动作,不含主机、用户名、私钥路径、分组名、询问原文或答案。 窗口按原型(#2276)验收:左侧连接行有连接颜色的竖条和选中底色,已连接的显示绿点;面包屑显示“编辑 <名称>”或“新建连接”;高级选项折叠时标题旁显示当前连接超时和保活间隔;测试结果显示在表单最下方,成功是绿框和系统、主机名、核数、内存、磁盘标签,失败是红框、检查提示和默认展开的 OpenSSH 输出。从 Motty 导入只读 config.db、不读 vault.json,表格列出每台主机的结果,展开后逐项列出设置映射或不导入的原因;用户名是 Windows 域账户(域\\用户、用户@域)的 SSH 主机照常可导入,Lithe 不接受的设置标在它自己那一行,这台主机显示红色“无效”、不可勾选,只有非 SSH 协议的主机显示“非 SSH”;从 SSH 配置导入列出 Host 别名、ssh -G 生效值和 ProxyJump,通配符 Host 跳过;已保存的主机不计入可导入数量。选文件夹页保留左侧列表,含 .git 的子文件夹标“Git”;信任页列出主机与文件夹和两种打开方式的说明。", + "notes": "Viva:连接列表的格式和字段规则在 Core(remote.connections、remote.editConnections),桌面端只读写偏好目录里的 remote/connections.json,按读取时的字节原子写回 Core 返回的文档,文件被改过时不覆盖;测试连接由 Core 运行 PATH 中的 OpenSSH,SSH 询问经 SSH_ASKPASS 指向 lithe 可执行文件的助手模式回到窗口,和 Git 认证共用同一个提问队列。Lithe 只把私钥路径交给 OpenSSH,不读取私钥内容,也不接受粘贴的私钥。macOS 用无头截图和真实 Core 的单元测试覆盖;Windows 上 OpenSSH 调用 GUI 子系统助手读取答案仍待实机验证。连接后选择主机文件夹并打开远程工作区见 remote-workspace。 2026-11-21(#2231 窗口重设计):颜色(六种固定色或无)和分组随连接保存在 Core 的 connections.json(Lithe-IDEA/Lithe-core-rust#152),分组顺序由 Core 的 sections 给出(按首次使用的顺序,未分组在最后),桌面端只展示;概览的“主机信息”只保存在本次运行的内存里,不写文件。搜索、从 Motty 或 SSH 配置导入、ssh -G 实际生效值、连接阶段和远程信任由 Core #154(crates/remote)给出,桌面端只展示(#2275 与本次补齐);Windows 域用户和 Motty 导入的 invalid 状态由 Core #166 给出(固定 2e4be2c),桌面端沿用 SSH 配置导入已有的“无效”标签;选文件夹页的 Git 标记由桌面端组合 Core 已有的 remote.stat(前 64 个子文件夹、最多 8 个并行)。概览“⋯”菜单的“在新窗口打开”未实现:远程会话属于当前进程的 Core,新窗口要重新连接或交接会话。自动化:TestRemoteConnectionsColorAndGroup、TestRemoteCancelGoesBackToTheSavedConnection、TestRemoteOverviewShowsTheTestedHost、TestRemoteImportCountsLeaveOutSavedHosts、TestRemoteImportNewGroupsAreTheChosenOnesTheListLacks、TestRemoteBrowserTagsGitRepositories 与 TestVisualRemoteConnections。" }