From 426b54a2d0ed9821b9792d47193a2c03b9d0b29f Mon Sep 17 00:00:00 2001 From: bin456789 Date: Tue, 28 Nov 2023 22:24:44 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E5=B0=86=20github=20=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=94=BE=E5=88=B0=E6=96=87=E4=BB=B6=E5=A4=B4=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.bat | 11 +++++++---- reinstall.sh | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/reinstall.bat b/reinstall.bat index a5c3541..ca84046 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -1,6 +1,7 @@ @echo off -set confhome=https://raw.githubusercontent.com/bin456789/reinstall/main setlocal EnableDelayedExpansion +set confhome=https://raw.githubusercontent.com/bin456789/reinstall/main +set github_proxy=https://ghps.cc :: Windows 7 SP1 winhttp 默认不支持 tls 1.2 :: https://support.microsoft.com/en-us/topic/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-winhttp-in-windows-c4bd73d2-31d7-761e-0178-11268bb10392 @@ -31,9 +32,11 @@ if !errorlevel! == 0 ( :: mirrors.tuna.tsinghua.edu.cn 会强制跳转 https set mirror=http://mirror.nju.edu.cn - echo !confhome! | findstr /c:"://raw.githubusercontent.com/" >nul - if !errorlevel! == 0 ( - set confhome=https://ghps.cc/!confhome! + if defined github_proxy ( + echo !confhome! | findstr /c:"://raw.githubusercontent.com/" >nul + if !errorlevel! == 0 ( + set confhome=!github_proxy!/!confhome! + ) ) ) else ( :: mirrors.kernel.org 在荷兰太慢 diff --git a/reinstall.sh b/reinstall.sh index 12b3687..c5efa6b 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -3,6 +3,7 @@ set -eE confhome=https://raw.githubusercontent.com/bin456789/reinstall/main +github_proxy=https://ghps.cc this_script=$(realpath "$0") trap 'trap_err $LINENO $?' ERR @@ -1301,9 +1302,8 @@ esac # gitee 不支持ipv6 # jsdelivr 有12小时缓存 # https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L31 -if [[ "$confhome" == http*://raw.githubusercontent.com/* ]] && - is_in_china; then - confhome=https://ghps.cc/$confhome +if [ -n "$github_proxy" ] && [[ "$confhome" = http*://raw.githubusercontent.com/* ]] && is_in_china; then + confhome=$github_proxy/$confhome fi # 以下目标系统不需要进入alpine