feat(ssh): 新增自动公钥认证模式 - #4
Merged
feigeCode merged 2 commits intoMar 26, 2026
Merged
Conversation
htmambo
added a commit
to htmambo/onetcli
that referenced
this pull request
Jul 4, 2026
从 dev 同步提交 c5dbbc8 的 rename 部分(补完第四批跳过的 rename)。 详细说明: - 文件菜单加 Rename 项(Edit icon)→ rename_item 对话框(Input + 确认/取消) - on_ok:校验非空 + is_valid_entry_name(非法→invalid_name 通知);sftp_client.rename(old, new) + refresh_dir;失败→rename_failed 通知(含 error) - build_rename_target_path:remote_path_parent + join_remote_path(HEAD join_remote_path 处理根目录,无 // 双斜杠) - on_ok 返回 false 保持对话框,spawn 成功后 close_dialog(失败保持打开供重试) 文件变更: - 修改: crates/terminal_view/src/sidebar/file_manager_panel.rs(build_rename_target_path helper + rename_item 方法 + 菜单项 + clones + 1 测试) 测试状态: - [x] cargo test -p terminal_view --lib file_manager_panel::tests: 14 passed(含新增 build_rename_target_path_keeps_parent_directory) - [x] cargo build -p terminal_view 通过 - [x] External Review(coding-bridge 32547a61)无阻塞:#3 root // 误报(HEAD join_remote_path 处理根目录);feigeCode#4 error 已含;#1/#2 dev 原设计(无 active_rename 锁/None 静默,忠实移植) > OMC trailers: > Constraint: 仅 file_manager_panel.rs;rename 部分(补完 c5dbbc8) > Rejected: 加 active_rename 锁 | dev 原设计无锁,忠实移植;失败保持对话框可重试 > Directive: 用户要求第五批继续推进,每步 External Review > Confidence: 高 | 14 测试通过 + 编译 + review 无阻塞 + 逻辑为 dev 已测功能忠实移植 > Scope-risk: terminal 侧栏文件管理器远程重命名;无重入锁(dev 设计) > Not-tested: 运行时真实 SFTP 重命名(需远程环境手测);并发重入场景 Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(ssh): 新增自动公钥认证模式
Description:
背景
onetcli 现有三种 SSH 认证方式(密码、私钥文件、SSH Agent),但用户仍需理解"客户端私钥/服务器公钥"的 SSH 细节,与系统
ssh user@host自动发现本机身份的体验不一致。变更内容
新增「自动公钥认证」模式,连接时自动按以下顺序尝试本机已有身份:
~/.ssh/id_ed25519、id_rsa、id_ecdsa、id_dsa用户无需手动填写私钥路径,体验与系统
ssh一致。功能演示
认证方式配置
测试连接
保存连接(测试通过后才允许保存)
编辑回显
技术实现
SshAuthMethod::AutoPublicKey— 新增存储枚举变体,只保存认证策略,不保存实际私钥路径expand_auto_publickey_auth()— 将 AutoPublicKey 展开为按优先级排列的候选身份列表authenticate_session_with_fallbacks()— 顺序尝试候选身份,全部失败时聚合可读错误authenticate_with_strategy()— 统一认证入口,SSH 终端、SFTP、文件管理面板复用同一逻辑影响范围
ssh_form_window.rs)terminal.rs)sftp_view/lib.rs)file_manager_panel.rs)sftp/russh_impl.rs)测试
cargo test -p ssh— 6 个单元测试全部通过cargo test -p terminal_view— 9 个单元测试全部通过