From aa70e446d09ad1dc37c8d24f8b603293d98fc47b Mon Sep 17 00:00:00 2001 From: Gzngskxgr20 <74984541+Athameral@users.noreply.github.com> Date: Tue, 23 Apr 2024 01:48:28 +0800 Subject: [PATCH] Update x-ui.sh Corrected the confirmation of the deleted ports. --- x-ui.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x-ui.sh b/x-ui.sh index 591f25a5..ddb4017b 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -661,8 +661,19 @@ delete_ports() { done # Confirm that the ports are deleted + echo "Deleted the specified ports:" - ufw status | grep "ALLOW" | grep -Eo "[0-9]+(/[a-z]+)?" + for port in "${PORT_LIST[@]}"; do + if [[ $port == *-* ]]; then + start_port=$(echo $port | cut -d'-' -f1) + end_port=$(echo $port | cut -d'-' -f2) + # Check if the port range has been successfully deleted + (ufw status | grep -q "$start_port:$end_port") || echo "$start_port-$end_port" + else + # Check if the individual port has been successfully deleted + (ufw status | grep -q "$port") || echo "$port" + fi + done } update_geo() {