From b89e75fa6f771bf9ab6fbe375446810d22fcc5db Mon Sep 17 00:00:00 2001 From: wnlen <62139570+wnlen@users.noreply.github.com> Date: Mon, 20 Apr 2026 16:04:05 +0800 Subject: [PATCH 1/2] fix: support unicode node names in clashctl select #23 --- scripts/core/proxy.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/core/proxy.sh b/scripts/core/proxy.sh index 29f00ad..9ee683f 100644 --- a/scripts/core/proxy.sh +++ b/scripts/core/proxy.sh @@ -365,6 +365,7 @@ proxy_group_select() { local node="$2" local base secret local code response_file response_body + local available_node found [ -n "${group:-}" ] || die "策略组名称不能为空" [ -n "${node:-}" ] || die "节点名称不能为空" @@ -372,7 +373,16 @@ proxy_group_select() { proxy_group_exists "$group" || die "策略组不存在:$group" proxy_group_is_selector "$group" || die "该策略组不支持手动切换:$group" - if ! proxy_group_selectable_nodes "$group" | grep -Fxq "$node"; then + found=false + while IFS= read -r available_node; do + [ -n "${available_node:-}" ] || continue + if [ "$available_node" = "$node" ]; then + found=true + break + fi + done < <(proxy_group_selectable_nodes "$group") + + if [ "$found" != "true" ]; then die "节点不存在于策略组中:$group -> $node" fi From 80f11383ac378f87c1b8abe0be912eaaed4d1e14 Mon Sep 17 00:00:00 2001 From: wnlen <62139570+wnlen@users.noreply.github.com> Date: Mon, 20 Apr 2026 17:04:11 +0800 Subject: [PATCH 2/2] fix: install clashon wrappers and clarify post-install shell behavior --- scripts/core/clashctl.sh | 4 ++-- scripts/core/common.sh | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/core/clashctl.sh b/scripts/core/clashctl.sh index b66c14c..b992b6a 100644 --- a/scripts/core/clashctl.sh +++ b/scripts/core/clashctl.sh @@ -287,9 +287,9 @@ cmd_on() { if [ "$system_proxy_degraded" = "true" ]; then ui_warn "当前通过 clashctl 子进程执行,不能修改当前 Shell 代理变量" else - ui_warn "当前通过 clashctl 子进程执行,已开启系统代理,但不会修改当前 Shell 代理变量" + ui_warn "当前通过 clashctl 子进程执行,已开启系统代理,但不会修改当前终端的 Shell 变量" fi - ui_next "需要当前 Shell 立即生效:source shell 入口后执行 clashon,或重新打开终端" + ui_next "当前终端如需立即生效:重新打开终端后使用 clashon,或手动 source shell 入口" ui_blank fi diff --git a/scripts/core/common.sh b/scripts/core/common.sh index 9feaa03..df0a7e7 100644 --- a/scripts/core/common.sh +++ b/scripts/core/common.sh @@ -2436,6 +2436,8 @@ EOF for shell_rc in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.profile"; do install_rc_source_block "$shell_rc" "$profile_file" done + + install_alias_command_wrappers } remove_clashctl_entry() { @@ -2925,4 +2927,8 @@ print_install_summary() { if [ -f "$clashctl_file" ]; then CLASH_UI_BOX_ONLY=1 bash "$clashctl_file" ui || true fi + + echo + echo "💡 clashon / clashoff 为 shell 快捷入口;新终端会自动生效" + echo "💡 当前终端若暂不可用,请先使用 clashctl on / clashctl off" }