Merge pull request #212 from wnlen/dev

Dev
This commit is contained in:
Arvin
2026-04-20 17:04:32 +08:00
committed by GitHub
3 changed files with 19 additions and 3 deletions
+2 -2
View File
@@ -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
+6
View File
@@ -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"
}
+11 -1
View File
@@ -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