diff --git a/core/cli.py b/core/cli.py index 408740c..32dcb68 100644 --- a/core/cli.py +++ b/core/cli.py @@ -29,6 +29,7 @@ class Command(Enum): RESET_USER = os.path.join(SCRIPT_DIR, 'hysteria2', 'reset_user.sh') REMOVE_USER = os.path.join(SCRIPT_DIR, 'hysteria2', 'remove_user.sh') SHOW_USER_URI = os.path.join(SCRIPT_DIR, 'hysteria2', 'show_user_uri.sh') + REMOVE_OBFS = os.path.join(SCRIPT_DIR, 'hysteria2', 'remove_obfs.sh') TRAFFIC_STATUS = 'traffic.py' # won't be call directly (it's a python module) LIST_USERS = os.path.join(SCRIPT_DIR, 'hysteria2', 'list_users.sh') SERVER_INFO = os.path.join(SCRIPT_DIR, 'hysteria2', 'server_info.sh') @@ -247,6 +248,23 @@ def backup_hysteria(): except subprocess.CalledProcessError as e: click.echo(f"Backup failed: {e.output.decode()}", err=True) +@cli.command('manage_obfs') +@click.option('--remove', '-r', is_flag=True, help="Remove 'obfs' from config.json.") +@click.option('--generate', '-g', is_flag=True, help="Generate new 'obfs' in config.json.") +def manage_obfs(remove, generate): + """Manage 'obfs' in Hysteria2 configuration.""" + if remove and generate: + click.echo("Error: You cannot use both --remove and --generate at the same time.") + return + elif remove: + click.echo("Removing 'obfs' from config.json...") + run_cmd(['bash', Command.REMOVE_OBFS.value, '--remove']) + elif generate: + click.echo("Generating 'obfs' in config.json...") + run_cmd(['bash', Command.REMOVE_OBFS.value, '--generate']) + else: + click.echo("Error: Please specify either --remove or --generate.") + # endregion # region advanced menu