From e68e70d9df3e1ef6635ca5691e5c6f5d3234f330 Mon Sep 17 00:00:00 2001 From: juewuy Date: Mon, 6 Jun 2022 13:03:42 +0800 Subject: [PATCH] =?UTF-8?q?v1.6.3=20~=E8=87=AA=E5=8A=A8=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=9C=AC=E6=9C=BAhosts=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=8A=A0=E8=BD=BDipv6=E5=9C=B0=E5=9D=80=20~=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=94=B9=E4=B8=BA=E5=90=8E=E5=8F=B0=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E4=B8=8D=E5=86=8D=E8=87=AA=E5=8A=A8=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 9e428c4..a683e33 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -70,6 +70,13 @@ cronset(){ croncmd $tmpcron rm -f $tmpcron } +put_save(){ + if curl --version > /dev/null 2>&1;then + curl -sS -X PUT -H "Authorization: Bearer ${secret}" -H "Content-Type:application/json" "$1" -d "$2" >/dev/null + elif wget --version > /dev/null 2>&1;then + wget -q --method=PUT --header="Authorization: Bearer ${secret}" --header="Content-Type:application/json" --body-data="$2" "$1" >/dev/null + fi +} mark_time(){ start_time=`date +%s` sed -i '/start_time*/'d $clashdir/mark @@ -275,7 +282,6 @@ EOF` mv -f $yamlnew $yaml fi echo -e "\033[32m已成功获取配置文件!\033[0m" - exit 0 fi } modify_yaml(){ @@ -693,13 +699,7 @@ web_save(){ fi } web_restore(){ - put_save(){ - if curl --version > /dev/null 2>&1;then - curl -sS -X PUT -H "Authorization: Bearer ${secret}" -H "Content-Type:application/json" "$1" -d "$2" >/dev/null - elif wget --version > /dev/null 2>&1;then - wget -q --method=PUT --header="Authorization: Bearer ${secret}" --header="Content-Type:application/json" --body-data="$2" "$1" >/dev/null - fi - } + #设置循环检测clash面板端口 i=1 while [ -z "$test" -a "$i" -lt 60 ];do @@ -975,8 +975,10 @@ getyaml) getyaml ;; updateyaml) - $0 getyaml - $0 restart + getconfig + getyaml + modify_yaml + put_save http://localhost:${db_port}/configs "{\"path\":\"${clashdir}/config.yaml\"}" ;; webget) #设置临时http代理