From ace33db0945089cc2ac9c4a34ef6e2c9f5479b19 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:58:32 +0330 Subject: [PATCH] Use user.json --- core/scripts/hysteria2/get_user.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/core/scripts/hysteria2/get_user.sh b/core/scripts/hysteria2/get_user.sh index 6d6c5bd..7b7a814 100644 --- a/core/scripts/hysteria2/get_user.sh +++ b/core/scripts/hysteria2/get_user.sh @@ -39,18 +39,9 @@ fi echo "$USER_INFO" | jq . if [ "$SHOW_TRAFFIC" = true ]; then - if [ ! -f "$TRAFFIC_FILE" ]; then - echo "No traffic data file found at $TRAFFIC_FILE. User might not have connected yet." - exit 0 - fi - - TRAFFIC_INFO=$(jq -r --arg username "$USERNAME" '.[$username] // empty' "$TRAFFIC_FILE") - - if [ -z "$TRAFFIC_INFO" ]; then - echo "No traffic data found for user '$USERNAME' in $TRAFFIC_FILE. User might not have connected yet." - else - echo "$TRAFFIC_INFO" | jq . - fi + UPLOAD_BYTES=$(echo "$USER_INFO" | jq -r '.upload_bytes // "No upload data available"') + DOWNLOAD_BYTES=$(echo "$USER_INFO" | jq -r '.download_bytes // "No download data available"') + STATUS=$(echo "$USER_INFO" | jq -r '.status // "Status unavailable"') fi exit 0