feat: add "Include beta updates" setting to filter prerelease notifications

Users on the Docker `latest` tag were seeing update notifications for beta
releases (e.g. v0.2.1b) they couldn't install. The update checker now fetches
/releases instead of /releases/latest and filters by parse_version() prerelease
detection. A new toggle in Settings (default: off) lets users opt in to beta
notifications.
This commit is contained in:
maziggy
2026-02-19 16:15:01 +01:00
parent 5e6c04f303
commit 2f51bec40d
14 changed files with 94 additions and 21 deletions
+1
View File
@@ -89,6 +89,7 @@ async def get_settings(
"spoolman_report_partial_usage",
"check_updates",
"check_printer_firmware",
"include_beta_updates",
"virtual_printer_enabled",
"ftp_retry_enabled",
"mqtt_enabled",
+36 -2
View File
@@ -189,6 +189,11 @@ async def check_for_updates(
"message": "Update checks are disabled",
}
# Check if beta updates should be included
result = await db.execute(select(Settings).where(Settings.key == "include_beta_updates"))
beta_setting = result.scalar_one_or_none()
include_beta = beta_setting and beta_setting.value.lower() == "true"
_update_status = {
"status": "checking",
"progress": 0,
@@ -199,7 +204,7 @@ async def check_for_updates(
try:
async with httpx.AsyncClient() as client:
response = await client.get(
f"https://api.github.com/repos/{GITHUB_REPO}/releases/latest",
f"https://api.github.com/repos/{GITHUB_REPO}/releases?per_page=20",
headers={"Accept": "application/vnd.github.v3+json"},
timeout=10.0,
)
@@ -220,7 +225,36 @@ async def check_for_updates(
}
response.raise_for_status()
release_data = response.json()
releases = response.json()
# Find the appropriate release based on beta setting
release_data = None
for release in releases:
tag = release.get("tag_name", "")
if include_beta:
# Accept any release (first = newest)
release_data = release
break
else:
# Skip prereleases (based on version parsing, not GitHub flag)
parsed = parse_version(tag)
if parsed[4] == 0: # is_prerelease == 0
release_data = release
break
if not release_data:
_update_status = {
"status": "idle",
"progress": 100,
"message": "No releases found",
"error": None,
}
return {
"update_available": False,
"current_version": APP_VERSION,
"latest_version": None,
"message": "No releases found",
}
latest_version = release_data.get("tag_name", "").lstrip("v")
release_name = release_data.get("name", latest_version)