From 077585ceb4e4453f0ca19649ef10fabde2f5b6f0 Mon Sep 17 00:00:00 2001 From: 233boy Date: Fri, 12 Oct 2018 11:06:55 +0800 Subject: [PATCH] curl header add no cache --- v2ray.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/v2ray.sh b/v2ray.sh index aff7330..aa4e96f 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v2.42" +_version="v2.43" cmd="apt-get" @@ -2950,7 +2950,19 @@ update_v2ray() { fi } update_v2ray.sh() { - local latest_version=$(curl -s -L "https://raw.githubusercontent.com/233boy/v2ray/master/v2ray.sh?r=$RANDOM" | grep '_version' -m1 | cut -d\" -f2) + local latest_version=$(curl -H 'Cache-Control: no-cache' -s -L "https://raw.githubusercontent.com/233boy/v2ray/master/v2ray.sh" | grep '_version' -m1 | cut -d\" -f2) + + if [[ ! $latest_version ]]; then + echo + echo -e " $red获取 V2Ray 最新版本失败!!!$none" + echo + echo -e " 请尝试执行如下命令: $green echo 'nameserver 8.8.8.8' >/etc/resolv.conf $none" + echo + echo " 然后再继续...." + echo + exit 1 + fi + if [[ $latest_version == $_version ]]; then echo echo -e "$green 木有发现新版本 $none"