From d4ae7ae4b7f3d2ad0cf47878528001c42af7f321 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sun, 6 Jun 2021 14:47:18 +0800 Subject: [PATCH] =?UTF-8?q?v1.3.6-test=20~=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=AF=B9=E7=94=9F=E6=88=90=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=E6=8C=87=E5=AE=9Aclash=E4=B8=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B4=E7=9A=84=E5=8A=9F=E8=83=BD=20~=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=94=9F=E6=88=90=E9=85=8D=E7=BD=AE=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=BC=BA=E5=88=B6=E4=BD=BF=E7=94=A8dler.io=E4=BD=9C?= =?UTF-8?q?=E4=B8=BAdler=E7=9A=84api=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/getdate.sh | 10 ++++++---- scripts/start.sh | 15 +++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index e7352c0..831e765 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -5,21 +5,23 @@ webget(){ [ -n "$(pidof clash)" ] && export all_proxy="http://$authentication@127.0.0.1:$mix_port" #设置临时http代理 #参数【$1】代表下载目录,【$2】代表在线地址 #参数【$3】代表输出显示,【$4】不启用重定向 - #参数【$5】代表验证证书 + #参数【$5】代表验证证书,【$6】使用clash文件头 if curl --version > /dev/null 2>&1;then [ "$3" = "echooff" ] && progress='-s' || progress='-#' [ "$4" = "rediroff" ] && redirect='' || redirect='-L' [ "$5" = "skipceroff" ] && certificate='' || certificate='-k' - result=$(curl -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o $1 $2) + [ -n "$6" ] && agent='-A "clash"' + result=$(curl $agent -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o $1 $2) [ "$result" != "200" ] && export all_proxy="" && result=$(curl -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o $1 $2) else [ "$3" = "echooff" ] && progress='-q' || progress='-q --show-progress' [ "$3" = "echoon" ] && progress='' [ "$4" = "rediroff" ] && redirect='--max-redirect=0' || redirect='' [ "$5" = "skipceroff" ] && certificate='' || certificate='--no-check-certificate' - wget -Y on $progress $redirect $certificate --timeout=3 -O $1 $2 + [ -n "$6" ] && agent='--user-agent="clash"' + wget -Y on $agent $progress $redirect $certificate --timeout=3 -O $1 $2 if [ "$?" != "0" ];then - wget $progress $redirect $certificate --timeout=3 -O $1 $2 + wget $agent $progress $redirect $certificate --timeout=3 -O $1 $2 [ "$?" = "0" ] && result="200" else result="200" diff --git a/scripts/start.sh b/scripts/start.sh index 43b68b3..d56a926 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -50,21 +50,23 @@ webget(){ [ -n "$(pidof clash)" ] && export all_proxy="http://$authentication@127.0.0.1:$mix_port" #设置临时http代理 #参数【$1】代表下载目录,【$2】代表在线地址 #参数【$3】代表输出显示,【$4】不启用重定向 - #参数【$5】代表验证证书 + #参数【$5】代表验证证书,【$6】使用clash文件头 if curl --version > /dev/null 2>&1;then [ "$3" = "echooff" ] && progress='-s' || progress='-#' [ "$4" = "rediroff" ] && redirect='' || redirect='-L' [ "$5" = "skipceroff" ] && certificate='' || certificate='-k' - result=$(curl -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o $1 $2) + [ -n "$6" ] && agent='-A "clash"' + result=$(curl $agent -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o $1 $2) [ "$result" != "200" ] && export all_proxy="" && result=$(curl -w %{http_code} --connect-timeout 3 $progress $redirect $certificate -o $1 $2) else [ "$3" = "echooff" ] && progress='-q' || progress='-q --show-progress' [ "$3" = "echoon" ] && progress='' [ "$4" = "rediroff" ] && redirect='--max-redirect=0' || redirect='' [ "$5" = "skipceroff" ] && certificate='' || certificate='--no-check-certificate' - wget -Y on $progress $redirect $certificate --timeout=3 -O $1 $2 + [ -n "$6" ] && agent='--user-agent="clash"' + wget -Y on $agent $progress $redirect $certificate --timeout=3 -O $1 $2 if [ "$?" != "0" ];then - wget $progress $redirect $certificate --timeout=3 -O $1 $2 + wget $agent $progress $redirect $certificate --timeout=3 -O $1 $2 [ "$?" = "0" ] && result="200" else result="200" @@ -130,6 +132,7 @@ https://github.com/juewuy/ShellClash/raw/master/rules/ACL4SSR_Online_Full_Games. EOF` #如果传来的是Url链接则合成Https链接,否则直接使用Https链接 if [ -z "$Https" ];then + [ -n "$(echo $Url | grep -o 'https://dler')" ] && Server='api.dler.io' Https="https://$Server/sub?target=clash&insert=true&new_name=true&scv=true&exclude=$exclude&include=$include&url=$Url&config=$Config" markhttp=1 fi @@ -142,7 +145,7 @@ EOF` yaml=$clashdir/config.yaml yamlnew=/tmp/clash_config_$USER.yaml rm -rf $yamlnew - webget $yamlnew $Https + webget $yamlnew $Https 0 0 0 1 if [ "$result" != "200" ];then if [ -z "$markhttp" ];then echo ----------------------------------------------- @@ -725,7 +728,7 @@ updateyaml) $0 restart ;; webget) - webget $2 $3 $4 $5 + webget $2 $3 $4 $5 $6 ;; web_save) getconfig