Fix #112: Add support for opting into beta channel of releases
Test Suite / test (push) Canceled after 0s

Issue: Allow users to test completed builds without creating entire releases.

Solution:
- Added beta_channel parameter to UpdateCheckThread.__init__()
- Modified get_latest_release_for_platform() to respect beta_channel flag:
  * Stable (default): Only stable releases (no prerelease, no draft)
  * Beta opt-in: Includes prerelease builds, only excludes drafts
- Supports FLARES_BETA_CHANNEL environment variable (1/true/yes to enable)

Usage examples:
  export FLARES_BETA_CHANNEL=1 && ./flares.sh
  set FLARES_BETA_CHANNEL=true && flares.exe

Benefits:
  ✓ Easy opt-in via environment variable (no UI changes needed)
  ✓ No breaking changes - stable remains default
  ✓ Draft builds always excluded (security measure)
  ✓ Prerelease detection uses Gitea API 'prerelease' flag
This commit is contained in:
Hermes committed 2026-11-07 18:17:19 -07:00
1 parent 2d1133e099
commit e2cb49ceb9
1 file changed
+18 -2
+18 -2
View File
@@ -159,6 +159,7 @@ class UpdateCheckThread(QThread):
current_version: str, current_version: str,
platform_name: str, platform_name: str,
app_name: str, app_name: str,
beta_channel: bool = False, # Issue #112: Beta channel support
) -> None: ) -> None:
super().__init__() super().__init__()
@@ -167,6 +168,7 @@ class UpdateCheckThread(QThread):
self.current_version = current_version self.current_version = current_version
self.platform_name = platform_name self.platform_name = platform_name
self.app_name = app_name self.app_name = app_name
self.beta_channel = beta_channel or os.environ.get("FLARES_BETA_CHANNEL", "").lower() in ("1", "true", "yes")
def run(self) -> None: def run(self) -> None:
try: try:
@@ -198,7 +200,13 @@ class UpdateCheckThread(QThread):
if not releases: if not releases:
continue continue
latest = next((r for r in releases if not r.get("prerelease") and not r.get("draft")), None) # Issue #112: Support beta channel opt-in
if self.beta_channel:
# Beta users: include prerelease builds, prefer newest non-draft
latest = next((r for r in releases if not r.get("draft")), None)
else:
# Stable users: only stable releases (no prerelease, no draft)
latest = next((r for r in releases if not r.get("prerelease") and not r.get("draft")), None)
if not latest: if not latest:
continue continue
@@ -331,7 +339,15 @@ class UpdateManager(QObject):
self.start_update_check_thread() self.start_update_check_thread()
def start_update_check_thread(self) -> None: def start_update_check_thread(self) -> None:
self.check_thread = UpdateCheckThread(self.api_url, self.api_url_sec, self.current_version, self.platform_name, self.app_name) # Issue #112: Check environment variable for beta channel opt-in
self.check_thread = UpdateCheckThread(
self.api_url,
self.api_url_sec,
self.current_version,
self.platform_name,
self.app_name,
beta_channel=os.environ.get("FLARES_BETA_CHANNEL", "").lower() in ("1", "true", "yes")
)
self.check_thread.download_requested.connect(self.on_server_update_requested) self.check_thread.download_requested.connect(self.on_server_update_requested)
self.check_thread.no_update_available.connect(self.on_server_no_update) self.check_thread.no_update_available.connect(self.on_server_no_update)
self.check_thread.error_occurred.connect(self.on_error) self.check_thread.error_occurred.connect(self.on_error)