v3.1.2 Remove the function of generating licenses.

This commit is contained in:
fs carmen
2024-09-14 02:58:07 +00:00
parent 55767e4a47
commit d4ac6b2003
3 changed files with 51 additions and 105 deletions
+20 -48
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# 当前脚本版本号
VERSION='3.1.1'
VERSION='3.1.2'
# 环境变量用于在Debian或Ubuntu操作系统中设置非交互式(noninteractive)安装模式
export DEBIAN_FRONTEND=noninteractive
@@ -9,12 +9,12 @@ export DEBIAN_FRONTEND=noninteractive
# Github 反代加速代理
GH_PROXY='https://ghproxy.lvedong.eu.org/'
trap "rm -f /tmp/{wireguard-go-*,best_mtu,best_endpoint,endpoint,ip,license-tmp}; exit" INT
trap "rm -f /tmp/{wireguard-go-*,best_mtu,best_endpoint,endpoint,ip}; exit" INT
E[0]="\n Language:\n 1. English (default) \n 2. 简体中文"
C[0]="${E[0]}"
E[1]="1. Support using the self-built WARP API at https://www.warpapi.us.kg/?run=pluskey to generate a 1920 PB WARP+ license for upgrading to a Plus account; 2. Client lacks sufficient support for WARP+, only able to use IPv4 and not IPv6; 3. Optimize the installer to further reduce script runtime."
C[1]="1. 支持使用自建 warp api: https://www.warpapi.us.kg/?run=pluskey 生成 1920 PB WARP+ license 升级为 Plus 账户; 2. Client 对 WARP+ 支持不够,只能使用 IPv4,不能使用 IPv6; 3. 优化安装程序,缩短脚本运行时间"
E[1]="1. Remove the function of generating licenses from the previous version because cloning Warp+ licenses is officially prohibited; 2. Remove unnecessary dependencies on python3."
C[1]="1. 由于官方禁止了克隆 Warp+ license,故去掉上个版本生成 license 的功能; 2. 去掉不必要的依赖 python3"
E[2]="The script must be run as root, you can enter sudo -i and then download and run again. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
C[2]="必须以root方式运行脚本,可以输入 sudo -i 后重新下载运行,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[3]="The TUN module is not loaded. You should turn it on in the control panel. Ask the supplier for more help. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
@@ -67,12 +67,12 @@ E[26]="Curren operating system is \$SYS.\\\n The system lower than \$SYSTEM \${M
C[26]="当前操作是 \$SYS\\\n 不支持 \$SYSTEM \${MAJOR[int]} 以下系统,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[27]="Local Socks5"
C[27]="本地 Socks5"
E[28]="If you have a WARP+ License, please input it. Otherwise, press Enter to use the key generated by the plusKey API:"
C[28]="如果您有 WARP+ License,请输入;否则,请按 Enter 键使用由 plusKey API 生成的 license"
E[28]="If you have a WARP+ License, please input it:"
C[28]="如果您有 WARP+ License,请输入:"
E[29]="Input errors up to 5 times.The script is aborted."
C[29]="输入错误达5次,脚本退出"
E[30]="License should be 26 characters, please re-input WARP+ License. Otherwise, press Enter to use the key generated by the plusKey API. \(\${i} times remaining\):"
C[30]="License 应为26位字符,请重新输入 WARP+ License回车则使用 plusKey api 生成 的 key \(剩余\${i}次\):"
E[30]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\):"
C[30]="License 应为26位字符,请重新输入 WARP+ License没有可回车继续\(剩余\${i}次\):"
E[31]="The new \$KEY_LICENSE is the same as the one currently in use. Does not need to be replaced."
C[31]="新输入的 \$KEY_LICENSE 与现使用中的一样,不需要更换。"
E[32]="Step 1/3: Install dependencies..."
@@ -133,8 +133,8 @@ E[59]="Cannot find the account file: /etc/wireguard/warp-account.conf, you can r
C[59]="找不到账户文件:/etc/wireguard/warp-account.conf,可以卸载后重装,输入 WARP+ License"
E[60]="Cannot find the configuration file: /etc/wireguard/warp.conf, you can reinstall with the WARP+ License"
C[60]="找不到配置文件: /etc/wireguard/warp.conf,可以卸载后重装,输入 WARP+ License"
E[61]="Please Input WARP+ license. Enter to use the key generated by the plusKey api:"
C[61]="请输入WARP+ License,回车则使用 plusKey api 生成 的 key:"
E[61]="Please Input WARP+ license:"
C[61]="请输入WARP+ License:"
E[62]="Successfully change to a WARP\$TYPE account"
C[62]="已变更为 WARP\$TYPE 账户"
E[63]="WARP+ quota"
@@ -211,12 +211,12 @@ E[98]="Uninstall Wireproxy was complete."
C[98]="Wireproxy 卸载成功"
E[99]="WireProxy is connected"
C[99]="WireProxy 已连接"
E[100]="Generating Plus License..."
C[100]="正在生成 Plus License...."
E[100]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\): "
C[100]="License 应为26位字符,请重新输入 WARP+ License \(剩余\${i}次\): "
E[101]="Client support amd64 and arm64 only. Curren architecture \$ARCHITECTURE. Official Support List: [https://pkg.cloudflareclient.com/packages/cloudflare-warp]. The script is aborted. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
C[101]="Client 只支持 amd64 和 arm64 架构,当前架构 \$ARCHITECTURE,官方支持列表: [https://pkg.cloudflareclient.com/packages/cloudflare-warp]。脚本中止,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[102]="License: \$LICENSE\\\n Please customize the WARP+ device name \(Default is \$(hostname)\):"
C[102]="License: \$LICENSE\\\n 请自定义 WARP+ 设备名 \(默认为 \$(hostname)\):"
E[102]="Please customize the WARP+ device name \(Default is \$(hostname)\):"
C[102]="请自定义 WARP+ 设备名 \(默认为 \$(hostname)\):"
E[103]="Port \$PORT is in use. Please input another Port\(\${i} times remaining\):"
C[103]="\$PORT 端口占用中,请使用另一端口\(剩余\${i}次\):"
E[104]="Please customize the Client port (1000-65535. Default to 40000 if it is blank):"
@@ -509,12 +509,12 @@ check_dependencies() {
if [ "$SYSTEM" = 'Alpine' ]; then
CHECK_WGET=$(wget 2>&1 | head -n 1)
grep -qi 'busybox' <<< "$CHECK_WGET" && ${PACKAGE_INSTALL[int]} wget >/dev/null 2>&1
DEPS_CHECK=("ping" "curl" "grep" "bash" "ip" "python3" "virt-what")
DEPS_INSTALL=("iputils-ping" "curl" "grep" "bash" "iproute2" "python3" "virt-what")
DEPS_CHECK=("ping" "curl" "grep" "bash" "ip" "virt-what")
DEPS_INSTALL=("iputils-ping" "curl" "grep" "bash" "iproute2" "virt-what")
else
# 对于三大系统需要的依赖
DEPS_CHECK=("ping" "wget" "curl" "systemctl" "ip" "python3")
DEPS_INSTALL=("iputils-ping" "wget" "curl" "systemctl" "iproute2" "python3")
DEPS_CHECK=("ping" "wget" "curl" "systemctl" "ip")
DEPS_INSTALL=("iputils-ping" "wget" "curl" "systemctl" "iproute2")
fi
for g in "${!DEPS_CHECK[@]}"; do
@@ -619,18 +619,9 @@ warp_api(){
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&A=${A}&S=${S}&N=${N}&code=${TEAM_CODE}"
;;
pluskey )
curl -m20 --retry 3 -sL "https://${WARP_API_URL}/?run=pluskey"
;;
esac
}
# 通过 warp api 生成 plusKey
generate_pluskey() {
local FILE_PATH="$1"
[ -n "$FILE_PATH" ] && warp_api pluskey | awk -F '"' '/licenseCode/{print $4}' > $FILE_PATH || warp_api pluskey | awk -F '"' '/licenseCode/{print $4}'
}
# 聚合 IP api 函数。由于 ip.sb 会对某些 ip 访问报 error code: 1015,所以使用备用 IP api: ifconfig.co
ip_info() {
local CHECK_46="$1"
@@ -1240,7 +1231,7 @@ uninstall() {
# 删除本脚本安装在 /etc/wireguard/ 下的所有文件,如果删除后目录为空,一并把目录删除
rm -f /usr/bin/wg-quick.{origin,reserved}
rm -f /tmp/{best_mtu,best_endpoint,wireguard-go-*,license-tmp}
rm -f /tmp/{best_mtu,best_endpoint,wireguard-go-*}
rm -f /etc/wireguard/{wgcf-account.conf,warp-temp.conf,warp-account.conf,warp_unlock.sh,warp.conf.bak,warp.conf,up,proxy.conf.bak,proxy.conf,menu.sh,license,language,info-temp.log,info.log,down,account-temp.conf,NonGlobalUp.sh,NonGlobalDown.sh}
[[ -e /etc/wireguard && -z "$(ls -A /etc/wireguard/)" ]] && rmdir /etc/wireguard
@@ -1668,20 +1659,10 @@ rule_del() {
input_license() {
local WARP_OR_CLIENT="$1"
[ -z "$LICENSE" ] && reading " $(text 28) " LICENSE
if [ -z "$LICENSE" ]; then
hint " $(text 100) "
wait
[ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
fi
i=5
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
until [[ -z "$LICENSE" || "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
(( i-- )) || true
[ "$i" = 0 ] && error " $(text 29) " || reading " $(text 30) " LICENSE
if [ -z "$LICENSE" ]; then
hint " $(text 100) "
wait
[ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
fi
done
if [ "$WARP_OR_CLIENT" = is_warp ]; then
[[ -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 102) " NAME
@@ -1772,16 +1753,10 @@ input_url_token() {
# 升级 WARP+ 账户(如有),限制位数为空或者26位以防输入错误,WARP interface 可以自定义设备名(不允许字符串间有空格,如遇到将会以_代替)
update_license() {
[ -z "$LICENSE" ] && reading " $(text 61) " LICENSE
hint " $(text 100) "
wait
[ -z "$LICENSE" ] && [ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
i=5
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
(( i-- )) || true
[ "$i" = 0 ] && error " $(text 29) " || reading " $(text 30) " LICENSE
hint " $(text 100) "
wait
[ -z "$LICENSE" ] && [ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
done
[[ -z "$CLIENT_ACCOUNT" && "$CHOOSE_TYPE" = 2 && -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 102) " NAME
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME=${NAME:-"$(hostname)"}
@@ -3263,9 +3238,6 @@ fi
# 自定义 WARP+ 设备名
NAME=$3
# 后台生成 plus key
{ generate_pluskey /tmp/license-tmp; }&
# 主程序运行 1/3
check_cdn