feat: Add version checking and display

Integrated version checking into `cli_api.py` and `cli.py`
This commit is contained in:
Whispering Wind
2025-03-11 01:01:08 +03:30
committed by GitHub
parent aeca270dfa
commit 72a96999df
3 changed files with 94 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class Command(Enum):
CONFIGURE_WARP = os.path.join(SCRIPT_DIR, 'warp', 'configure.sh')
STATUS_WARP = os.path.join(SCRIPT_DIR, 'warp', 'status.sh')
SERVICES_STATUS = os.path.join(SCRIPT_DIR, 'services_status.sh')
VERSION = os.path.join(SCRIPT_DIR, 'hysteria2', 'version.sh')
# region Custom Exceptions
@ -500,5 +501,16 @@ def get_services_status() -> dict[str, bool] | None:
'''Gets the status of all project services.'''
if res := run_cmd(['bash', Command.SERVICES_STATUS.value]):
return json.loads(res)
def show_version() -> str | None:
"""Displays the currently installed version of the panel."""
return run_cmd(['bash', Command.VERSION.value, 'show-version'])
def check_version() -> str | None:
"""Checks if the current version is up-to-date and displays changelog if not."""
return run_cmd(['bash', Command.VERSION.value, 'check-version'])
# endregion
# endregion