diff --git a/core/scripts/hysteria2/add_user.sh b/core/scripts/hysteria2/add_user.sh index 36ecf34..92bd35e 100644 --- a/core/scripts/hysteria2/add_user.sh +++ b/core/scripts/hysteria2/add_user.sh @@ -31,7 +31,7 @@ add_user() { '.[$username] = {password: $password, max_download_bytes: $traffic, expiration_days: $expiration_days, account_creation_date: $creation_date, blocked: false}' \ /etc/hysteria/users/users.json > /etc/hysteria/users/users_temp.json && mv /etc/hysteria/users/users_temp.json /etc/hysteria/users/users.json - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 echo -e "\033[0;32mUser $username added successfully.\033[0m" } diff --git a/core/scripts/hysteria2/change_port.sh b/core/scripts/hysteria2/change_port.sh index 66d33fc..76bcb56 100644 --- a/core/scripts/hysteria2/change_port.sh +++ b/core/scripts/hysteria2/change_port.sh @@ -9,7 +9,7 @@ done if [ -f "/etc/hysteria/config.json" ]; then jq --arg port "$port" '.listen = ":" + $port' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 echo "Port changed successfully to $port." else echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found." diff --git a/core/scripts/hysteria2/remove_user.sh b/core/scripts/hysteria2/remove_user.sh index 89ea1f2..628ff6e 100644 --- a/core/scripts/hysteria2/remove_user.sh +++ b/core/scripts/hysteria2/remove_user.sh @@ -18,7 +18,7 @@ remove_user() { jq --arg username "$username" 'del(.[$username])' /etc/hysteria/traffic_data.json > /etc/hysteria/traffic_data_temp.json && mv /etc/hysteria/traffic_data_temp.json /etc/hysteria/traffic_data.json fi - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 echo "User $username removed successfully." else echo -e "\033[0;31mError:\033[0m User $username not found." diff --git a/core/scripts/hysteria2/update.sh b/core/scripts/hysteria2/update.sh index 606edc2..0c0a4e2 100644 --- a/core/scripts/hysteria2/update.sh +++ b/core/scripts/hysteria2/update.sh @@ -11,7 +11,7 @@ bash <(curl -fsSL https://get.hy2.sh/) >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "${red}Error:${NC} Failed to download or install the latest version. Restoring backup configuration." mv /etc/hysteria/config_backup.json /etc/hysteria/config.json - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 return 1 fi @@ -31,7 +31,7 @@ fi rm /etc/hysteria/config.yaml systemctl daemon-reload >/dev/null 2>&1 -restart_hysteria_service >/dev/null 2>&1 +python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "${red}Error:${NC} Failed to restart Hysteria2 service." return 1 diff --git a/core/scripts/warp/configure.sh b/core/scripts/warp/configure.sh index b2b15a5..a827275 100644 --- a/core/scripts/warp/configure.sh +++ b/core/scripts/warp/configure.sh @@ -68,7 +68,7 @@ if [ -f "$CONFIG_FILE" ]; then echo "Invalid option. Please try again." ;; esac - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 else echo "${red}Error:${NC} Config file $CONFIG_FILE not found." fi \ No newline at end of file diff --git a/core/scripts/warp/install.sh b/core/scripts/warp/install.sh index 42403ed..0cb0327 100644 --- a/core/scripts/warp/install.sh +++ b/core/scripts/warp/install.sh @@ -10,7 +10,7 @@ else # Add the outbound configuration to the config.json file jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json # Restart the hysteria-server service - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 echo "WARP installed and outbound added to config.json." else echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found." diff --git a/core/scripts/warp/uninstall.sh b/core/scripts/warp/uninstall.sh index f8d8cd0..ae87a35 100644 --- a/core/scripts/warp/uninstall.sh +++ b/core/scripts/warp/uninstall.sh @@ -20,7 +20,7 @@ if systemctl is-active --quiet wg-quick@wgcf.service; then ' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json jq 'del(.outbounds[] | select(.name == "warps" and .type == "direct" and .direct.mode == 4 and .direct.bindDevice == "wgcf"))' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json - restart_hysteria_service >/dev/null 2>&1 + python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1 echo "WARP uninstalled and configurations reset to default." else echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."