Add opt-in beta update UI and checks

Introduce an opt-in beta updates feature: add a styled "Receive Beta Updates" checkbox in the Updater UI with i18n strings, load/save logic in the custom options dialog, and a default config key (check_beta_updates=false).

Add _fetch_github_beta_version to the update thread to query GitHub releases (selecting the highest tag) and emit update_available for newer beta builds. When beta checking is enabled, the thread will perform the GitHub beta check and return early to avoid conflicting with the PyPI check. This enables users to opt into preview releases safely.
This commit is contained in:
oop7
2026-02-08 17:41:13 +02:00
parent d2bc08e937
commit d250c1b05f
5 changed files with 105 additions and 0 deletions
@@ -966,6 +966,12 @@ class CustomOptionsDialog(QDialog):
logger.info(f"Saving auto-update settings: enabled={enabled}, frequency={frequency}")
result = update_auto_update_settings(enabled, frequency)
logger.info(f"Auto-update settings save result: {result}")
# Save beta update setting
beta_enabled = self.updater_tab.get_beta_update_setting()
ConfigManager.set("check_beta_updates", beta_enabled)
logger.info(f"Saved beta updates setting: {beta_enabled}")
except Exception as e:
logger.exception(f"Error saving auto-update settings: {e}")
@@ -441,6 +441,40 @@ class UpdaterTabWidget(QWidget):
deno_layout.addLayout(deno_button_layout)
layout.addWidget(deno_group)
# === App Updates Section ===
app_update_group = QGroupBox(_("settings.app_updates_title"))
app_update_layout = QVBoxLayout()
self.beta_updates_checkbox = QCheckBox(_("settings.check_beta_updates"))
self.beta_updates_checkbox.setStyleSheet(
"""
QCheckBox {
color: #ffffff;
spacing: 5px;
padding: 3px;
}
QCheckBox::indicator {
width: 18px;
height: 18px;
border-radius: 9px;
}
QCheckBox::indicator:unchecked {
border: 2px solid #666666;
background: #1d1e22;
border-radius: 9px;
}
QCheckBox::indicator:checked {
border: 2px solid #c90000;
background: #c90000;
border-radius: 9px;
}
"""
)
app_update_layout.addWidget(self.beta_updates_checkbox)
app_update_group.setLayout(app_update_layout)
layout.addWidget(app_update_group)
# === yt-dlp Release Channel Section ===
ytdlp_channel_group = QGroupBox(_("settings.ytdlp_channel"))
@@ -618,6 +652,10 @@ class UpdaterTabWidget(QWidget):
# Set checkbox
self.auto_update_enabled.setChecked(auto_settings["enabled"])
# Load beta setting
beta_enabled = ConfigManager.get("check_beta_updates") or False
self.beta_updates_checkbox.setChecked(beta_enabled)
# Set current selection based on saved settings
current_frequency = auto_settings["frequency"]
if current_frequency == "startup":
@@ -655,6 +693,10 @@ class UpdaterTabWidget(QWidget):
frequency = "weekly"
return enabled, frequency
def get_beta_update_setting(self) -> bool:
"""Returns the beta update setting from the dialog."""
return self.beta_updates_checkbox.isChecked()
def _on_channel_changed(self, checked: bool) -> None:
"""Handle channel selection change."""