From 34102a9a50a96f27c960b91add93918ee003cf4c Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 6 Dec 2025 19:59:07 +0800 Subject: [PATCH] =?UTF-8?q?~=E5=A2=9E=E5=8A=A0Zashboard=E3=80=81metaxd?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E8=87=AA=E5=8A=A8=E9=85=8D=E7=BD=AE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=9B=B4=E6=96=B0=E5=8A=9F=E8=83=BD(=E9=9C=80?= =?UTF-8?q?=E9=87=8D=E8=A3=85=E9=9D=A2=E6=9D=BF)=20~=E5=A2=9E=E5=8A=A06-1?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE=E9=A6=96?= =?UTF-8?q?=E6=AC=A1=E5=A4=B1=E8=B4=A5=E5=90=8E=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=9C=A8=E7=BA=BF=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E5=8A=9F=E8=83=BD=20~=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E9=9D=A2=E6=9D=BF=E9=80=89=E6=8B=A9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=A1=BA=E5=BA=8F=E5=8F=8A=E6=96=87=E5=AD=97=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=20~=E4=BF=AE=E5=A4=8Dwget=E6=8E=A8=E9=80=81=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=97=B6=E4=BC=9A=E9=94=99=E8=AF=AF=E7=95=99=E4=B8=8B?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=96=87=E4=BB=B6=E7=9A=84bug=20~=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8A=9F=E8=83=BD=E6=9B=B4=E6=96=B0=E5=86=85?= =?UTF-8?q?=E6=A0=B8=E5=A4=B1=E8=B4=A5=E7=9A=84bug=20~=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B0=8F=E9=97=AA=E5=AD=98=E6=A8=A1=E5=BC=8F=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=86=85=E6=A0=B8=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E7=A1=AE=E6=98=BE=E7=A4=BA=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 17 ++++++++++++++--- scripts/task.sh | 10 +++++----- scripts/webget.sh | 39 +++++++++++++++++++++------------------ 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index ae2cf72..0f62a90 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -118,7 +118,7 @@ logger() { #日志工具 if curl --version >/dev/null 2>&1; then curl -kfsSl -X POST --connect-timeout 3 -H "Content-Type: application/json; charset=utf-8" "$1" -d "$2" >/dev/null 2>&1 elif wget --version >/dev/null 2>&1; then - wget -Y on -q --timeout=3 --method=POST --header="Content-Type: application/json; charset=utf-8" --body-data="$2" "$1" + wget -Y on -q --timeout=3 -O - --method=POST --header="Content-Type: application/json; charset=utf-8" --body-data="$2" "$1" >/dev/null 2>&1 else echo "找不到有效的curl或wget应用,请先安装!" fi @@ -317,6 +317,10 @@ check_singbox_config() { #检查singbox配置文件 #清理多余逗号 sed -i 's/,\+/,/g; s/\[,/\[/g; s/,]/]/g' "$core_config_new" } +update_servers(){ #更新servers.list + get_bin "$TMPDIR"/servers.list public/servers.list + [ "$?" = 0 ] && mv -f "$TMPDIR"/servers.list "$CRASHDIR"/configs/servers.list +} get_core_config() { #下载内核配置文件 [ -z "$rule_link" ] && rule_link=1 [ -z "$server_link" ] || [ $server_link -gt $(grep -aE '^4' "$CRASHDIR"/configs/servers.list | wc -l) ] && server_link=1 @@ -354,8 +358,13 @@ get_core_config() { #下载内核配置文件 else retry=$((retry + 1)) logger "配置文件获取失败!" 31 - echo -e "\033[32m尝试使用其他服务器获取配置!\033[0m" - logger "正在重试第$retry次/共3次!" 33 + if [ "$retry" = 1 ];then + echo -e "\033[32m尝试更新服务器列表并使用其他服务器获取配置!\033[0m" + update_servers + else + echo -e "\033[32m尝试使用其他服务器获取配置!\033[0m" + fi + echo -e "正在重试\033[33m第$retry次/共3次!\033[0m" if [ "$server_link" -ge 4 ]; then server_link=0 fi @@ -450,6 +459,7 @@ log-level: info ipv6: true external-controller: :$db_port external-ui: ui +external-ui-url: "$external_ui_url" secret: $secret $tun $exper @@ -874,6 +884,7 @@ EOF "clash_api": { "external_controller": "0.0.0.0:$db_port", "external_ui": "ui", + "external_ui_download_url": "$external_ui_url", "secret": "$secret", "default_mode": "Rule" } diff --git a/scripts/task.sh b/scripts/task.sh index c77ebdc..ad65909 100644 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -28,7 +28,7 @@ update_core(){ #自动更新内核 #检查版本 check_update crash_v_new=$(eval echo \$${crashcore}_v) - if [ -z "$crash_v_new" -o "$crash_v_new" = "core_v" ];then + if [ -z "$crash_v_new" -o "$crash_v_new" = "$core_v" ];then logger "任务【自动更新内核】中止-未检测到版本更新" exit 1 else @@ -49,13 +49,13 @@ update_core(){ #自动更新内核 else [ -n "$(pidof CrashCore)" ] && ${CRASHDIR}/start.sh stop #停止内核服务防止内存不足 [ -f ${TMPDIR}/core_new.tar.gz ] && { - mkdir -p ${TMPDIR}/core_new + mkdir -p ${TMPDIR}/core_new_dir [ "$BINDIR" = "$TMPDIR" ] && rm -rf ${TMPDIR}/CrashCore #小闪存模式防止空间不足 - tar -zxf "${TMPDIR}/core_new.tar.gz" ${tar_para} -C ${TMPDIR}/core_new/ - for file in $(find ${TMPDIR}/core_tmp 2>/dev/null);do + tar -zxf "${TMPDIR}/core_new.tar.gz" ${tar_para} -C ${TMPDIR}/core_new_dir/ + for file in $(find ${TMPDIR}/core_new_dir 2>/dev/null);do [ -f $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|premium)')" ] && mv -f $file ${TMPDIR}/core_new done - rm -rf ${TMPDIR}/core_new + rm -rf ${TMPDIR}/core_new_dir } [ -f ${TMPDIR}/core_new.gz ] && gunzip ${TMPDIR}/core_new.gz >/dev/null && rm -rf ${TMPDIR}/core_new.gz chmod +x ${TMPDIR}/core_new diff --git a/scripts/webget.sh b/scripts/webget.sh index 27667ab..7367e91 100644 --- a/scripts/webget.sh +++ b/scripts/webget.sh @@ -1489,7 +1489,7 @@ setcustcore(){ #自定义内核 setcore(){ #内核选择菜单 #获取核心及版本信息 [ -z "$crashcore" ] && crashcore="unknow" - [ ! -f ${CRASHDIR}/CrashCore.tar.gz ] && crashcore="未安装核心" + [ ! -f ${CRASHDIR}/CrashCore.tar.gz -o ! -f ${BINDIR}/CrashCore.tar.gz ] && crashcore="未安装核心" echo "$crashcore" | grep -q 'singbox' && core_old=singbox || core_old=clash [ -n "$custcorelink" ] && custcore="$(echo $custcorelink | sed 's#.*github.com##; s#/releases/download/#@#; s#-linux.*$##')" ### @@ -1844,7 +1844,7 @@ setdb(){ echo ----------------------------------------------- echo -e "\033[31m检测到您已经安装过本地面板了!\033[0m" echo ----------------------------------------------- - read -p "是否覆盖安装?[1/0] > " res + read -p "是否升级/覆盖安装?[1/0] > " res if [ "$res" = 1 ]; then rm -rf ${BINDIR}/ui [ -f /www/clash/CNAME ] && rm -rf /www/clash && dbdir=/www/clash @@ -1888,15 +1888,15 @@ setdb(){ echo -e "\033[32m打开管理面板的速度更快且更稳定\033[0m" echo ----------------------------------------------- echo -e "请选择面板\033[33m安装类型:\033[0m" + echo -----------------维护中------------------------ + echo -e " 1 安装\033[32mzashboard面板\033[0m(约1.2mb)" + echo -e " 2 安装\033[32mMetaXD面板\033[0m(约1.5mb)" + echo -e " 3 安装\033[32mYacd-Meta魔改面板\033[0m(约1.5mb)" + echo ---------------已停止维护---------------------- + echo -e " 4 安装\033[32m基础面板\033[0m(约500kb)" + echo -e " 5 安装\033[32mMeta基础面板\033[0m(约800kb)" + echo -e " 6 安装\033[32mYacd面板\033[0m(约1.1mb)" echo ----------------------------------------------- - echo -e " 1 安装\033[32mYacd面板\033[0m(约1.1mb)" - echo -e " 2 安装\033[32mYacd-Meta魔改面板\033[0m(约1.5mb)" - echo -e " 3 安装\033[32mMetaXD面板\033[0m(约1.5mb)" - echo -e " 4 安装\033[32mzashboard面板\033[0m(约1.2mb)" - [ "$crashcore" != singbox ] && { - echo -e " 5 安装\033[32m基础面板\033[0m(约500kb)" - echo -e " 6 安装\033[32mMeta基础面板\033[0m(约800kb)" - } echo -e " 9 卸载\033[33m本地面板\033[0m" echo " 0 返回上级菜单" read -p "请输入对应数字 > " num @@ -1904,29 +1904,32 @@ setdb(){ case "$num" in 0) ;; 1) - db_type=yacd + db_type=zashboard + echo $update_url + setconfig external_ui_url "https://raw.githubusercontent.com/juewuy/ShellCrash/dev/bin/dashboard/zashboard.tar.gz" dbdir ;; 2) - db_type=meta_yacd + db_type=meta_xd + setconfig external_ui_url "https://raw.githubusercontent.com/juewuy/ShellCrash/dev/bin/dashboard/meta_xd.tar.gz" dbdir ;; 3) - db_type=meta_xd + db_type=meta_yacd dbdir ;; 4) - db_type=zashboard - dbdir - ;; - 5) db_type=clashdb dbdir ;; - 6) + 5) db_type=meta_db dbdir ;; + 6) + db_type=yacd + dbdir + ;; 9) read -p "确认卸载本地面板?(1/0) > " res if [ "$res" = 1 ];then