|
|
|
|
@ -34,10 +34,10 @@ E[13]="Update WARP+ account..." |
|
|
|
|
C[13]="升级 WARP+ 账户中……" |
|
|
|
|
E[14]="The upgrade failed, WARP+ account error or more than 5 devices have been activated. Free WARP account to continu." |
|
|
|
|
C[14]="升级失败,WARP+ 账户错误或者已激活超过5台设备,自动更换免费 WARP 账户继续" |
|
|
|
|
E[15]="Congratulations! WARP\$TYPE is turned on. Spend time:\$(( end - start )) seconds.\\\n The script runs today: \$TODAY. Total:\$TOTAL" |
|
|
|
|
C[15]="恭喜!WARP\$TYPE 已开启,总耗时:\$(( end - start ))秒, 脚本当天运行次数:\$TODAY,累计运行次数:\$TOTAL" |
|
|
|
|
E[16]="Congratulations! WARP is turned on. Spend time:\$(( end - start )) seconds.\\\n The script runs on today: \$TODAY. Total:\$TOTAL" |
|
|
|
|
C[16]="恭喜!WARP 已开启,总耗时:\$(( end - start ))秒, 脚本当天运行次数:\$TODAY,累计运行次数:\$TOTAL" |
|
|
|
|
E[15]="Congratulations! WARP\$TYPE is turned on. Spend time:\$(( end - start )) seconds.\\\n The script runs today: \${TODAY}. Total:\${TOTAL}" |
|
|
|
|
C[15]="恭喜!WARP\$TYPE 已开启,总耗时:\$(( end - start ))秒, 脚本当天运行次数:\${TODAY},累计运行次数:\${TOTAL}" |
|
|
|
|
E[16]="Congratulations! WARP is turned on. Spend time:\$(( end - start )) seconds.\\\n The script runs on today: \${TODAY}. Total:\${TOTAL}" |
|
|
|
|
C[16]="恭喜!WARP 已开启,总耗时:\$(( end - start ))秒, 脚本当天运行次数:\${TODAY},累计运行次数:\${TOTAL}" |
|
|
|
|
E[17]="Device name:\$(grep -s 'Device name' /etc/wireguard/info.log | awk '{ print \$NF }')\\\n Quota:\$(grep -s Quota /etc/wireguard/info.log | awk '{ print \$(NF-1), \$NF }')" |
|
|
|
|
C[17]="设备名:\$(grep -s 'Device name' /etc/wireguard/info.log | awk '{ print \$NF }')\\\n 剩余流量:\$(grep -s Quota /etc/wireguard/info.log | awk '{ print \$(NF-1), \$NF }')" |
|
|
|
|
E[18]="Run again with warp [option], such as" |
|
|
|
|
@ -208,7 +208,8 @@ onoff(){ |
|
|
|
|
|
|
|
|
|
# 同步脚本至最新版本 |
|
|
|
|
ver(){ |
|
|
|
|
sudo curl -o /etc/wireguard/mac.sh https://raw.githubusercontent.com/fscarmen/test/main/mac.sh |
|
|
|
|
T=$(cat /etc/wireguard/language | tr '[:lower:]' '[:upper:]') |
|
|
|
|
sudo curl -o /etc/wireguard/mac.sh https://raw.githubusercontents.com/fscarmen/warp/main/pc/mac.sh |
|
|
|
|
sudo chmod +x /etc/wireguard/mac.sh |
|
|
|
|
sudo ln -sf /etc/wireguard/mac.sh /usr/local/bin/warp |
|
|
|
|
green " ${L[28]}:$(grep ^VERSION /etc/wireguard/mac.sh | sed "s/.*=//g") ${L[29]}:$(grep "$T\[1]" /etc/wireguard/mac.sh | cut -d \" -f2) " || red " ${L[30]} " |
|
|
|
|
@ -251,15 +252,16 @@ install(){ |
|
|
|
|
! type -p brew >/dev/null 2>&1 && /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" |
|
|
|
|
! type -p wg >/dev/null 2>&1 && brew install wireguard-tools |
|
|
|
|
|
|
|
|
|
# 判断 wgcf 的最新版本,如因 github 接口问题未能获取,默认 v2.2.14 |
|
|
|
|
# 判断 wgcf 的最新版本,如因 github 接口问题未能获取,默认 v2.2.15 |
|
|
|
|
green "\n ${L[11]}\n " |
|
|
|
|
latest=$(curl -fsSL "https://api.github.com/repos/ViRb3/wgcf/releases/latest" | grep "tag_name" | head -n 1 | cut -d : -f2 | sed 's/[ \"v,]//g') |
|
|
|
|
latest=${latest:-'2.2.14'} |
|
|
|
|
latest=${latest:-'2.2.15'} |
|
|
|
|
[[ ! -e /usr/local/bin/wgcf ]] && sudo curl -o /usr/local/bin/wgcf https://raw.githubusercontents.com/fscarmen/warp/main/wgcf/wgcf_"$latest"_darwin_"$ARCHITECTURE" |
|
|
|
|
|
|
|
|
|
# 安装 wireguard-go |
|
|
|
|
[[ ! -e /usr/local/bin/wireguard-go ]] && sudo curl -o /usr/local/bin/wireguard-go_darwin_"$ARCHITECTURE".tar.gz https://raw.githubusercontents.com/fscarmen/warp/main/wireguard-go/wireguard-go_darwin_"$ARCHITECTURE".tar.gz && |
|
|
|
|
sudo tar xzf /usr/local/bin/wireguard-go_darwin_"$ARCHITECTURE".tar.gz -C /usr/local/bin/ && rm -f /usr/local/bin/wireguard-go_darwin_"$ARCHITECTURE".tar.gz |
|
|
|
|
sudo tar xzf /usr/local/bin/wireguard-go_darwin_"$ARCHITECTURE".tar.gz -C /usr/local/bin/ |
|
|
|
|
sudo rm -f /usr/local/bin/wireguard-go_darwin_"$ARCHITECTURE".tar.gz |
|
|
|
|
|
|
|
|
|
# 添加执行权限 |
|
|
|
|
sudo chmod +x /usr/local/bin/wireguard-go /usr/local/bin/wgcf |
|
|
|
|
@ -395,7 +397,7 @@ case "$OPTION" in |
|
|
|
|
e ) L=("${E[@]}"); check_operating_system; install;; |
|
|
|
|
c ) L=("${C[@]}"); check_operating_system; install;; |
|
|
|
|
u ) uninstall;; |
|
|
|
|
v ) T=$(cat /etc/wireguard/language | tr '[:lower:]' '[:upper:]'); ver;; |
|
|
|
|
v ) ver;; |
|
|
|
|
a ) update;; |
|
|
|
|
n ) net;; |
|
|
|
|
o ) onoff;; |
|
|
|
|
|