diff --git a/bin/ShellClash.tar.gz b/bin/ShellClash.tar.gz index 88e7db5..f29989f 100644 Binary files a/bin/ShellClash.tar.gz and b/bin/ShellClash.tar.gz differ diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index 25710cd..b2531db 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/version b/bin/version index 1419b9d..8f8c313 100644 --- a/bin/version +++ b/bin/version @@ -3,4 +3,4 @@ clashpre_v=2022.11.25 clash_v=v1.7.1 meta_v=v1.14.2 GeoIP_v=20230408 -versionsh=1.7.4e +versionsh=1.7.4f diff --git a/scripts/clash.sh b/scripts/clash.sh index bec8a01..b79e016 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -193,12 +193,14 @@ log_pusher(){ [ -n "$push_Deer" ] && stat_Deer=32m已启用 || stat_Deer=33m未启用 [ -n "$push_bark" ] && stat_bark=32m已启用 || stat_bark=33m未启用 [ -n "$push_Po" ] && stat_Po=32m已启用 || stat_Po=33m未启用 + [ -n "$device_name" ] && device_s=32m$device_name || device_s=33m未设置 echo ----------------------------------------------- echo -e " 1 查看\033[36m运行日志\033[0m" echo -e " 2 Telegram推送 ——\033[$stat_TG\033[0m" echo -e " 3 PushDeer推送 ——\033[$stat_Deer\033[0m" echo -e " 4 Bark推送-IOS ——\033[$stat_bark\033[0m" echo -e " 5 Passover推送 ——\033[$stat_Po\033[0m" + echo -e " 9 设置设备名称 ——\033[$device_s\033[0m" echo ----------------------------------------------- read -p "请输入对应数字 > " num case $num in @@ -342,6 +344,12 @@ log_pusher(){ sleep 1 log_pusher ;; + 9) + read -p "请输入本设备自定义推送名称 > " device_name + setconfig device_name $device_name + sleep 1 + log_pusher + ;; *) errornum ;; esac } diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 79e510a..92b3e60 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -941,7 +941,7 @@ userguide(){ errornum forwhat elif [ "$num" = 1 ];then - redir_mod="redir模式" + redir_mod="Redir模式" ckcmd nft && redir_mod="Nft基础" modprobe nft_tproxy &> /dev/null && redir_mod="Nft混合" setconfig redir_mod "$redir_mod" diff --git a/scripts/init.sh b/scripts/init.sh index a1ff481..7776279 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (C) Juewuy -version=1.7.4e +version=1.7.4f setdir(){ dir_avail(){ diff --git a/scripts/start.sh b/scripts/start.sh index 708e7e3..2dafbbe 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -49,13 +49,14 @@ compare(){ fi } logger(){ - #$1文字描述$2显示颜色$3是否推送 + #$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 [ -z "$3" ] && { getconfig + [ -n "$device_name" ] && log_text="$log_text($device_name)" [ -n "$(pidof clash)" ] && { [ -n "$authentication" ] && auth="$authentication@" export https_proxy="http://${auth}127.0.0.1:$mix_port" @@ -403,8 +404,13 @@ EOF [ -f $tmpdir/proxy.yaml ] && yaml_proxy=$tmpdir/proxy.yaml [ -f $tmpdir/rule.yaml ] && yaml_rule=$tmpdir/rule.yaml cut -c 1- $tmpdir/set.yaml $yaml_hosts $yaml_user $yaml_proxy $yaml_rule > $tmpdir/config.yaml - - + #测试自定义配置文件 + $bindir/clash -t -d $bindir -f $tmpdir/config.yaml >/dev/null + if [ "$?" != 0 ];then + logger "$($bindir/clash -t -d $bindir -f $tmpdir/config.yaml | grep -Eo 'error=.*')" 31 + logger "自定义配置文件校验失败!将使用基础配置文件启动!" 33 + sed -i "/#自定义/d" $tmpdir/config.yaml + fi #插入自定义代理 sed -i "/#自定义代理/d" $tmpdir/config.yaml space=$(sed -n '/^proxies:/{n;p}' $tmpdir/config.yaml | grep -oE '^ *') #获取空格数 @@ -1211,6 +1217,7 @@ afstart(){ /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi fi + return 0 } #设置路由规则 #[ "$ipv6_redir" = "已开启" ] && ipv6_wan=$(ip addr show|grep -A1 'inet6 [^f:]'|grep -oE 'inet6 ([a-f0-9:]+)/'|sed s#inet6\ ##g|sed s#/##g) @@ -1243,9 +1250,8 @@ afstart(){ #推送日志 { sleep 30;logger Clash服务已启动!;} & else - logger "Clash服务启动失败!请查看报错信息!" 31 - $bindir/clash -t -d $bindir - echo "$($bindir/clash -t -d $bindir)" >> $clashdir/log + logger "Clash服务启动失败!请查看报错信息!" 33 + logger "$($bindir/clash -t -d $bindir | grep -Eo 'error=.*')" 31 $0 stop exit 1 fi