~增加fake-ip地址过滤编辑功能
~增加GeoSite数据库手动更新
~优化在线获取配置文件功能,现在会自动隐藏无效的节点组
~SSH固化功能支持密码设置
~优化Padavan设备开机自启不正常的bug
~修复不能自动导入本机hosts的bug
~修复tun及混合模式不能自动切换内核的bug
~其他优化及修复
This commit is contained in:
juewuy 2022-03-26 02:11:09 +08:00
parent 9467fe9ca5
commit 58aba81a5c
2 changed files with 22 additions and 6 deletions

View File

@ -574,6 +574,11 @@ clashcfg(){
set_redir_config(){ set_redir_config(){
setconfig redir_mod $redir_mod setconfig redir_mod $redir_mod
setconfig dns_mod $dns_mod setconfig dns_mod $dns_mod
if [ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && [ "$clashcore" = "clash" ];then
rm -rf $bindir/clash
rm -rf $clashdir/clash
setconfig clashcore clash.meta
fi
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[36m已设为 $redir_mod \033[0m" echo -e "\033[36m已设为 $redir_mod \033[0m"
} }

View File

@ -254,6 +254,17 @@ EOF`
setconfig clashcore clash.net setconfig clashcore clash.net
echo ----------------------------------------------- echo -----------------------------------------------
fi fi
#检测并去除无效节点组
cat $clashdir/config.yaml | grep -A 8 "\-\ name:" | xargs | sed 's/- name: /\n/g' | sed 's/ type: .*proxies: /#/g' | sed 's/ rules:.*//g' | sed 's/- //g' > /tmp/clash_proxies_$USER
while read line ;do
proxies=$(echo $line | awk -F '#' '{print $2}')
proxies_name=$(echo $line | awk -F '#' '{print $1}')
if [ "$proxies" = 'DIRECT' ];then
sed -i "/- $proxies_name/d" $yamlnew
sed -i "/- name: $proxies_name/,/- DIRECT/d" $yamlnew
fi
done < /tmp/clash_proxies_$USER
rm -rf /tmp/clash_proxies_$USER
#使用核心内置test功能检测 #使用核心内置test功能检测
if [ -x $bindir/clash ];then if [ -x $bindir/clash ];then
$bindir/clash -t -d $bindir -f $yamlnew >/dev/null $bindir/clash -t -d $bindir -f $yamlnew >/dev/null
@ -272,7 +283,6 @@ EOF`
mv -f $yamlnew $yaml mv -f $yamlnew $yaml
fi fi
echo -e "\033[32m已成功获取配置文件\033[0m" echo -e "\033[32m已成功获取配置文件\033[0m"
rm -rf $yamlnew
exit 0 exit 0
fi fi
} }
@ -656,16 +666,15 @@ web_restore(){
fi fi
} }
#设置循环检测clash面板端口 #设置循环检测clash面板端口
while [ "$i" != 1 ];do i=1
[ "$j" = 60 ] && exit 1 while [ -z "$test" -a "$i" -lt 60 ];do
sleep 1 sleep 1
if curl --version > /dev/null 2>&1;then if curl --version > /dev/null 2>&1;then
test=$(curl -s http://localhost:${db_port}) test=$(curl -s http://localhost:${db_port})
else else
test=$(wget -q -O - http://localhost:${db_port}) test=$(wget -q -O - http://localhost:${db_port})
fi fi
[ -n "$test" ] && i=1 i=$((i+1))
j=$((j+1))
done done
#发送数据 #发送数据
num=$(cat $clashdir/web_save | wc -l) num=$(cat $clashdir/web_save | wc -l)
@ -710,7 +719,7 @@ bfstart(){
else else
logger "未找到clash核心正在下载" 33 logger "未找到clash核心正在下载" 33
if [ -z "$clashcore" ];then if [ -z "$clashcore" ];then
[ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && clashcore=clash.net || clashcore=clash [ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && clashcore=clash.meta || clashcore=clash
fi fi
[ -z "$cpucore" ] && source $clashdir/getdate.sh && getcpucore [ -z "$cpucore" ] && source $clashdir/getdate.sh && getcpucore
[ -z "$cpucore" ] && logger 找不到设备的CPU信息请手动指定处理器架构类型 31 && setcpucore [ -z "$cpucore" ] && logger 找不到设备的CPU信息请手动指定处理器架构类型 31 && setcpucore
@ -718,6 +727,7 @@ bfstart(){
[ "$?" = "1" ] && rm -rf $bindir/clash && logger "核心下载失败,已退出!" 31 && exit 1 [ "$?" = "1" ] && rm -rf $bindir/clash && logger "核心下载失败,已退出!" 31 && exit 1
[ ! -x $bindir/clash ] && chmod +x $bindir/clash #检测可执行权限 [ ! -x $bindir/clash ] && chmod +x $bindir/clash #检测可执行权限
clashv=$($bindir/clash -v | awk '{print $2}') clashv=$($bindir/clash -v | awk '{print $2}')
setconfig clashcore $clashcore
setconfig clashv $clashv setconfig clashv $clashv
fi fi
fi fi
@ -891,6 +901,7 @@ restart)
init) init)
if [ -d "/etc/storage/clash" ];then if [ -d "/etc/storage/clash" ];then
clashdir=/etc/storage/clash clashdir=/etc/storage/clash
i=1
while [ ! -w "/etc/profile" -a "$i" -lt 60 ];do while [ ! -w "/etc/profile" -a "$i" -lt 60 ];do
sleep 1 && i=$((i+1)) sleep 1 && i=$((i+1))
done done