diff --git a/src/core.sh b/src/core.sh index 780abcf..af0db72 100644 --- a/src/core.sh +++ b/src/core.sh @@ -1758,7 +1758,9 @@ update() { is_update_repo=$is_core_repo ;; 2 | sh) - err "当前项目已净化,已禁用自动更新脚本以防止覆盖净化修改。" + is_update_name=sh + is_show_name="脚本" + is_run_ver=$is_sh_ver ;; 3 | caddy) [[ ! $is_caddy ]] && err "不支持更新 Caddy." @@ -1771,6 +1773,13 @@ update() { err "无法识别 ($1), 请使用: $is_core update [core | sh | caddy] [ver]" ;; esac + load download.sh + if [[ $is_update_name == 'sh' ]]; then + msg "\n正在从 Gitea 获取最新脚本并应用...\n" + download sh latest + msg "更新成功, 当前脚本已更新为最新版。\n" + exit + fi [[ $2 ]] && is_new_ver=v${2#v} [[ $is_run_ver == $is_new_ver ]] && { msg "\n自定义版本和当前 $is_show_name 版本一样, 无需更新.\n" diff --git a/src/download.sh b/src/download.sh index 9657d38..9e6f70a 100644 --- a/src/download.sh +++ b/src/download.sh @@ -40,9 +40,9 @@ download() { sh) name="$is_core_name 脚本" tmpfile=$tmpdir/sh.tar.gz - link="https://github.com/${is_sh_repo}/releases/download/${latest_ver}/code.tar.gz" + link="https://git.lll.rest/svefnz/sing-box/archive/main.tar.gz" download_file - tar zxf $tmpfile -C $is_sh_dir + tar zxf $tmpfile --strip-components 1 -C $is_sh_dir chmod +x $is_sh_bin ${is_sh_bin/$is_core/sb} ;; caddy)