diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index 1d4a4d1..04bc2ba 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/version b/bin/version index 1d41124..ca45d17 100644 --- a/bin/version +++ b/bin/version @@ -1,4 +1,4 @@ GeoIP_v=20201001 clash_v=1.1.0 clashpre_v=2020.09.27 -versionsh=1.0.0beta13fix1 +versionsh=1.0.0beta13fix2 diff --git a/scripts/clash.sh b/scripts/clash.sh index 01c70d7..5cf6fd6 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -686,21 +686,18 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then if [ "$local_proxy" = "未开启" ] > /dev/null 2>&1; then sed -i "1i\local_proxy=已开启" $ccfg local_proxy=已开启 - echo 'export http_proxy=http://127.0.0.1:'"$mix_port" >> /etc/profile - echo 'export https_proxy=$http_proxy' >> /etc/profile - echo 'export HTTP_PROXY=$http_proxy' >> /etc/profile - echo 'export HTTPS_PROXY=$http_proxy' >> /etc/profile + source $clashdir/start.sh + set_proxy echo -e "\033[32m已经将代理参数写入环境变量~\033[0m" echo -e "\033[36m如未生效,请重新登录或者重启设备!\033[0m" sleep 1 else sed -i "1i\local_proxy=未开启" $ccfg - sed -i '/http*_proxy/'d /etc/profile - sed -i '/HTTP*_PROXY/'d /etc/profile - echo -e "\033[33m已经将代理参数从环境变量移除!!\033[0m" local_proxy=未开启 + source $clashdir/start.sh + unset_proxy + echo -e "\033[33m已经将代理参数从环境变量移除!!\033[0m" fi - source /etc/profile > /dev/null 2>&1 clashadv elif [[ $num == 5 ]]; then setport diff --git a/scripts/start.sh b/scripts/start.sh index 2fd2da8..8480567 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -282,6 +282,18 @@ daemon(){ echo 请进入定时任务菜单手动指定系统定时任务文件路径!!! fi } +set_proxy(){ + echo 'export http_proxy=http://127.0.0.1:'"$mix_port" >> /etc/profile + echo 'export https_proxy=$http_proxy' >> /etc/profile + echo 'export HTTP_PROXY=$http_proxy' >> /etc/profile + echo 'export HTTPS_PROXY=$http_proxy' >> /etc/profile + source /etc/profile > /dev/null 2>&1 +} +unset_proxy(){ + sed -i '/http*_proxy/'d /etc/profile + sed -i '/HTTP*_PROXY/'d /etc/profile + source /etc/profile > /dev/null 2>&1 +} afstart(){ #读取配置文件 getconfig @@ -291,6 +303,8 @@ afstart(){ [ "$redir_mod" != "纯净模式" ] && [ "$redir_mod" != "Tun模式" ] && start_redir #标记启动时间 mark_time + #设置本机代理 + [ "$local_proxy" = "已开启" ] && set_proxy } case "$1" in @@ -328,6 +342,8 @@ stop) killall -9 clash >/dev/null 2>&1 #清理iptables stop_iptables + #禁用本机代理 + [ "$local_proxy" = "已开启" ] && unset_proxy ;; restart) $0 stop