~内置下载功能防滥用优化
~移除fastgit源
~域名嗅探默认改为未启用
~本机hosts生成优先读取user.yaml
~其他优化及若干bug修复
~修复日志推送导致的部分卡死
This commit is contained in:
juewuy 2022-12-08 20:36:56 +08:00
parent cdbf02eb9b
commit 42946a19fc
4 changed files with 36 additions and 30 deletions

Binary file not shown.

View File

@ -3,4 +3,4 @@ clashpre_v=2022.11.25
clash_v=v1.7.1
meta_v=v1.13.2
GeoIP_v=20221203
versionsh=1.6.12
versionsh=1.6.12b

View File

@ -1763,6 +1763,9 @@ case "$1" in
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
$shtype -x $clashdir/clash.sh
;;
-s)
$clashdir/start.sh $2 $3 $4 $5 $6
;;
-st)
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
$shtype -x $clashdir/start.sh $2 $3 $4 $5 $6

View File

@ -45,37 +45,40 @@ compare(){
fi
}
logger(){
#$1文字描述$2显示颜色$3是否推送
[ -n "$2" ] && echo -e "\033[$2m$1\033[0m"
log_text="$(date "+%G-%m-%d_%H:%M:%S")~$1"
echo $log_text >> /tmp/ShellClash_log
[ "$(wc -l /tmp/ShellClash_log | awk '{print $1}')" -gt 99 ] && sed -i '1,5d' /tmp/ShellClash_log
getconfig
[ -n "$(pidof clash)" ] && {
[ -n "$authentication" ] && auth="$authentication@"
export https_proxy="http://${auth}127.0.0.1:$mix_port"
}
[ -n "$push_TG" ] && {
url=https://api.telegram.org/bot${push_TG}/sendMessage
curl_data="-d chat_id=$chat_ID&text=$log_text"
wget_data="--post-data=$chat_ID&text=$log_text"
if curl --version &> /dev/null;then
curl -kfsSl -d "chat_id=$chat_ID&text=$log_text" "$url" &>/dev/null
else
wget -Y on -q --post-data="chat_id=$chat_ID&text=$log_text" "$url"
fi
}
[ -n "$push_bark" ] && {
url=${push_bark}/${log_text}
if curl --version &> /dev/null;then
curl -kfsSl "$url" &>/dev/null
else
wget -Y on -q "$url"
fi
}
[ -n "$push_Po" ] && {
url=https://api.pushover.net/1/messages.json
curl -kfsSl --form-string "token=$push_Po" --form-string "user=$push_Po_key" --form-string "message=$log_text" "$url" &>/dev/null
}
[ -z "$3" ] && {
getconfig
[ -n "$(pidof clash)" ] && {
[ -n "$authentication" ] && auth="$authentication@"
export https_proxy="http://${auth}127.0.0.1:$mix_port"
}
[ -n "$push_TG" ] && {
url=https://api.telegram.org/bot${push_TG}/sendMessage
curl_data="-d chat_id=$chat_ID&text=$log_text"
wget_data="--post-data=$chat_ID&text=$log_text"
if curl --version &> /dev/null;then
curl -kfsSl --connect-timeout 3 -d "chat_id=$chat_ID&text=$log_text" "$url" &>/dev/null
else
wget -Y on -q --timeout=3 -t 1 --post-data="chat_id=$chat_ID&text=$log_text" "$url"
fi
}
[ -n "$push_bark" ] && {
url=${push_bark}/${log_text}
if curl --version &> /dev/null;then
curl -kfsSl --connect-timeout 3 "$url" &>/dev/null
else
wget -Y on -q --timeout=3 -t 1 "$url"
fi
}
[ -n "$push_Po" ] && {
url=https://api.pushover.net/1/messages.json
curl -kfsSl --connect-timeout 3 --form-string "token=$push_Po" --form-string "user=$push_Po_key" --form-string "message=$log_text" "$url" &>/dev/null
}
} &
}
croncmd(){
if [ -n "$(crontab -h 2>&1 | grep '\-l')" ];then
@ -1031,8 +1034,8 @@ afstart(){
#读取配置文件
getconfig
#延迟启动
[ -n "$start_delay" -a ! -f /tmp/clash_start_time ] && {
logger "clash将延迟$start_delay秒启动" 31
[ ! -f /tmp/clash_start_time ] && [ -n "$start_delay" ] && [ "$start_delay" -gt 0 ] && {
logger "clash将延迟$start_delay秒启动" 31 pushoff
sleep $start_delay
}
$bindir/clash -t -d $bindir >/dev/null