mirror of
https://gitlab.com/fscarmen/warp.git
synced 2026-06-15 03:25:42 +08:00
Fix the return code in registing api.
Former-commit-id: 3713e8b6a1fa5c9693a1953cc73eaa36dd2fee3e
This commit is contained in:
@@ -77,7 +77,7 @@ registe_account() {
|
||||
--data '{"key":"'${public_key}'","install_id":"'${install_id}'","fcm_token":"'${fcm_token}'","tos":"'$(date +"%Y-%m-%dT%H:%M:%S.000Z")'","model":"PC","serial_number":"'${install_id}'","locale":"zh_CN"}' \
|
||||
| python3 -m json.tool | sed "/\"account_type\"/i\ \"private_key\": \"$private_key\"," > $registe_path
|
||||
|
||||
[ -s $registe_path ] && cat $registe_path && grep -q 'error code' $registe_path && rm -f $registe_path
|
||||
[[ ! -s $registe_path || $(grep 'error' $registe_path) ]] && { rm -f $registe_path; exit 1; } || { cat $registe_path; exit 0; }
|
||||
}
|
||||
|
||||
# 获取设备信息
|
||||
|
||||
@@ -780,7 +780,7 @@ change_ip() {
|
||||
wg-quick down warp >/dev/null 2>&1
|
||||
[ -s /etc/wireguard/info.log ] && grep -q 'Device name' /etc/wireguard/info.log && local LICENSE=$(cat /etc/wireguard/license) && local NAME=$(awk '{print $NF}' /etc/wireguard/info.log)
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh) --cancle --file /etc/wireguard/warp-account.conf >/dev/null 2>&1
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#&& cat $registe_path ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#cat $registe_path; ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null
|
||||
# 如原来是 plus 账户,以相同的 license 升级,并修改账户和 warp 配置文件
|
||||
if [[ -n "$LICENSE" && -n "$NAME" ]]; then
|
||||
[ -n "$LICENSE" ] && bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh) --file /etc/wireguard/warp-account.conf --license $LICENSE >/dev/null 2>&1
|
||||
@@ -1756,7 +1756,7 @@ install() {
|
||||
mkdir -p /etc/wireguard/ >/dev/null 2>&1
|
||||
local REGISTE_TIME=0
|
||||
until [[ -e /etc/wireguard/warp-account.conf || "$REGISTE_TIME" = 100 ]]; do
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#&& cat $registe_path ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null && break
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#cat $registe_path; ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null && break
|
||||
(( REGISTE_TIME++ ))
|
||||
done
|
||||
if [ -n "$LICENSE" ]; then
|
||||
@@ -2256,7 +2256,7 @@ change_to_free() {
|
||||
# 流程: 1.先停止服务; 2.注销旧账户; 3.注册新账户; 4.成功后根据新账户信息修改配置文件
|
||||
[ "$UPDATE_ACCOUNT" = warp ] && wg-quick down warp >/dev/null 2>&1 || ( systemctl stop wireproxy; sleep 2 )
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh) --cancle --file /etc/wireguard/warp-account.conf >/dev/null 2>&1
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#&& cat $registe_path ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#cat $registe_path; ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null
|
||||
local PRIVATEKEY="$(grep 'private_key' /etc/wireguard/warp-account.conf | cut -d\" -f4)"
|
||||
local ADDRESS6="$(grep '"v6.*"$' /etc/wireguard/warp-account.conf | cut -d\" -f4)"
|
||||
local RESERVED="$(reserved_and_clientid /etc/wireguard/warp-account.conf file)"
|
||||
@@ -2311,7 +2311,7 @@ change_to_plus() {
|
||||
rm -f /etc/wireguard/info.log
|
||||
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh) --cancle --file /etc/wireguard/warp-account.conf >/dev/null 2>&1
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#&& cat $registe_path ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null
|
||||
bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh | sed 's#cat $registe_path; ##') --registe --file /etc/wireguard/warp-account.conf 2>/dev/null
|
||||
local UPDATE_RESULT=$(bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh) --file /etc/wireguard/warp-account.conf --license $LICENSE)
|
||||
if grep -q '"warp_plus": true' <<< $UPDATE_RESULT; then
|
||||
[ -n "$NAME" ] && bash <(curl -m5 -sSL https://raw.githubusercontent.com/fscarmen/warp/main/api.sh) --file /etc/wireguard/warp-account.conf --name $NAME >/dev/null 2>&1
|
||||
|
||||
Reference in New Issue
Block a user