diff --git a/core/cli.py b/core/cli.py index 0110b47..3c5f9ac 100644 --- a/core/cli.py +++ b/core/cli.py @@ -35,6 +35,7 @@ class Command(Enum): BACKUP_HYSTERIA = os.path.join(SCRIPT_DIR, 'hysteria2', 'backup.sh') INSTALL_TELEGRAMBOT = os.path.join(SCRIPT_DIR, 'telegrambot', 'runbot.sh') INSTALL_SINGBOX = os.path.join(SCRIPT_DIR, 'singbox', 'singbox_shell.sh') + INSTALL_NORMALSUB = os.path.join(SCRIPT_DIR, 'normalsub', 'normalsub.sh') INSTALL_TCP_BRUTAL = os.path.join(SCRIPT_DIR, 'tcp-brutal', 'install.sh') INSTALL_WARP = os.path.join(SCRIPT_DIR, 'warp', 'install.sh') UNINSTALL_WARP = os.path.join(SCRIPT_DIR, 'warp', 'uninstall.sh') @@ -325,6 +326,19 @@ def singbox(action: str, domain: str, port: int): elif action == 'stop': run_cmd(['bash', Command.INSTALL_SINGBOX.value, 'stop']) +@cli.command('normal-sub') +@click.option('--action', '-a', required=True, help='Action to perform: start or stop', type=click.Choice(['start', 'stop'], case_sensitive=False)) +@click.option('--domain', '-d', required=False, help='Domain name for SSL', type=str) +@click.option('--port', '-p', required=False, help='Port number for NormalSub service', type=int) +def normalsub(action: str, domain: str, port: int): + if action == 'start': + if not domain or not port: + click.echo("Error: Both --domain and --port are required for the start action.") + return + run_cmd(['bash', Command.INSTALL_NORMALSUB.value, 'start', domain, str(port)]) + elif action == 'stop': + run_cmd(['bash', Command.INSTALL_NORMALSUB.value, 'stop']) + # endregion