From 9be594a7f4b9565fe4220de2025a240cd48b6ae5 Mon Sep 17 00:00:00 2001 From: fscarmen <62703343+fscarmen@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:53:39 +0800 Subject: [PATCH] Update menu.sh --- menu.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/menu.sh b/menu.sh index 4415532..566a774 100644 --- a/menu.sh +++ b/menu.sh @@ -200,8 +200,8 @@ T[E95]="Client works with non-WARP IPv4. The script is aborted. Feedback: [https T[C95]="Client 在非 WARP IPv4 下才能工作正常,脚本中止,问题反馈:[https://github.com/fscarmen/warp/issues]" T[E96]="Client connecting failure. It may be a CloudFlare IPv4." T[C96]="Client 连接失败,可能是 CloudFlare IPv4." -T[E97]="It is a WARP+ account already. Update is aborted." -T[C97]="已经是 WARP+ 账户,不需要升级" +T[E97]="It is a WARP+ account already. Quota: \${Quota}. Update is aborted." +T[C97]="已经是 WARP+ 账户,剩余流量: \${Quota},不需要升级" T[E98]="Uninstall WirePorxy was complete." T[C98]="WirePorxy 卸载成功" T[E99]="WireProxy is connected" @@ -521,11 +521,11 @@ plus(){ 2 ) input reading " ${T[${L}57]} " MISSION MISSION=${MISSION//[^0-9]/} - bash <(wget --no-check-certificate -qO- -T8 https://raw.githubusercontents.com/fscarmen/tools/main/warp_plus.sh) $MISSION $ID;; + bash <(wget --no-check-certificate -qO- -T8 https://raw.githubusercontent.com/fscarmen/tools/main/warp_plus.sh) $MISSION $ID;; 3 ) input reading " ${T[${L}57]} " MISSION MISSION=${MISSION//[^0-9]/} - bash <(wget --no-check-certificate -qO- -T8 https://raw.githubusercontents.com/SoftCreatR/warp-up/main/warp-up.sh) --disclaimer --id $ID --iterations $MISSION;; + bash <(wget --no-check-certificate -qO- -T8 https://raw.githubusercontent.com/SoftCreatR/warp-up/main/warp-up.sh) --disclaimer --id $ID --iterations $MISSION;; 4 ) [[ $OPTION != p ]] && menu || exit;; * ) red " ${T[${L}51]} [1-4] "; sleep 1; plus;; esac @@ -767,7 +767,7 @@ uninstall(){ # 同步脚本至最新版本 ver(){ - wget -N -P /etc/wireguard https://raw.githubusercontent.com/fscarmen/warp/main/menu.sh || wget -N -P /etc/wireguard https://raw.githubusercontents.com/fscarmen/warp/main/menu.sh + wget -N -P /etc/wireguard https://raw.githubusercontent.com/fscarmen/warp/main/menu.sh || wget -N -P /etc/wireguard https://raw.githubusercontent.com/fscarmen/warp/main/menu.sh chmod +x /etc/wireguard/menu.sh ln -sf /etc/wireguard/menu.sh /usr/bin/warp green " ${T[${L}64]}:$(grep ^VERSION /etc/wireguard/menu.sh | sed "s/.*=//g") ${T[${L}18]}:$(grep "T\[${L}1]" /etc/wireguard/menu.sh | cut -d \" -f2) " || red " ${T[${L}65]} " @@ -1219,7 +1219,7 @@ install(){ # 安装 wgcf,尽量下载官方的最新版本,如官方 wgcf 下载不成功,将使用 githubusercontents 的 CDN,以更好的支持双栈。并添加执行权限 wget --no-check-certificate -T1 -t1 $CDN -O /usr/bin/wgcf https://github.com/ViRb3/wgcf/releases/download/v"$latest"/wgcf_"$latest"_linux_$ARCHITECTURE || - wget --no-check-certificate $CDN -O /usr/bin/wgcf https://raw.githubusercontents.com/fscarmen/warp/main/wgcf/wgcf_"$latest"_linux_$ARCHITECTURE + wget --no-check-certificate $CDN -O /usr/bin/wgcf https://raw.githubusercontent.com/fscarmen/warp/main/wgcf/wgcf_"$latest"_linux_$ARCHITECTURE chmod +x /usr/bin/wgcf # 如安装 WireProxy ,尽量下载官方的最新版本,如官方 WireProxy 下载不成功,将使用 githubusercontents 的 CDN,以更好的支持双栈。并添加执行权限 @@ -1227,7 +1227,7 @@ install(){ wireproxy_latest=$(wget --no-check-certificate -qO- -T1 -t1 $CDN "https://api.github.com/repos/octeep/wireproxy/releases/latest" | grep "tag_name" | head -n 1 | cut -d : -f2 | sed 's/[ \"v,]//g') wireproxy_latest=${wireproxy_latest:-'1.0.3'} wget --no-check-certificate -T1 -t1 $CDN -N https://github.com/octeep/wireproxy/releases/download/v"$wireproxy_latest"/wireproxy_linux_$ARCHITECTURE.tar.gz || - wget --no-check-certificate $CDN -N https://raw.githubusercontents.com/fscarmen/warp/main/wireproxy/wireproxy_linux_$ARCHITECTURE.tar.gz + wget --no-check-certificate $CDN -N https://raw.githubusercontent.com/fscarmen/warp/main/wireproxy/wireproxy_linux_$ARCHITECTURE.tar.gz tar xzf wireproxy_linux_$ARCHITECTURE.tar.gz -C /usr/bin/; rm -f wireproxy_linux* fi @@ -1338,7 +1338,7 @@ install(){ Alpine(){ # 安装一些必要的网络工具包和wireguard-tools (Wire-Guard 配置工具:wg、wg-quick) - ${PACKAGE_INSTALL[int]} net-tools iproute2 openresolv openrc iptables + ${PACKAGE_INSTALL[int]} net-tools iproute2 openresolv openrc iptables ip6tables [[ $OCTEEP != 1 ]] && ${PACKAGE_INSTALL[int]} wireguard-tools } @@ -1468,7 +1468,7 @@ EOF # Linux 内核低于5.6的,安装 Wireguard-GO。部分较低内核版本的KVM,即使安装了wireguard-dkms, 仍不能正常工作,兜底使用 wireguard-go ([[ $WG = 1 ]] || [[ $(systemctl is-active wg-quick@wgcf) != active ]] || [[ $(systemctl is-enabled wg-quick@wgcf) != enabled ]]) && - wget --no-check-certificate $CDN -N https://raw.githubusercontents.com/fscarmen/warp/main/wireguard-go/wireguard-go_linux_"$ARCHITECTURE".tar.gz && + wget --no-check-certificate $CDN -N https://raw.githubusercontent.com/fscarmen/warp/main/wireguard-go/wireguard-go_linux_"$ARCHITECTURE".tar.gz && tar xzf wireguard-go_linux_$ARCHITECTURE.tar.gz -C /usr/bin/ && rm -f wireguard-go_linux_* && chmod +x /usr/bin/wireguard-go # 保存好配置文件 @@ -1592,6 +1592,7 @@ proxy(){ make install cd ../.. rm -rf glibc-2.28* + ! systemctl is-active warp-svc >/dev/null 2>&1 && systemctl enable --now warp-svc fi;; 8|9 ) rpm -ivh Client_CentOS_8.rpm;; @@ -1621,7 +1622,7 @@ proxy(){ if [[ $GLIBC = 1 ]]; then rm -rf /var/lib/rpm/__db* yum clean all - rpm -v rebuilddb + rpm --rebuilddb fi # 创建再次执行的软链接快捷方式,再次运行可以用 warp 指令,设置默认语言 @@ -1720,7 +1721,14 @@ update(){ client_account(){ [[ $ARCHITECTURE = arm64 ]] && red " ${T[${L}101]} " && exit 1 - [[ $(warp-cli --accept-tos account) =~ Limited ]] && red " ${T[${L}97]} " && exit 1 + if [[ $(warp-cli --accept-tos account) =~ Limited ]]; then + ACCESS_TOKEN=$(grep 'access_token' /etc/wireguard/wgcf-account.toml | cut -d \" -f2) + DEVICE_ID=$(grep 'device_id' /etc/wireguard/wgcf-account.toml | cut -d \" -f2) + API=$(curl -s "https://api.cloudflareclient.com/v0a884/reg/$DEVICE_ID" -H "User-Agent: okhttp/3.12.1" -H "Authorization: Bearer $ACCESS_TOKEN") + QUOTA=$(grep -oP '"quota":\K\d+' <<< $API) + [[ $QUOTA -gt 10000000000000 ]] && QUOTA="$((QUOTA/1000000000000)) TB" || QUOTA="$((QUOTA/1000000000)) GB" + red " ${T[${L}97]} " && exit 1 + fi update_license warp-cli --accept-tos set-license "$LICENSE" >/dev/null 2>&1; sleep 1 ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null)