Refactor: Implement Hysteria2 uninstallation in Python

This commit is contained in:
Whispering Wind
2025-05-02 14:37:47 +03:30
committed by GitHub
parent 1e4f6439d3
commit beb8748f4b
3 changed files with 96 additions and 58 deletions

View File

@ -17,7 +17,7 @@ WEBPANEL_ENV_FILE = '/etc/hysteria/core/scripts/webpanel/.env'
class Command(Enum):
'''Contains path to command's script'''
INSTALL_HYSTERIA2 = os.path.join(SCRIPT_DIR, 'hysteria2', 'install.sh')
UNINSTALL_HYSTERIA2 = os.path.join(SCRIPT_DIR, 'hysteria2', 'uninstall.sh')
UNINSTALL_HYSTERIA2 = os.path.join(SCRIPT_DIR, 'hysteria2', 'uninstall.py')
UPDATE_HYSTERIA2 = os.path.join(SCRIPT_DIR, 'hysteria2', 'update.py')
RESTART_HYSTERIA2 = os.path.join(SCRIPT_DIR, 'hysteria2', 'restart.py')
CHANGE_PORT_HYSTERIA2 = os.path.join(SCRIPT_DIR, 'hysteria2', 'change_port.py')
@ -132,7 +132,7 @@ def install_hysteria2(port: int, sni: str):
def uninstall_hysteria2():
'''Uninstalls Hysteria2.'''
run_cmd(['bash', Command.UNINSTALL_HYSTERIA2.value])
run_cmd(['python3', Command.UNINSTALL_HYSTERIA2.value])
def update_hysteria2():