From 28e8ef56d27d040fef3a64ca05271a97f148dd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=9C=E6=96=B9=E6=9C=89=E9=B1=BC=E5=90=8D=E4=B8=BA?= =?UTF-8?q?=E5=92=B8?= Date: Fri, 18 Sep 2020 23:04:18 +0800 Subject: [PATCH] add user-agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 没有合法的 UA GitHub会拒绝链接导致安装或者更新失败,提示: ``` curl: (7) Failed to connect to api.github.com port 443: Connection refused error: Failed to get release list, please check your network. ``` --- install-release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-release.sh b/install-release.sh index 1f0866b..bf5d220 100644 --- a/install-release.sh +++ b/install-release.sh @@ -254,7 +254,7 @@ get_version() { TMP_FILE="$(mktemp)" install_software curl # DO NOT QUOTE THESE `${PROXY}` VARIABLES! - if ! "curl" ${PROXY} -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then + if ! "curl" ${PROXY} --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36' -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then "rm" "$TMP_FILE" echo 'error: Failed to get release list, please check your network.' exit 1 @@ -302,7 +302,7 @@ download_v2ray() { "mkdir" -p "$TMP_DIRECTORY" DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip" echo "Downloading V2Ray archive: $DOWNLOAD_LINK" - if ! "curl" ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then + if ! "curl" ${PROXY} --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36' -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then echo 'error: Download failed! Please check your network or try again.' return 1 fi