From 84e7153aaafa8395f75a671ae9694814251f6f6a Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:38:59 +0330 Subject: [PATCH] Adde WARP plus --- core/scripts/warp/configure.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/core/scripts/warp/configure.sh b/core/scripts/warp/configure.sh index 439409c..6aaddab 100644 --- a/core/scripts/warp/configure.sh +++ b/core/scripts/warp/configure.sh @@ -7,6 +7,8 @@ warp_configure_handler() { local popular_sites=$2 local domestic_sites=$3 local block_adult_sites=$4 + local warp_option=$5 + local warp_key=$6 if [ "$all" == "true" ]; then if [ "$(jq -r 'if .acl.inline | index("warps(all)") then "WARP active" else "Direct" end' "$CONFIG_FILE")" == "WARP active" ]; then @@ -50,7 +52,27 @@ warp_configure_handler() { fi fi + if [ "$warp_option" == "warp plus" ]; then + if [ -z "$warp_key" ]; then + echo "Error: WARP Plus key is required. Exiting." + exit 1 + fi + cd /etc/warp/ || { echo "Failed to change directory to /etc/warp/"; exit 1; } + + WGCF_LICENSE_KEY="$warp_key" wgcf update + + if [ $? -ne 0 ]; then + echo "Error: Failed to update WARP Plus configuration." + exit 1 + fi + + elif [ "$warp_option" == "warp" ]; then + cd /etc/warp/ || { echo "Failed to change directory to /etc/warp/"; exit 1; } + rm wgcf-account.toml && yes | wgcf register + echo "WARP configured with a new account." + fi + python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1 } -warp_configure_handler "$1" "$2" "$3" "$4" +warp_configure_handler "$1" "$2" "$3" "$4" "$5" "$6"