feat: support http update checks

This commit is contained in:
2026-06-18 09:38:44 +08:00
parent 6bc27f5180
commit 813e569639
3 changed files with 155 additions and 14 deletions
+7 -2
View File
@@ -149,15 +149,17 @@ class MainWindow(QMainWindow):
return bar
def _start_update_check(self):
"""Check the configured LAN source for a newer version, off the UI thread."""
"""Check the configured update source for a newer version, off the UI thread."""
source = self._config.get("update_source", "")
if not source:
return
user = self._config.get("update_user", "")
password = self._config.get("update_pass", "")
self._update_found.connect(self._on_update_found)
def worker():
try:
info = check_for_update(source, APP_VERSION)
info = check_for_update(source, APP_VERSION, user, password)
except Exception: # never let the thread crash startup
logger.exception("Update check failed")
return
@@ -191,6 +193,9 @@ class MainWindow(QMainWindow):
self._config.get("update_source", ""),
]
for path in candidates:
if path and path.lower().startswith(("http://", "https://")):
if QDesktopServices.openUrl(QUrl(path)):
return
if not path or not Path(path).exists():
continue
try: