diff --git a/install.sh b/install.sh index 247fdd4..4eec1ae 100644 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #! /bin/bash # Copyright (C) Juewuy -echo='echo -e' && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && echo=echo +echo='echo -e' && [ -n "$(echo -e|grep e)" ] && echo=echo [ -z "$1" ] && test=0 || test=$1 echo "***********************************************" @@ -36,7 +36,7 @@ webget(){ #检查更新 url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash" if [ "$test" -gt 0 ];then - url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash/master" + url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master" [ "$test" -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi" [ "$test" -eq 3 ] && url="http://192.168.123.90:8080/clash-for-Miwifi" else diff --git a/scripts/clash.sh b/scripts/clash.sh index 2c82f0a..48192ac 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -96,6 +96,27 @@ echoerrornum(){ echo ----------------------------------------------- echo -e "\033[31m请输入正确的数字!\033[0m" } +catpac(){ + cat > /tmp/pac < /dev/null 2>&1; then sed -i "1i\local_proxy=已开启" $ccfg local_proxy=已开启 - $clashdir/start.sh set_proxy $mix_port $hostdir + catpac #生成pac自动代理文件 + $clashdir/start.sh set_proxy $mix_port echo -e "\033[32m已经成功配置本机代理~\033[0m" echo -e "\033[36m如未生效,请重新启动终端或重新连接SSH!\033[0m" else diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 196ba09..3621807 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -692,52 +692,6 @@ getdb(){ sleep 1 fi } -catpac(){ - cat > $dbdir/pac < " num - if [ "$num" = '1' ]; then - catpac - echo -e "\033[33mPAC文件已生成!\033[0m" - echo -e "PAC地址:\033[32mhttp://$host$dbdir/pac\033[0m" - echo "使用教程:https://baike.baidu.com/item/PAC/16292100" - sleep 2 - elif [ "$num" = 2 ]; then - rm -rf $dbdir/pac - echo ----------------------------------------------- - echo -e "\033[33mPAC文件已清除!\033[0m" - sleep 1 - fi -} setserver(){ echo ----------------------------------------------- @@ -810,7 +764,6 @@ update(){ echo -e " 2 切换\033[33mclash核心 \033[33m$clashv\033[0m > \033[32m$clash_n\033[0m" echo -e " 3 更新\033[32mGeoIP数据库 \033[33m$Geo_v\033[0m > \033[32m$GeoIP_v\033[0m" echo -e " 4 安装本地\033[35mDashboard\033[0m面板" - echo -e " 5 生成本地PAC文件(需先安装本地面板)" echo ----------------------------------------------- echo -e " 7 切换\033[36m安装源\033[0m地址" echo -e " 8 鸣谢" @@ -837,10 +790,6 @@ update(){ elif [ "$num" = 4 ]; then getdb update - - elif [ "$num" = 5 ]; then - setpac - update elif [ "$num" = 7 ]; then setserver @@ -891,7 +840,6 @@ userguide(){ getcore getgeo getdb - catpac clashlink } testcommand(){ diff --git a/scripts/start.sh b/scripts/start.sh index 388a436..44cf21c 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -382,7 +382,7 @@ afstart(){ #标记启动时间 mark_time #设置本机代理 - [ "$local_proxy" = "已开启" ] && $0 set_proxy $mix_port $hostdir + [ "$local_proxy" = "已开启" ] && $0 set_proxy $mix_port #还原面板配置 web_save_auto #启用面板配置自动保存 [ -f $clashdir/web_save ] && web_restore & #后台还原面板配置 @@ -448,17 +448,17 @@ web_save) set_proxy) #GNOME配置 if gsettings --version >/dev/null 2>&1 ;then - gsettings set org.gnome.system.proxy autoconfig-url "http://127.0.0.1${3}/pac" + gsettings set org.gnome.system.proxy autoconfig-url "http://127.0.0.1:$1/ui/pac" gsettings set org.gnome.system.proxy mode "auto" #KDE配置 elif kwriteconfig5 -h >/dev/null 2>&1 ;then kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key "ProxyType" 2 - kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key "Proxy Config Script" "http://127.0.0.1${3}/pac" + kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key "Proxy Config Script" "http://127.0.0.1:$1/ui/pac" #环境变量方式 else [ -w ~/.bashrc ] && profile=~/.bashrc [ -w /etc/profile ] && profile=/etc/profile - echo 'export all_proxy=http://127.0.0.1:'"$2" >> $profile + echo 'export all_proxy=http://127.0.0.1:'"$1" >> $profile echo 'export ALL_PROXY=$all_proxy' >> $profile fi ;;