@ -1,4 +1,3 @@
|
|||||||
1. Add SSL certificate deletion
|
1. Displays the data in a readable format
|
||||||
2. Shows the URI with the -s and -n
|
2. Added Core Version(Menu)
|
||||||
3. Refactored check_version function to use variables from path.sh
|
3. Added Total Usage(TelegramBOT)
|
||||||
4. Fixed some bugs
|
|
||||||
|
|||||||
@ -39,6 +39,13 @@ version_greater_equal() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_core_version() {
|
||||||
|
if systemctl is-active --quiet hysteria-server.service; then
|
||||||
|
HCVERSION=$(hysteria version | grep "^Version:" | awk '{print $2}')
|
||||||
|
echo -e "Hysteria2 Core Version: ${cyan}$HCVERSION${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_version() {
|
check_version() {
|
||||||
local_version=$(cat $LOCALVERSION)
|
local_version=$(cat $LOCALVERSION)
|
||||||
latest_version=$(curl -s $LATESTVERSION)
|
latest_version=$(curl -s $LATESTVERSION)
|
||||||
|
|||||||
37
menu.sh
37
menu.sh
@ -162,11 +162,42 @@ hysteria2_get_user_handler() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run the command and suppress error output
|
user_data=$(python3 "$CLI_PATH" get-user --username "$username" 2>/dev/null)
|
||||||
if ! python3 "$CLI_PATH" get-user --username "$username" 2>/dev/null; then
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
echo -e "${red}Error:${NC} User '$username' not found."
|
echo -e "${red}Error:${NC} User '$username' not found."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
password=$(echo "$user_data" | jq -r '.password // "N/A"')
|
||||||
|
max_download_bytes=$(echo "$user_data" | jq -r '.max_download_bytes // 0')
|
||||||
|
upload_bytes=$(echo "$user_data" | jq -r '.upload_bytes // 0')
|
||||||
|
download_bytes=$(echo "$user_data" | jq -r '.download_bytes // 0')
|
||||||
|
account_creation_date=$(echo "$user_data" | jq -r '.account_creation_date // "N/A"')
|
||||||
|
expiration_days=$(echo "$user_data" | jq -r '.expiration_days // 0')
|
||||||
|
blocked=$(echo "$user_data" | jq -r '.blocked // false')
|
||||||
|
status=$(echo "$user_data" | jq -r '.status // "N/A"')
|
||||||
|
total_usage=$((upload_bytes + download_bytes))
|
||||||
|
max_download_gb=$(echo "scale=2; $max_download_bytes / 1073741824" | bc)
|
||||||
|
upload_gb=$(echo "scale=2; $upload_bytes / 1073741824" | bc)
|
||||||
|
download_gb=$(echo "scale=2; $download_bytes / 1073741824" | bc)
|
||||||
|
total_usage_gb=$(echo "scale=2; $total_usage / 1073741824" | bc)
|
||||||
|
expiration_date=$(date -d "$account_creation_date + $expiration_days days" +"%Y-%m-%d")
|
||||||
|
current_date=$(date +"%Y-%m-%d")
|
||||||
|
used_days=$(( ( $(date -d "$current_date" +%s) - $(date -d "$account_creation_date" +%s) ) / 86400 ))
|
||||||
|
|
||||||
|
if [[ $used_days -gt $expiration_days ]]; then
|
||||||
|
used_days=$expiration_days
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${green}User Details:${NC}"
|
||||||
|
echo -e "Username: $username"
|
||||||
|
echo -e "Password: $password"
|
||||||
|
echo -e "Total Traffic: $max_download_gb GB"
|
||||||
|
echo -e "Total Usage: $total_usage_gb GB"
|
||||||
|
echo -e "Time Expiration: $expiration_date ($used_days/$expiration_days Days)"
|
||||||
|
echo -e "Blocked: $blocked"
|
||||||
|
echo -e "Status: $status"
|
||||||
}
|
}
|
||||||
|
|
||||||
hysteria2_list_users_handler() {
|
hysteria2_list_users_handler() {
|
||||||
@ -567,7 +598,7 @@ display_main_menu() {
|
|||||||
echo -e "${green}• IP: ${NC}$IP ${green}• RAM: ${NC}$RAM"
|
echo -e "${green}• IP: ${NC}$IP ${green}• RAM: ${NC}$RAM"
|
||||||
|
|
||||||
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
||||||
|
check_core_version
|
||||||
check_version
|
check_version
|
||||||
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
||||||
echo -e "${yellow} ☼ Services Status ☼ ${NC}"
|
echo -e "${yellow} ☼ Services Status ☼ ${NC}"
|
||||||
|
|||||||
Reference in New Issue
Block a user