v1.0.0beta13fix1
~修复了导入未经转换配置文件时报错的bug ~屏蔽了部分已经无法使用的sub后端服务器地址
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
GeoIP_v=20201001
|
||||
clash_v=1.1.0
|
||||
clashpre_v=2020.09.27
|
||||
versionsh=1.0.0beta13
|
||||
versionsh=1.0.0beta13fix1
|
||||
|
||||
@@ -522,7 +522,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
|
||||
clashcfg
|
||||
elif [ $num -le $(cat /tmp/dhcp.leases | awk 'END{print NR}') ]; then
|
||||
macadd=$(cat /tmp/dhcp.leases | awk '{print $2}' | sed -n "$num"p)
|
||||
if [ -z $(cat $clashdir/mac | grep -E "$macadd") ];then
|
||||
if [ -z "$(cat $clashdir/mac | grep -E "$macadd")" ];then
|
||||
echo $macadd >> $clashdir/mac
|
||||
echo -----------------------------------------------
|
||||
echo 已添加的mac地址:
|
||||
|
||||
@@ -38,22 +38,22 @@ fi
|
||||
linkserver(){
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[44m 实验性功能,遇问题请加TG群反馈:\033[42;30m t.me/clashfm \033[0m"
|
||||
echo -e "\033[36m 感谢 https://github.com/tindy2013/subconverter \033[0m"
|
||||
echo 当前使用后端为:$server_link
|
||||
echo 1 subconverter-web.now.sh
|
||||
echo 1 subcon.dlj.tf
|
||||
echo 2 subconverter.herokuapp.com
|
||||
echo 3 subcon.py6.pw
|
||||
echo 4 api.dler.io
|
||||
echo 5 api.wcc.best
|
||||
echo 6 skapi.cool
|
||||
echo -----------------------------------------------
|
||||
echo 0 返回上级菜单
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z "$num" ] || [[ $num -gt 6 ]];then
|
||||
if [ -z "$num" ] || [[ $num -gt 5 ]];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m请输入正确的数字!\033[0m"
|
||||
elif [[ "$num" = 0 ]];then
|
||||
echo
|
||||
elif [[ $num -le 6 ]];then
|
||||
elif [[ $num -le 5 ]];then
|
||||
#将对应标记值写入mark
|
||||
sed -i '/server_link*/'d $ccfg
|
||||
sed -i "4i\server_link="$num"" $ccfg
|
||||
@@ -88,7 +88,7 @@ sed -i "1i\exclude=\'$exclude\'" $ccfg
|
||||
linkset
|
||||
}
|
||||
linkset(){
|
||||
if [ -n $Url ];then
|
||||
if [ -n "$Url" ];then
|
||||
[ -z "$skip_cert" ] && skip_cert=已开启
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[47;30m请检查输入的链接是否正确:\033[0m"
|
||||
@@ -174,7 +174,7 @@ do
|
||||
Url="$Url"\|"$url"
|
||||
fi
|
||||
i=$(($i+1))
|
||||
elif [ -z $url ];then
|
||||
elif [ -z "$url" ];then
|
||||
[ -n "$Url" ] && linkset
|
||||
elif [[ $url == 0 ]];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -202,32 +202,30 @@ echo -----------------------------------------------
|
||||
echo -e "\033[33m0 返回上级菜单\033[0m"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入完整链接 > " Https
|
||||
test=$(echo $Https | grep "://")
|
||||
test=$(echo $Https | grep -iE "http.*://" )
|
||||
Https=`echo ${Https/\ \(*\)/''}` #删除恶心的超链接内容
|
||||
#Https=`echo ${Https//\&/\%26}` #将分隔符 & 替换成Httpscode:%26
|
||||
if [ -n $Https ];then
|
||||
if [ -n $test ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e 请检查输入的链接是否正确:
|
||||
echo -e "\033[4m$Https\033[0m"
|
||||
read -p "确认导入配置文件?原配置文件将被更名为config.yaml.bak![1/0] > " res
|
||||
if [ "$res" = '1' ]; then
|
||||
#将用户链接写入mark
|
||||
sed -i '/Url=*/'d $ccfg
|
||||
sed -i '/Https=*/'d $ccfg
|
||||
sed -i "6i\Https=\'$Https\'" $ccfg
|
||||
#获取在线yaml文件
|
||||
$clashdir/start.sh getyaml
|
||||
start_over
|
||||
exit;
|
||||
fi
|
||||
clashlink
|
||||
fi
|
||||
if [ -n "$Https" -a -n "$test" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e 请检查输入的链接是否正确:
|
||||
echo -e "\033[4m$Https\033[0m"
|
||||
read -p "确认导入配置文件?原配置文件将被更名为config.yaml.bak![1/0] > " res
|
||||
if [ "$res" = '1' ]; then
|
||||
#将用户链接写入mark
|
||||
sed -i '/Url=*/'d $ccfg
|
||||
sed -i '/Https=*/'d $ccfg
|
||||
sed -i "6i\Https=\'$Https\'" $ccfg
|
||||
#获取在线yaml文件
|
||||
$clashdir/start.sh getyaml
|
||||
start_over
|
||||
exit;
|
||||
fi
|
||||
elif [[ $Https == 0 ]];then
|
||||
clashlink
|
||||
else
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m请输入正确的链接地址!!!\033[0m"
|
||||
echo -e "\033[31m请输入正确的配置文件链接地址!!!\033[0m"
|
||||
echo -e "\033[33m链接地址必须是http或者https开头的形式\033[0m"
|
||||
clashlink
|
||||
fi
|
||||
}
|
||||
gettar(){
|
||||
@@ -328,7 +326,7 @@ echo "(高级预览版) 内存占用更高"
|
||||
echo -----------------------------------------------
|
||||
echo 0 返回上级菜单
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z $num ]; then
|
||||
if [ -z "$num" ]; then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m请输入正确的数字!\033[0m"
|
||||
update
|
||||
@@ -518,7 +516,7 @@ echo -e " 3 Github源+clash代理(需开启clash服务)"
|
||||
echo -e " 4 自定义输入(请务必确保路径正确)"
|
||||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z $num ]; then
|
||||
if [ -z "$num" ]; then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m请输入正确的数字!\033[0m"
|
||||
update
|
||||
|
||||
@@ -27,12 +27,11 @@ source $ccfg
|
||||
getyaml(){
|
||||
#前后端订阅服务器地址索引,可在此处添加!
|
||||
Server=`sed -n ""$server_link"p"<<EOF
|
||||
subconverter-web.now.sh
|
||||
subcon.dlj.tf
|
||||
subconverter.herokuapp.com
|
||||
subcon.py6.pw
|
||||
api.dler.io
|
||||
api.wcc.best
|
||||
skapi.cool
|
||||
EOF`
|
||||
Config=`sed -n ""$rule_link"p"<<EOF
|
||||
https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoReject.ini
|
||||
@@ -50,7 +49,7 @@ https://subconverter.oss-ap-southeast-1.aliyuncs.com/Rules/RemoteConfig/special/
|
||||
https://subconverter.oss-ap-southeast-1.aliyuncs.com/Rules/RemoteConfig/special/netease.ini
|
||||
EOF`
|
||||
#如果传来的是Url链接则合成Https链接,否则直接使用Https链接
|
||||
if [ -z $Https ];then
|
||||
if [ -z "$Https" ];then
|
||||
#echo $Url
|
||||
Https="https://$Server/sub?target=clashr&insert=true&new_name=true&scv=true&exclude=$exclude&url=$Url&config=$Config"
|
||||
markhttp=1
|
||||
@@ -73,7 +72,7 @@ result=$(curl -w %{http_code} -kLo $yamlnew $Https)
|
||||
if [ "$result" != "200" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m配置文件获取失败!\033[0m"
|
||||
if [ -z $markhttp ];then
|
||||
if [ -z "$markhttp" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m请尝试使用【导入节点/链接】功能!\033[0m"
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -96,9 +95,9 @@ if [ "$result" != "200" ];then
|
||||
else
|
||||
Https=""
|
||||
#检测节点
|
||||
if [ -z "$(cat $yamlnew | grep ', server:')" ];then
|
||||
if [ -z "$(cat $yamlnew | grep 'server:' | grep -v 'nameserver')" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[33m获取到了配置文件,但格式似乎不对!\033[0m"
|
||||
echo -e "\033[33m获取到了配置文件,但似乎并不包含正确的节点信息!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
sed -n '1,30p' $yamlnew
|
||||
echo -----------------------------------------------
|
||||
@@ -129,7 +128,7 @@ else
|
||||
$0 stop
|
||||
$0 start
|
||||
sleep 1
|
||||
if [ -z $(pidof clash) ];then
|
||||
if [ -z "$(pidof clash)" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if [ -f $yaml.bak ];then
|
||||
$clashdir/start.sh stop
|
||||
@@ -137,7 +136,7 @@ else
|
||||
$0 start
|
||||
echo -e "\033[31mclash服务启动失败!已还原配置文件并重启clash!\033[0m"
|
||||
sleep 1
|
||||
[ -n $(pidof clash) ] && exit 0
|
||||
[ -n "$(pidof clash)" ] && exit 0
|
||||
fi
|
||||
echo -e "\033[31mclash服务启动失败!请查看报错信息!\033[0m"
|
||||
$0 stop
|
||||
|
||||
Reference in New Issue
Block a user