From 1681034fe6d77a446d97c46542c8be3b977ebc3f Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:27:40 +0330 Subject: [PATCH] Fix Warp Uninstall --- core/scripts/warp/uninstall.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/scripts/warp/uninstall.sh b/core/scripts/warp/uninstall.sh index c51aedf..8ce8b0a 100644 --- a/core/scripts/warp/uninstall.sh +++ b/core/scripts/warp/uninstall.sh @@ -1,14 +1,11 @@ #!/bin/bash -# Source the path.sh script to load the CONFIG_FILE and CLI_PATH variables source /etc/hysteria/core/scripts/path.sh -# Check if WARP is active if systemctl is-active --quiet wg-quick@wgcf.service; then echo "Uninstalling WARP..." bash <(curl -fsSL git.io/warp.sh) dwg - # Check if the config file exists if [ -f "$CONFIG_FILE" ]; then default_config='["reject(geosite:ir)", "reject(geoip:ir)", "reject(geosite:category-ads-all)", "reject(geoip:private)", "reject(geosite:google@ads)"]' @@ -28,6 +25,14 @@ if systemctl is-active --quiet wg-quick@wgcf.service; then jq 'del(.outbounds[] | select(.name == "warps" and .type == "direct" and .direct.mode == 4 and .direct.bindDevice == "wgcf"))' "$CONFIG_FILE" > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json "$CONFIG_FILE" + if [ "$(jq -r 'if .acl.inline | index("reject(geosite:category-porn)") then "Blocked" else "Not blocked" end' "$CONFIG_FILE")" == "Blocked" ]; then + jq 'del(.acl.inline[] | select(. == "reject(geosite:category-porn)"))' "$CONFIG_FILE" > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json "$CONFIG_FILE" + echo "Adult content blocking removed." + fi + + jq '.resolver.tls.addr = "1.1.1.1:853"' "$CONFIG_FILE" > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json "$CONFIG_FILE" + echo "DNS resolver address changed to 1.1.1.1:853." + python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1 echo "WARP uninstalled and configurations reset to default." else