From 10499f934572b4d01923be21e3cb21d6d7dcd185 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:39:42 +0330 Subject: [PATCH 01/18] virtual environment --- install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index e4cd4c0..a9f222a 100644 --- a/install.sh +++ b/install.sh @@ -10,10 +10,15 @@ 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 +git clone -b https://github.com/ReturnFI/Hysteria2 /etc/hysteria + +# Create and activate Python virtual environment +cd /etc/hysteria +python3 -m venv venv +source /etc/hysteria/venv/bin/activate # Add alias 'hys2' for Hysteria2 if ! grep -q "alias hys2='/etc/hysteria/menu.sh'" ~/.bashrc; then From 9368e820a15ce260cbc8bd5549986291dc1d2a5c Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:41:27 +0330 Subject: [PATCH 02/18] Update Service File --- core/scripts/telegrambot/runbot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/telegrambot/runbot.sh b/core/scripts/telegrambot/runbot.sh index db167d4..c7219cc 100644 --- a/core/scripts/telegrambot/runbot.sh +++ b/core/scripts/telegrambot/runbot.sh @@ -27,7 +27,7 @@ Description=Hysteria Telegram Bot After=network.target [Service] -ExecStart=/usr/bin/python3 /etc/hysteria/core/scripts/telegrambot/tbot.py +ExecStart=/etc/hysteria/bin/python /etc/hysteria/core/scripts/telegrambot/tbot.py WorkingDirectory=/etc/hysteria/core/scripts/telegrambot Restart=always User=root From 63bb627de888b551eab51ccf24df34beee799a2f Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:42:03 +0330 Subject: [PATCH 03/18] Update Service File --- core/scripts/singbox/singbox_shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/singbox/singbox_shell.sh b/core/scripts/singbox/singbox_shell.sh index 10c2edb..3a066d9 100644 --- a/core/scripts/singbox/singbox_shell.sh +++ b/core/scripts/singbox/singbox_shell.sh @@ -44,7 +44,7 @@ Description=Singbox Python Service After=network.target [Service] -ExecStart=/usr/bin/python3 /etc/hysteria/core/scripts/singbox/singbox.py +ExecStart=/etc/hysteria/bin/python /etc/hysteria/core/scripts/singbox/singbox.py WorkingDirectory=/etc/hysteria/core/scripts/singbox EnvironmentFile=/etc/hysteria/core/scripts/singbox/.env Restart=always From c6d897843800acf2211c164beb4a47eaf0b0dba2 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:42:42 +0330 Subject: [PATCH 04/18] Install requirements --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index a9f222a..aa4e43d 100644 --- a/install.sh +++ b/install.sh @@ -19,6 +19,7 @@ git clone -b https://github.com/ReturnFI/Hysteria2 /etc/hysteria cd /etc/hysteria python3 -m venv venv source /etc/hysteria/venv/bin/activate +pip install -r requirements.txt # Add alias 'hys2' for Hysteria2 if ! grep -q "alias hys2='/etc/hysteria/menu.sh'" ~/.bashrc; then From 7b7547e3d225ae0fdc0141761a0ecc1e5cc85f6b Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:43:55 +0330 Subject: [PATCH 05/18] Remove requirements --- core/scripts/telegrambot/runbot.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/core/scripts/telegrambot/runbot.sh b/core/scripts/telegrambot/runbot.sh index c7219cc..c4ac92e 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 @@ -47,7 +39,6 @@ start_service() { return fi - install_dependencies update_env_file "$api_token" "$admin_user_ids" create_service_file From 7a57fb142d3cac395bb47ef05bce0d0fc0e8e40a Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:45:04 +0330 Subject: [PATCH 06/18] Remove requirements --- core/scripts/singbox/singbox_shell.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/scripts/singbox/singbox_shell.sh b/core/scripts/singbox/singbox_shell.sh index 3a066d9..d1bf23d 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() { From 5cd39656b70534a5ae7c560cb009c48c4561cb9b Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:45:44 +0330 Subject: [PATCH 07/18] Test Dev --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index aa4e43d..12a73e1 100644 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ 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 python3-venv git -y fi -git clone -b https://github.com/ReturnFI/Hysteria2 /etc/hysteria +git clone -b Dev https://github.com/ReturnFI/Hysteria2 /etc/hysteria # Create and activate Python virtual environment cd /etc/hysteria From 92c9ea057a1f95f789e9c1cb063fecb36590c241 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:56:54 +0330 Subject: [PATCH 08/18] Update virtual environment --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 12a73e1..7d7fd6f 100644 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ git clone -b Dev https://github.com/ReturnFI/Hysteria2 /etc/hysteria # Create and activate Python virtual environment cd /etc/hysteria python3 -m venv venv -source /etc/hysteria/venv/bin/activate +source /etc/hysteria/hysteria2_venv/bin/activate pip install -r requirements.txt # Add alias 'hys2' for Hysteria2 From bc5231b5cde823a735d9c0c27cc1f74d51588dcc Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:57:41 +0330 Subject: [PATCH 09/18] Update Service --- core/scripts/telegrambot/runbot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/telegrambot/runbot.sh b/core/scripts/telegrambot/runbot.sh index c4ac92e..0f17ea1 100644 --- a/core/scripts/telegrambot/runbot.sh +++ b/core/scripts/telegrambot/runbot.sh @@ -19,7 +19,7 @@ Description=Hysteria Telegram Bot After=network.target [Service] -ExecStart=/etc/hysteria/bin/python /etc/hysteria/core/scripts/telegrambot/tbot.py +ExecStart=/etc/hysteria/hysteria2_proxy/bin/python /etc/hysteria/core/scripts/telegrambot/tbot.py WorkingDirectory=/etc/hysteria/core/scripts/telegrambot Restart=always User=root From 4eeb90e54981ef8d1d85b70ae6c4bd2d3aa8b1af Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:58:10 +0330 Subject: [PATCH 10/18] Fix virtual environment --- core/scripts/singbox/singbox_shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/singbox/singbox_shell.sh b/core/scripts/singbox/singbox_shell.sh index d1bf23d..71ef044 100644 --- a/core/scripts/singbox/singbox_shell.sh +++ b/core/scripts/singbox/singbox_shell.sh @@ -32,7 +32,7 @@ Description=Singbox Python Service After=network.target [Service] -ExecStart=/etc/hysteria/bin/python /etc/hysteria/core/scripts/singbox/singbox.py +ExecStart=/etc/hysteria/hysteria2_proxy/bin/python /etc/hysteria/core/scripts/singbox/singbox.py WorkingDirectory=/etc/hysteria/core/scripts/singbox EnvironmentFile=/etc/hysteria/core/scripts/singbox/.env Restart=always From e2862485772856b0ecd93a1cbd47e9946fad9168 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:59:34 +0330 Subject: [PATCH 11/18] Fix virtual environment --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7d7fd6f..79f21fe 100644 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ git clone -b Dev https://github.com/ReturnFI/Hysteria2 /etc/hysteria # Create and activate Python virtual environment cd /etc/hysteria -python3 -m venv venv +python3 -m venv hysteria2_venv source /etc/hysteria/hysteria2_venv/bin/activate pip install -r requirements.txt From 2e2958e623d93cb5808d96885102bf694aeb8566 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:01:38 +0330 Subject: [PATCH 12/18] Fix color --- core/scripts/hysteria2/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 3a79875e8b466b71fed8261a7b72f27fb06debff Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:05:43 +0330 Subject: [PATCH 13/18] Fix virtual environment --- core/scripts/telegrambot/runbot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/telegrambot/runbot.sh b/core/scripts/telegrambot/runbot.sh index 0f17ea1..9fb1a2e 100644 --- a/core/scripts/telegrambot/runbot.sh +++ b/core/scripts/telegrambot/runbot.sh @@ -19,7 +19,7 @@ Description=Hysteria Telegram Bot After=network.target [Service] -ExecStart=/etc/hysteria/hysteria2_proxy/bin/python /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 From fce7a5adce7ef69142d4034dc39149cd9b2de058 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:06:04 +0330 Subject: [PATCH 14/18] Fix virtual environment --- core/scripts/singbox/singbox_shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/singbox/singbox_shell.sh b/core/scripts/singbox/singbox_shell.sh index 71ef044..b7a6550 100644 --- a/core/scripts/singbox/singbox_shell.sh +++ b/core/scripts/singbox/singbox_shell.sh @@ -32,7 +32,7 @@ Description=Singbox Python Service After=network.target [Service] -ExecStart=/etc/hysteria/hysteria2_proxy/bin/python /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 From f8554290a7a6e89a4d3abe62bb9c066a27ccff3e Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:33:55 +0330 Subject: [PATCH 15/18] Stop/Disabling Services --- core/scripts/hysteria2/uninstall.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 "" From 78e5380202965d1e9062a9e5c811d55565c2ced1 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:36:01 +0330 Subject: [PATCH 16/18] Added virtual environment --- upgrade.sh | 4 ++++ 1 file changed, 4 insertions(+) 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 From 6076c6ebeb3bf5199633d4b7130895a4d828c17d Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:36:51 +0330 Subject: [PATCH 17/18] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9faa1b7..c946ee6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.5 +0.1.6 From 53a3df97b3a014b4aa51974924174a90c867528d Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:37:13 +0330 Subject: [PATCH 18/18] Clone Main --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 79f21fe..98c4a66 100644 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ 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 python3-venv git -y fi -git clone -b Dev https://github.com/ReturnFI/Hysteria2 /etc/hysteria +git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria # Create and activate Python virtual environment cd /etc/hysteria