diff --git a/core/scripts/hysteria2/get_user.sh b/core/scripts/hysteria2/get_user.sh new file mode 100644 index 0000000..d67b4c1 --- /dev/null +++ b/core/scripts/hysteria2/get_user.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +source /etc/hysteria/core/scripts/path.sh + + +# Check if a username is provided +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +USERNAME=$1 + +# Check if users.json file exists +if [ ! -f "$USERS_FILE" ]; then + echo "users.json file not found!" + exit 1 +fi + +# Extract user info using jq +USER_INFO=$(jq -r --arg username "$USERNAME" '.[$username] // empty' $USERS_FILE) + +# Check if user info is found +if [ -z "$USER_INFO" ]; then + echo "User '$USERNAME' not found." + exit 1 +fi + +# Print user info +echo "$USER_INFO" | jq . + +exit 0 diff --git a/install.sh b/install.sh index b69eb92..e213f87 100644 --- a/install.sh +++ b/install.sh @@ -13,15 +13,16 @@ if ! command -v jq &> /dev/null || ! command -v git &> /dev/null || ! command -v apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip git -y fi + +# TODO: change the url later +git clone https://github.com/Iam54r1n4/Hysteria2 /etc/hysteria + # Add alias 'hys2' for Hysteria2 if ! grep -q "alias hys2='/etc/hysteria/menu.sh'" ~/.bashrc; then echo "alias hys2='/etc/hysteria/menu.sh'" >> ~/.bashrc source ~/.bashrc fi -# TODO: change the url later -git clone https://github.com/Iam54r1n4/Hysteria2 /etc/hysteria - cd /etc/hysteria chmod +x menu.sh ./menu.sh