diff --git a/.github/workflows/bin_update.yml b/.github/workflows/bin_update.yml index e6c16b80..9686870e 100644 --- a/.github/workflows/bin_update.yml +++ b/.github/workflows/bin_update.yml @@ -40,15 +40,22 @@ jobs: # Yacd-meta ######################################## unzip -o "$TEMP/meta_yacd.zip" -d "$TEMP/yacd" > /dev/null - find "$TEMP/yacd" -name "*.map" -delete - rm -f "$TEMP/yacd/report.html" - tar -zcvf "$DASH/meta_yacd.tar.gz" -C "$TEMP/yacd" . > /dev/null + # 删除字体文件 + find "$TEMP/yacd" \( -name "*.ttf" -o -name "*.woff" -o -name "*.woff2" \) -delete + # 确认子目录名称 + subdir=$(find "$TEMP/yacd" -maxdepth 1 -type d ! -path "$TEMP/yacd" | head -n1) + # 打包 + tar -zcvf "$DASH/meta_yacd.tar.gz" -C "$subdir" . > /dev/null ######################################## # metacubexd ######################################## unzip -o "$TEMP/meta_xd.zip" -d "$TEMP/xd" > /dev/null - find "$TEMP/xd" -name "*.ttf" -delete - tar -zcvf "$DASH/meta_xd.tar.gz" -C "$TEMP/xd" . > /dev/null + # 删除字体文件 + find "$TEMP/xd" \( -name "*.ttf" -o -name "*.woff" -o -name "*.woff2" \) -delete + # 确认子目录名称 + subdir=$(find "$TEMP/xd" -maxdepth 1 -type d ! -path "$TEMP/xd" | head -n1) + # 打包 + tar -zcvf "$DASH/meta_xd.tar.gz" -C "$subdir" . > /dev/null ######################################## # zashboard ######################################## @@ -61,6 +68,8 @@ jobs: echo "未找到 dist 目录" exit 1 fi + # 删除字体文件 + find "$ZDIR" \( -name "*.ttf" -o -name "*.woff" -o -name "*.woff2" \) -delete echo 'board.zash.run.place' > "$ZDIR/CNAME" tar -zcvf "$DASH/zashboard.tar.gz" -C "$ZDIR" . > /dev/null ######################################## diff --git a/ShellCrash.tar.gz b/ShellCrash.tar.gz index 703afff2..050a4dc7 100644 Binary files a/ShellCrash.tar.gz and b/ShellCrash.tar.gz differ diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index 703afff2..050a4dc7 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/version b/bin/version index 93f11fe4..68a4e0d1 100644 --- a/bin/version +++ b/bin/version @@ -1,4 +1,4 @@ meta_v=v1.19.17 singboxr_v=1.13.0-alpha.27 -versionsh=1.9.3beta4fix +versionsh=1.9.3beta5 GeoIP_v=20251205 diff --git a/scripts/init.sh b/scripts/init.sh index d6bf92dc..55e32d5f 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (C) Juewuy -version=1.9.3beta4fix +version=1.9.3beta5 setdir() { dir_avail() { @@ -145,10 +145,14 @@ setdir() { [ "$res" = "1" ] && CRASHDIR=$dir/ShellCrash || setdir fi } -setconfig() { +setconfig() { #脚本配置工具 #参数1代表变量名,参数2代表变量值,参数3即文件路径 - [ -z "$3" ] && configpath=${CRASHDIR}/configs/ShellCrash.cfg || configpath="${3}" - [ -n "$(grep "${1}=" "$configpath")" ] && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || echo "${1}=${2}" >>$configpath + [ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}" + if grep -q "^${1}=" "$configpath";then + sed -i "s#${1}=.*#${1}=${2}#g" "$configpath" + else + printf '%s=%s\n' "$1" "$2" >> "$configpath" + fi } #特殊固件识别及标记 [ -f "/etc/storage/started_script.sh" ] && { diff --git a/scripts/menu.sh b/scripts/menu.sh index dc1e8697..2f2b0688 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -17,8 +17,12 @@ JSONSDIR=${CRASHDIR}/jsons #读取配置相关 setconfig() { #参数1代表变量名,参数2代表变量值,参数3即文件路径 - [ -z "$3" ] && configpath=${CFG_PATH} || configpath="${3}" - grep -q "${1}=" "$configpath" && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || sed -i "\$a\\${1}=${2}" $configpath + [ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}" + if grep -q "^${1}=" "$configpath";then + sed -i "s#${1}=.*#${1}=${2}#g" "$configpath" + else + printf '%s=%s\n' "$1" "$2" >> "$configpath" + fi } ckcmd() { command -v sh >/dev/null 2>&1 && command -v $1 >/dev/null 2>&1 || type $1 >/dev/null 2>&1 @@ -607,7 +611,7 @@ setport() { #端口设置 else authentication=$(echo $input | grep :) if [ -n "$authentication" ]; then - setconfig authentication \'$authentication\' + setconfig authentication "'$authentication'" echo -e "\033[32m设置成功!!!\033[0m" else echo -e "\033[31m输入有误,请重新输入!\033[0m" @@ -723,7 +727,7 @@ setdns() { #DNS详细设置 read -p "请输入新的DNS > " dns_nameserver dns_nameserver=$(echo $dns_nameserver | sed 's#|#\,\ #g') if [ -n "$dns_nameserver" ]; then - setconfig dns_nameserver \'"$dns_nameserver"\' + setconfig dns_nameserver "'$dns_nameserver'" echo -e "\033[32m设置成功!!!\033[0m" fi sleep 1 @@ -733,7 +737,7 @@ setdns() { #DNS详细设置 read -p "请输入新的DNS > " dns_fallback dns_fallback=$(echo $dns_fallback | sed 's/|/\,\ /g') if [ -n "$dns_fallback" ]; then - setconfig dns_fallback \'"$dns_fallback"\' + setconfig dns_fallback "'$dns_fallback'" echo -e "\033[32m设置成功!!!\033[0m" fi sleep 1 @@ -745,7 +749,7 @@ setdns() { #DNS详细设置 echo -e "\033[31m此选项暂不支持ipv6加密DNS!!!\033[0m" elif [ -n "$text" ]; then dns_resolver=$(echo $text | sed 's/|/\,\ /g') - setconfig dns_resolver \'"$dns_resolver"\' + setconfig dns_resolver "'$dns_resolver'" echo -e "\033[32m设置成功!!!\033[0m" fi sleep 1 @@ -758,9 +762,9 @@ setdns() { #DNS详细设置 dns_nameserver='https://doh.360.cn/dns-query, https://dns.alidns.com/dns-query, https://doh.pub/dns-query' dns_fallback='https://cloudflare-dns.com/dns-query, https://dns.google/dns-query, https://doh.opendns.com/dns-query' dns_resolver='https://223.5.5.5/dns-query, 2400:3200::1' - setconfig dns_nameserver \'"$dns_nameserver"\' - setconfig dns_fallback \'"$dns_fallback"\' - setconfig dns_resolver \'"$dns_resolver"\' + setconfig dns_nameserver "'$dns_nameserver'" + setconfig dns_fallback "'$dns_fallback'" + setconfig dns_resolver "'$dns_resolver'" echo -e "\033[32m已设置加密DNS,如出现DNS解析问题,请尝试重置DNS配置!\033[0m" else echo -e "\033[31m找不到根证书文件,无法启用加密DNS,Linux系统请自行搜索安装OpenSSL的方式!\033[0m" @@ -974,7 +978,7 @@ setfirewall() { #防火墙设置 )" ]; then reserve_ipv4="$text" echo -e "已将保留地址网段设为:\033[32m$reserve_ipv4\033[0m" - setconfig reserve_ipv4 "\'$reserve_ipv4\'" + setconfig reserve_ipv4 "'$reserve_ipv4'" else echo -e "\033[31m输入有误,操作已取消!\033[0m" fi @@ -1447,7 +1451,7 @@ set_firewall_area() { #防火墙模式设置 *) ;; esac setconfig vm_redir $vm_redir - setconfig vm_ipv4 "\'$vm_ipv4\'" + setconfig vm_ipv4 "'$vm_ipv4'" sleep 1 set_firewall_area ;; @@ -1602,15 +1606,17 @@ set_dns_mod() { #DNS模式设置 echo -e "当前DNS运行模式为:\033[47;30m $dns_mod \033[0m" echo -e "\033[33m切换模式后需要手动重启服务以生效!\033[0m" echo ----------------------------------------------- - echo -e " 1 fake-ip模式: \033[32m响应快,兼容性较差\033[0m" + echo -e " 1 fake-ip模式: 响应快,\033[33m兼容性较差\033[0m" echo -e " 不支持CN-IP绕过功能" - echo -e " 2 redir_host模式:\033[32m不安全,易被污染\033[0m" + echo -e " 2 redir_host模式:\033[33m不安全,易被污染\033[0m" echo -e " 建议搭配第三方DNS服务使用" if echo "$crashcore" | grep -q 'singbox' || [ "$crashcore" = meta ]; then - echo -e " 3 mix混合模式: \033[32m内部realip外部fakeip\033[0m" - echo -e " 依赖geosite.dat/geosite-cn.srs数据库" + echo -e " 3 mix混合模式: \033[32m防污染防泄露,响应快,推荐!\033[0m" + echo -e " cn域名realip其他fakeip分流" + echo -e " 4 route模式: \033[32m防污染防泄露,全真实IP\033[0m" + echo -e " cn域名realip其他dns2proxy分流" fi - echo -e " 4 \033[36mDNS进阶设置\033[0m" + echo -e " 9 \033[36mDNS进阶设置\033[0m" echo " 0 返回上级菜单" read -p "请输入对应数字 > " num case $num in @@ -1639,6 +1645,17 @@ set_dns_mod() { #DNS模式设置 fi ;; 4) + if echo "$crashcore" | grep -q 'singbox' || [ "$crashcore" = meta ]; then + dns_mod=route + setconfig dns_mod $dns_mod + echo ----------------------------------------------- + echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m" + else + echo -e "\033[31m当前内核不支持的功能!!!\033[0m" + sleep 1 + fi + ;; + 9) setdns set_dns_mod ;; @@ -1728,6 +1745,7 @@ normal_set() { #基础设置 elif [ "$num" = 2 ]; then set_dns_mod + sleep 1 normal_set elif [ "$num" = 3 ]; then diff --git a/scripts/start.sh b/scripts/start.sh index 1c3d44bc..13ecf977 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -69,7 +69,11 @@ getconfig() { #读取配置及全局变量 setconfig() { #脚本配置工具 #参数1代表变量名,参数2代表变量值,参数3即文件路径 [ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}" - grep -q "${1}=" "$configpath" && sed -i "s#${1}=.*#${1}=${2}#g" "$configpath" || sed -i "\$a\\${1}=${2}" $configpath + if grep -q "^${1}=" "$configpath";then + sed -i "s#${1}=.*#${1}=${2}#g" "$configpath" + else + printf '%s=%s\n' "$1" "$2" >> "$configpath" + fi } ckcmd() { #检查命令是否存在 command -v sh >/dev/null 2>&1 && command -v "$1" >/dev/null 2>&1 || type "$1" >/dev/null 2>&1 @@ -418,28 +422,26 @@ dns: fake-ip-range6: fc00::/16 fake-ip-filter: EOF - if [ "$dns_mod" != "redir_host" ]; then + if [ "$dns_mod" = "mix" ] || [ "$dns_mod" = "fake-ip" ];then cat "$CRASHDIR"/configs/fake_ip_filter "$CRASHDIR"/configs/fake_ip_filter.list 2>/dev/null | grep -v '#' | sed "s/^/ - '/" | sed "s/$/'/" >>"$TMPDIR"/dns.yaml - [ "$dns_mod" = "mix" ] && { - #插入MIX模式防泄露设置 - cat >>"$TMPDIR"/dns.yaml <>"$TMPDIR"/dns.yaml #使用fake-ip模拟redir_host + fi + #mix模式fakeip绕过cn + [ "$dns_mod" = "mix" ] && echo ' - "rule-set:cn"' >>"$TMPDIR"/dns.yaml + #mix模式和route模式插入分流设置 + if [ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ];then + cat >>"$TMPDIR"/dns.yaml <>"$TMPDIR"/dns.yaml #使用fake-ip模拟redir_host - fi - [ "$dns_mod" != "mix" ] && cat >>"$TMPDIR"/dns.yaml <>"$TMPDIR"/dns.yaml <>"$TMPDIR"/dns.yaml - # cat "$CRASHDIR"/configs/fallback_filter.list | grep -v '#' | sed "s/^/ - '/" | sed "s/$/'/" >>"$TMPDIR"/dns.yaml - # } + fi } #域名嗅探配置 [ "$sniffer" = "已启用" ] && [ "$crashcore" = "meta" ] && sniffer_set="sniffer: {enable: true, parse-pure-ip: true, skip-domain: [Mijia Cloud], sniff: {http: {ports: [80, 8080-8880], override-destination: true}, tls: {ports: [443, 8443]}, quic: {ports: [443, 8443]}}}" @@ -683,9 +685,9 @@ EOF #根据dns模式生成 [ "$dns_mod" = "redir_host" ] && { global_dns=dns_proxy - direct_dns="{ \"inbound\": [ \"dns-in\" ], \"server\": \"dns_direct\" }," + direct_dns="{ \"inbound\": [ \"dns-in\" ], \"server\": \"dns_direct\" }" } - [ "$dns_mod" = "fake-ip" ] && { + [ "$dns_mod" = "fake-ip" ] || [ "$dns_mod" = "mix" ] && { global_dns=dns_fakeip fake_ip_filter_domain=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -Ev '#|\*|\+|Mijia' | sed '/^\s*$/d' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') fake_ip_filter_suffix=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -v '.\*' | grep -E '\*|\+' | sed 's/^[*+]\.//' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') @@ -693,25 +695,24 @@ EOF [ -n "$fake_ip_filter_domain" ] && fake_ip_filter_domain="{ \"domain\": [$fake_ip_filter_domain], \"server\": \"dns_direct\" }," [ -n "$fake_ip_filter_suffix" ] && fake_ip_filter_suffix="{ \"domain_suffix\": [$fake_ip_filter_suffix], \"server\": \"dns_direct\" }," [ -n "$fake_ip_filter_regex" ] && fake_ip_filter_regex="{ \"domain_regex\": [$fake_ip_filter_regex], \"server\": \"dns_direct\" }," + proxy_dns='{ "query_type": ["A", "AAAA"], "server": "dns_fakeip", "strategy": "'"$strategy"'", "rewrite_ttl": 1 }' + #mix模式插入fakeip过滤规则 + [ "$dns_mod" = "mix" ] && direct_dns="{ \"rule_set\": [\"cn\"], \"server\": \"dns_direct\" }," + } + [ "$dns_mod" = "route" ] && { + global_dns=dns_proxy + direct_dns="{ \"rule_set\": [\"cn\"], \"server\": \"dns_direct\" }" } - [ "$dns_mod" = "mix" ] && { - global_dns=dns_fakeip - fake_ip_filter_domain=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -Ev '#|\*|\+|Mijia' | sed '/^\s*$/d' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') - fake_ip_filter_suffix=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -v '.\*' | grep -E '\*|\+' | sed 's/^[*+]\.//' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') - fake_ip_filter_regex=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep '.\*' | sed 's/^*/.\*/' | sed 's/^+/.\+/' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') - [ -n "$fake_ip_filter_domain" ] && fake_ip_filter_domain="{ \"domain\": [$fake_ip_filter_domain], \"server\": \"dns_direct\" }," - [ -n "$fake_ip_filter_suffix" ] && fake_ip_filter_suffix="{ \"domain_suffix\": [$fake_ip_filter_suffix], \"server\": \"dns_direct\" }," - [ -n "$fake_ip_filter_regex" ] && fake_ip_filter_regex="{ \"domain_regex\": [$fake_ip_filter_regex], \"server\": \"dns_direct\" }," - direct_dns="{ \"rule_set\": [\"cn\"], \"server\": \"dns_direct\" }," #生成add_rule_set.json - [ -z "$(cat "$CRASHDIR"/jsons/*.json | grep -Ei '"tag" *: *"cn"')" ] && cat >"$TMPDIR"/jsons/add_rule_set.json <"$TMPDIR"/jsons/add_rule_set.json <"$TMPDIR"/jsons/dns.json < /dev/null [ $? -ne 0 ] && echo "文件解压失败!" && rm -rf ${TMPDIR}/clashfm.tar.gz && exit 1 #修改默认host和端口 - if [ "$db_type" = "clashdb" -o "$db_type" = "meta_db" -o "$db_type" = "meta_xd" -o "$db_type" = "zashboard" ];then + if [ "$db_type" = "clashdb" -o "$db_type" = "meta_db" -o "$db_type" = "zashboard" ];then sed -i "s/127.0.0.1/${host}/g" $dbdir/assets/*.js sed -i "s/9090/${db_port}/g" $dbdir/assets/*.js + elif [ "$db_type" = "meta_xd" ];then + sed -i "s/127.0.0.1:9090/${host}:${db_port}/g" $dbdir/_nuxt/*.js else sed -i "s/127.0.0.1:9090/${host}:${db_port}/g" $dbdir/*.html - #sed -i "s/7892/${db_port}/g" $dbdir/app*.js fi #写入配置文件 - setconfig hostdir \'$hostdir\' + setconfig hostdir "'$hostdir'" echo ----------------------------------------------- echo -e "\033[32m面板安装成功!\033[36m如未生效,请使用【Ctrl+F5】强制刷新浏览器!!!\033[0m" rm -rf ${TMPDIR}/clashdb.tar.gz @@ -1885,9 +1886,9 @@ setdb(){ echo ----------------------------------------------- echo -e "请选择面板\033[33m安装类型:\033[0m" echo -----------------维护中------------------------ - echo -e " 1 安装\033[32mzashboard面板\033[0m(约1.2mb)" + echo -e " 1 安装\033[32mzashboard面板\033[0m(约2.2mb)" echo -e " 2 安装\033[32mMetaXD面板\033[0m(约1.5mb)" - echo -e " 3 安装\033[32mYacd-Meta魔改面板\033[0m(约1.5mb)" + echo -e " 3 安装\033[32mYacd-Meta魔改面板\033[0m(约1.7mb)" echo ---------------已停止维护---------------------- echo -e " 4 安装\033[32m基础面板\033[0m(约500kb)" echo -e " 5 安装\033[32mMeta基础面板\033[0m(约800kb)" @@ -1902,12 +1903,12 @@ setdb(){ 1) db_type=zashboard echo $update_url - setconfig external_ui_url "https://raw.githubusercontent.com/juewuy/ShellCrash/dev/bin/dashboard/zashboard.tar.gz" + setconfig external_ui_url "https://raw.githubusercontent.com/juewuy/ShellCrash/update/bin/dashboard/zashboard.tar.gz" dbdir ;; 2) db_type=meta_xd - setconfig external_ui_url "https://raw.githubusercontent.com/juewuy/ShellCrash/dev/bin/dashboard/meta_xd.tar.gz" + setconfig external_ui_url "https://raw.githubusercontent.com/juewuy/ShellCrash/update/bin/dashboard/meta_xd.tar.gz" dbdir ;; 3) @@ -2007,7 +2008,7 @@ setserver(){ [ -n "$url_id" ] && url_name=$(grep "$url_id" ${CRASHDIR}/configs/servers.list 2>/dev/null | awk '{print $2}') || url_name=$update_url saveserver(){ #写入配置文件 - setconfig update_url \'$update_url\' + setconfig update_url "'$update_url'" setconfig url_id $url_id setconfig release_type $release_type echo ----------------------------------------------- @@ -2335,9 +2336,9 @@ userguide(){ dns_nameserver='https://doh.360.cn/dns-query, https://dns.alidns.com/dns-query, https://doh.pub/dns-query' dns_fallback='https://cloudflare-dns.com/dns-query, https://dns.google/dns-query, https://doh.opendns.com/dns-query' dns_resolver='https://223.5.5.5/dns-query, 2400:3200::1' - setconfig dns_nameserver \'"$dns_nameserver"\' - setconfig dns_fallback \'"$dns_fallback"\' - setconfig dns_resolver \'"$dns_resolver"\' + setconfig dns_nameserver "'$dns_nameserver'" + setconfig dns_fallback "'$dns_fallback'" + setconfig dns_resolver "'$dns_resolver'" fi #开启公网访问 sethost(){ @@ -2369,7 +2370,7 @@ userguide(){ setconfig mix_port $mix_port setconfig host $host setconfig public_support $public_support - setconfig authentication \'$authentication\' + setconfig authentication "'$authentication'" fi fi #启用推荐的自动任务配置 diff --git a/version b/version index 7224bef2..1bc7897e 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.9.3beta4fix +1.9.3beta5