diff --git a/scripts/clash.sh b/scripts/clash.sh index 4be5588..01f34a0 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -187,9 +187,9 @@ setport(){ setconfig authentication echo 密码已移除! else - if [ "$local_proxy" = "已开启" ];then + if [ "$local_proxy" = "已开启" -a "$local_type" = "环境变量" ];then echo ----------------------------------------------- - echo -e "\033[33m请先禁用本机代理功能!\033[0m" + echo -e "\033[33m请先禁用本机代理功能或使用增强模式!\033[0m" sleep 1 else authentication=$(echo $input | grep :) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 5ac16f4..23419d5 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -992,22 +992,28 @@ userguide(){ sethost fi } - echo ----------------------------------------------- - echo -e "\033[32m是否开启公网访问Dashboard面板及socks服务?\033[0m" - echo -e "注意当前设备必须有公网IP才能从公网正常访问" - echo -e "此功能会增加暴露风险请谨慎使用!" - echo -e "vps设备可能还需要额外在服务商后台开启相关端口(默认为7890与9999)" - read -p "现在开启?(1/0) > " res - if [ "$res" = 1 ];then - host=$(curl ip.sb 2>/dev/null | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}') - if [ -z "$host" ];then - sethost - fi - public_support=已开启 - setconfig host $host - setconfig public_support $public_support + if type systemd >/dev/null 2>&1 ;then + echo ----------------------------------------------- + echo -e "\033[32m是否开启公网访问Dashboard面板及socks服务?\033[0m" + echo -e "注意当前设备必须有公网IP才能从公网正常访问" + echo -e "\033[31m此功能会增加暴露风险请谨慎使用!\033[0m" + echo -e "vps设备可能还需要额外在服务商后台开启相关端口(默认为7890与9999)" + echo -e "启用后会自动设置面板访问秘钥(shellclash)以及Socks密码(shell:clash)" + read -p "现在开启?(1/0) > " res + if [ "$res" = 1 ];then + host=$(curl ip.sb 2>/dev/null | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}') + if [ -z "$host" ];then + sethost + fi + public_support=已开启 + authentication=shell:clash + secret=shellclash + setconfig secret $secret + setconfig host $host + setconfig public_support $public_support + setconfig authentication \'$authentication\' + fi fi - #提示导入订阅或者配置文件 echo ----------------------------------------------- echo -e "\033[32m是否导入配置文件?\033[0m(这是运行前的最后一步)" diff --git a/scripts/start.sh b/scripts/start.sh index 9466e53..ee31299 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -593,15 +593,16 @@ web_restore(){ fi } #设置循环检测clash面板端口 - i=1 - while [ $i -lt 10 ];do + while [ "$i" != 1 ];do + [ "$j" = 60 ] && exit 1 sleep 1 if curl --version > /dev/null 2>&1;then test=$(curl -s http://localhost:${db_port}) else test=$(wget -q -O - http://localhost:${db_port}) fi - [ -n "$test" ] && i=10 + [ -n "$test" ] && i=1 + j=$((j+1)) done #发送数据 num=$(cat $clashdir/web_save | wc -l) @@ -922,14 +923,15 @@ unset_proxy) sed -i '/ALL_PROXY/'d $profile ;; steaming) + getconfig #设置循环检测clashDNS端口 - i=1 - while [ $i -lt 10 ];do + while [ "$i" != 0 ];do + [ "$j" = 60 ] && exit 1 sleep 1 nslookup baidu.com 127.0.0.1:${dns_port} > /dev/null 2>&1 - [ "$?" = 0 ] && i=10 + i=$? + j=$((j+1)) done - getconfig steaming_dns(){ steaming_dir=$clashdir/steaming/${steaming_type}_Domains.list if [ ! -f "$steaming_dir" ];then