use GHPROXY_ADDRESS to customize ghproxy url

This commit is contained in:
amazingfate
2023-11-21 11:22:40 +08:00
committed by Igor
parent 875d4f7450
commit 81c460e3bf
2 changed files with 4 additions and 3 deletions

View File

@@ -218,7 +218,8 @@ function do_main_configuration() {
GITHUB_SOURCE='https://hub.fastgit.xyz'
;;
ghproxy)
GITHUB_SOURCE='https://ghproxy.com/https://github.com'
[[ -z $GHPROXY_ADDRESS ]] && GHPROXY_ADDRESS=ghproxy.com
GITHUB_SOURCE="https://${GHPROXY_ADDRESS}/https://github.com"
;;
gitclone)
GITHUB_SOURCE='https://gitclone.com/github.com'

View File

@@ -44,7 +44,7 @@ function memoized_git_ref_to_info() {
"ghproxy")
case "${MEMO_DICT[GIT_SOURCE]}" in
"https://github.com/"*)
sha1="$(git ls-remote --exit-code "https://ghproxy.com/${MEMO_DICT[GIT_SOURCE]}" "${to_try}" | cut -f1)"
sha1="$(git ls-remote --exit-code "https://${GHPROXY_ADDRESS}/${MEMO_DICT[GIT_SOURCE]}" "${to_try}" | cut -f1)"
;;
*)
sha1="$(git ls-remote --exit-code "${MEMO_DICT[GIT_SOURCE]}" "${to_try}" | cut -f1)"
@@ -106,7 +106,7 @@ function memoized_git_ref_to_info() {
org_and_repo="${org_and_repo%.git}" # remove .git if present
case "${GITHUB_MIRROR}" in
"ghproxy")
url="https://ghproxy.com/https://raw.githubusercontent.com/${org_and_repo}/${sha1}/Makefile"
url="https://${GHPROXY_ADDRESS}/https://raw.githubusercontent.com/${org_and_repo}/${sha1}/Makefile"
;;
*)
url="https://raw.githubusercontent.com/${org_and_repo}/${sha1}/Makefile"