diff --git a/VERSION b/VERSION index 9faa1b7..c946ee6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.5 +0.1.6 diff --git a/core/scripts/hysteria2/install.sh b/core/scripts/hysteria2/install.sh index c473285..ced4082 100644 --- a/core/scripts/hysteria2/install.sh +++ b/core/scripts/hysteria2/install.sh @@ -108,7 +108,7 @@ EOF # Step 13: Check if the hysteria-server.service is active if systemctl is-active --quiet hysteria-server.service; then - echo -e "${cyan}Hysteria2${green} has been successfully installed." + echo -e "${cyan}Hysteria2${NC} has been successfully installed." else echo -e "${red}Error:${NC} hysteria-server.service is not active." exit 1 diff --git a/core/scripts/hysteria2/uninstall.sh b/core/scripts/hysteria2/uninstall.sh index ba5e8df..eab2631 100644 --- a/core/scripts/hysteria2/uninstall.sh +++ b/core/scripts/hysteria2/uninstall.sh @@ -28,10 +28,14 @@ echo "Removing cron jobs..." echo "Removing alias 'hys2' from .bashrc..." sed -i '/alias hys2=.*\/etc\/hysteria\/menu.sh/d' ~/.bashrc -echo "Stopping hysteria-bot.service..." -systemctl stop hysteria-bot.service >/dev/null 2>&1 -echo "Disabling hysteria-bot.service..." -systemctl disable hysteria-bot.service >/dev/null 2>&1 +echo "Stop/Disabling Hysteria TelegramBOT Service..." +systemctl stop hysteria-bot.service > /dev/null 2>&1 +systemctl disable hysteria-bot.service > /dev/null 2>&1 + +echo "Stop/Disabling Singbox SubLink Service..." +systemctl stop singbox.service > /dev/null 2>&1 +systemctl disable singbox.service > /dev/null 2>&1 + echo "Hysteria2 uninstalled!" echo "" diff --git a/core/scripts/singbox/singbox_shell.sh b/core/scripts/singbox/singbox_shell.sh index 10c2edb..b7a6550 100644 --- a/core/scripts/singbox/singbox_shell.sh +++ b/core/scripts/singbox/singbox_shell.sh @@ -10,18 +10,6 @@ install_dependencies() { exit 1 fi echo -e "${green}Certbot installed successfully. ${NC}" - - if [ -f /etc/hysteria/requirements.txt ]; then - pip install -r /etc/hysteria/requirements.txt > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo -e "${red}Error: Failed to install Python dependencies. ${NC}" - exit 1 - fi - echo -e "${green}Python dependencies installed successfully. ${NC}" - else - echo -e "${red}Error: /etc/hysteria/requirements.txt not found. ${NC}" - exit 1 - fi } update_env_file() { @@ -44,7 +32,7 @@ Description=Singbox Python Service After=network.target [Service] -ExecStart=/usr/bin/python3 /etc/hysteria/core/scripts/singbox/singbox.py +ExecStart=/etc/hysteria/hysteria2_venv/bin/python /etc/hysteria/core/scripts/singbox/singbox.py WorkingDirectory=/etc/hysteria/core/scripts/singbox EnvironmentFile=/etc/hysteria/core/scripts/singbox/.env Restart=always diff --git a/core/scripts/telegrambot/runbot.sh b/core/scripts/telegrambot/runbot.sh index db167d4..9fb1a2e 100644 --- a/core/scripts/telegrambot/runbot.sh +++ b/core/scripts/telegrambot/runbot.sh @@ -1,14 +1,6 @@ #!/bin/bash source /etc/hysteria/core/scripts/utils.sh define_colors -install_dependencies() { - echo "Installing dependencies from /etc/hysteria/requirements.txt..." - if ! pip3 install -r /etc/hysteria/requirements.txt > /dev/null 2>&1; then - echo "Error: Failed to install dependencies. Please check the requirements file and try again." - exit 1 - fi - echo -e "${green}Dependencies installed successfully. ${NC}" -} update_env_file() { local api_token=$1 @@ -27,7 +19,7 @@ Description=Hysteria Telegram Bot After=network.target [Service] -ExecStart=/usr/bin/python3 /etc/hysteria/core/scripts/telegrambot/tbot.py +ExecStart=/etc/hysteria/hysteria2_venv/bin/python /etc/hysteria/core/scripts/telegrambot/tbot.py WorkingDirectory=/etc/hysteria/core/scripts/telegrambot Restart=always User=root @@ -47,7 +39,6 @@ start_service() { return fi - install_dependencies update_env_file "$api_token" "$admin_user_ids" create_service_file diff --git a/install.sh b/install.sh index e4cd4c0..98c4a66 100644 --- a/install.sh +++ b/install.sh @@ -10,11 +10,17 @@ if ! command -v jq &> /dev/null || ! command -v git &> /dev/null || ! command -v echo "${yellow}Necessary packages are not installed. Please wait while they are being installed..." sleep 3 echo - apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip git -y + apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip python3-venv git -y fi git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria +# Create and activate Python virtual environment +cd /etc/hysteria +python3 -m venv hysteria2_venv +source /etc/hysteria/hysteria2_venv/bin/activate +pip install -r requirements.txt + # Add alias 'hys2' for Hysteria2 if ! grep -q "alias hys2='/etc/hysteria/menu.sh'" ~/.bashrc; then echo "alias hys2='/etc/hysteria/menu.sh'" >> ~/.bashrc diff --git a/upgrade.sh b/upgrade.sh index 2091fa7..3cc21a2 100644 --- a/upgrade.sh +++ b/upgrade.sh @@ -55,5 +55,9 @@ else fi cd /etc/hysteria +python3 -m venv hysteria2_venv +source /etc/hysteria/hysteria2_venv/bin/activate +pip install -r requirements.txt + chmod +x menu.sh ./menu.sh