Fix updater return type bug
This commit is contained in:
@@ -51,11 +51,11 @@ def _parse_version(v: str) -> list[int]:
|
||||
return parts
|
||||
|
||||
|
||||
def check_for_updates() -> tuple[bool, str, str]:
|
||||
def check_for_updates() -> dict | None:
|
||||
"""Prüft, ob auf Gitea ein neues Release (nach SemVer) vorliegt.
|
||||
|
||||
Returns:
|
||||
(has_update, new_version_string, asset_download_url)
|
||||
Das Release-Dict (von Gitea) wenn ein Update verfügbar ist, sonst None.
|
||||
"""
|
||||
try:
|
||||
req = Request(RELEASES_URL, headers={'User-Agent': 'fcco-Updater/1.0'})
|
||||
@@ -63,7 +63,7 @@ def check_for_updates() -> tuple[bool, str, str]:
|
||||
data = json.loads(resp.read().decode('utf-8'))
|
||||
|
||||
if not data:
|
||||
return False, "", ""
|
||||
return None
|
||||
|
||||
# Gitea gibt Releases sortiert zurück, 0 = neuestes
|
||||
release_info = data[0]
|
||||
@@ -74,18 +74,12 @@ def check_for_updates() -> tuple[bool, str, str]:
|
||||
|
||||
# Intelligenter Versions-Vergleich
|
||||
if _parse_version(latest_version) > _parse_version(CURRENT_VERSION):
|
||||
# Finde die passende Zip-Datei
|
||||
expected_asset = _get_platform_asset_name()
|
||||
for asset in release_info.get("assets", []):
|
||||
if asset.get("name") == expected_asset:
|
||||
return True, latest_version, asset.get("browser_download_url", "")
|
||||
|
||||
return False, "", ""
|
||||
return release_info
|
||||
|
||||
return False, "", ""
|
||||
return None
|
||||
except Exception as e:
|
||||
print(f"Update Check Error: {e}")
|
||||
return False, "", ""
|
||||
return None
|
||||
|
||||
|
||||
def _get_platform_asset_name() -> str:
|
||||
|
||||
Reference in New Issue
Block a user