From 32f304d2007da42d4ccfc422aa729f3a6958efc4 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 8 Aug 2025 01:55:42 +0330 Subject: [PATCH] fix(script): allow unlimited values in edit_user script --- core/scripts/hysteria2/edit_user.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/scripts/hysteria2/edit_user.sh b/core/scripts/hysteria2/edit_user.sh index d409d3d..e81ed45 100644 --- a/core/scripts/hysteria2/edit_user.sh +++ b/core/scripts/hysteria2/edit_user.sh @@ -20,11 +20,11 @@ validate_username() { validate_traffic_limit() { local traffic_limit=$1 - if [ -z "$traffic_limit" ]; then - return 0 # Optional value is valid + if [ -z "$traffic_limit" ]; then + return 0 # Optional value is valid fi if ! [[ "$traffic_limit" =~ ^[0-9]+$ ]]; then - echo "Traffic limit must be a valid integer." + echo "Error: Traffic limit must be a valid non-negative number (use 0 for unlimited)." return 1 fi return 0 @@ -32,11 +32,11 @@ validate_traffic_limit() { validate_expiration_days() { local expiration_days=$1 - if [ -z "$expiration_days" ]; then + if [ -z "$expiration_days" ]; then return 0 # Optional value is valid fi if ! [[ "$expiration_days" =~ ^[0-9]+$ ]]; then - echo "Expiration days must be a valid integer." + echo "Error: Expiration days must be a valid non-negative number (use 0 for unlimited)." return 1 fi return 0 @@ -237,4 +237,4 @@ edit_user() { # Run the script -edit_user "$1" "$2" "$3" "$4" "$5" "$6" "$7" +edit_user "$1" "$2" "$3" "$4" "$5" "$6" "$7" \ No newline at end of file