mirror of
https://github.com/dw-0/kiauh.git
synced 2026-08-03 12:57:53 +05:00
fix(core): standardize handling of None values for repo and version fields
- Improve local and remote version comparison by replacing default placeholders with None. - Update repo and branch logic to handle None values consistently. - Refactor type hints for better readability and accuracy.
This commit is contained in:
@@ -152,10 +152,9 @@ def symlink_webui_nginx_log(
|
||||
def get_local_client_version(client: BaseWebClient) -> str | None:
|
||||
relinfo_file = client.client_dir.joinpath("release_info.json")
|
||||
version_file = client.client_dir.joinpath(".version")
|
||||
default = "-"
|
||||
|
||||
if not client.client_dir.exists():
|
||||
return default
|
||||
return None
|
||||
|
||||
# try to get version from release_info.json first
|
||||
if relinfo_file.is_file():
|
||||
@@ -177,11 +176,11 @@ def get_local_client_version(client: BaseWebClient) -> str | None:
|
||||
try:
|
||||
with open(version_file, "r") as f:
|
||||
line = f.readline().strip()
|
||||
return line or default
|
||||
return line or None
|
||||
except OSError:
|
||||
Logger.print_error("Unable to read '.version'")
|
||||
|
||||
return default
|
||||
return None
|
||||
|
||||
|
||||
def get_remote_client_version(client: BaseWebClient) -> str | None:
|
||||
|
||||
Reference in New Issue
Block a user