From cbd1ddc5e708659cf29c76c6af96de42e96030d1 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Sat, 7 Aug 2021 20:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgithub=5Fproxy=5Furl=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=BD=B1=E5=93=8D=E6=8B=89=E5=8F=96gitee=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E6=88=96=E8=80=85=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index 6f519202..aeb395ef 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -148,7 +148,12 @@ update_repo() { local repo_path="${dir_repo}/${uniq_path}" - local formatUrl="${github_proxy_url}${url/https:\/\/ghproxy.com\//}" + local formatUrl="$url" + if [[ $github_proxy_url ]]; then + if [[ $url =~ "github.com" ]] || [[ $url =~ "githubusercontent.com" ]]; then + [[ ! $url =~ "https://ghproxy.com" ]] && formatUrl="${github_proxy_url}${url}" + fi + fi if [ -d ${repo_path}/.git ]; then reset_romote_url ${repo_path} "${formatUrl}" "${branch}" git_pull_scripts ${repo_path} "${branch}" @@ -166,7 +171,13 @@ update_repo() { ## 更新所有 raw 文件 update_raw() { echo -e "--------------------------------------------------------------\n" - local raw_url="${github_proxy_url}${1/https:\/\/ghproxy.com\//}" + local url="$1" + local raw_url="$url" + if [[ $github_proxy_url ]]; then + if [[ $url =~ "github.com" ]] || [[ $url =~ "githubusercontent.com" ]]; then + [[ ! $url =~ "https://ghproxy.com" ]] && raw_url="${github_proxy_url}${url}" + fi + fi local suffix="${raw_url##*.}" local raw_file_name="${uniq_path}.${suffix}" echo -e "开始下载:${raw_url} \n\n保存路径:$dir_raw/${raw_file_name}\n" @@ -227,7 +238,7 @@ usage() { echo -e "4. $cmd_update repo # 更新单个仓库的脚本" echo -e "5. $cmd_update rmlog # 删除旧日志" echo -e "6. $cmd_update bot # 启动tg-bot" - echo -e "7. $cmd_update reset # 重置青龙基础环境" + echo -e "7. $cmd_update check # 检测青龙环境并修复" } ## 更新qinglong