The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
refactor(update): 统一版本检查事实源,禁用 Android Pack 更新
XiaoYouChRa7a708f7c6ef
diff --git a/app/services/update_service.py b/app/services/update_service.pyindex 6d8413d0..1d580609 100644--- a/app/services/update_service.py+++ b/app/services/update_service.py@@ -18,6 +18,7 @@ from loguru import loggerfrom app.config.constants import VERSIONfrom app.config.paths import APP_DATA_DIR, executableDir+from app.platform.android import IS_ANDROIDfrom app.platform.filesystem import matchChecksumfrom app.models.pack import PackManifestfrom app.sources import fetchJson, fetchRawFile, fetchReleaseAsset@@ -136,7 +137,7 @@ class UpdateService(QObject):data = await self._fetchVersions()if data is None:logger.debug("检查更新失败,将在下次启动时重试")- self._emit("app", UpdateState.IDLE)+ self._emit("app", UpdateState.IDLE, error="无法获取版本信息")returnself._versionsData = data@@ -149,6 +150,9 @@ class UpdateService(QObject):else:self._emit("app", UpdateState.IDLE)+ if IS_ANDROID:+ return+packsData = data.get("packs", {})featuresDir = executableDir / "features"for packDir in sorted(featuresDir.iterdir()) if featuresDir.exists() else []:diff --git a/app/view/pages/setting_page.py b/app/view/pages/setting_page.pyindex 94572f6a..13d16a49 100644--- a/app/view/pages/setting_page.py+++ b/app/view/pages/setting_page.py@@ -27,7 +27,6 @@ from app.view.components.setting_cards import (HeadersPresetSettingCard, IdentitySettingCard, LineEditSettingCard,PercentSpinBoxSettingCard, ProxySettingCard, SpinBoxSettingCard,)-from app.update import fetchReleasefrom app.view.components.editors import FolderPicker@@ -513,36 +512,25 @@ class SettingPage(ScrollArea):dialog.exec()def _onAboutCardClicked(self) -> None:+ from app.services.update_service import UpdateState+InfoBar.info(self.tr("检查更新"), self.tr("正在检查更新..."),duration=1500, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())- self._coroutineRunner.submit(- fetchRelease(),- done=self._onUpdateChecked, failed=self._onUpdateCheckFailed,- owner=self,- )- def _onUpdateChecked(self, release) -> None:- from app.update import isNewer- if not isNewer(VERSION, release.version):- InfoBar.success(self.tr("当前已是最新版本"),- self.tr("当前版本 {0},最新版本 {1}").format(VERSION, release.version),- duration=3000, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())- return+ def onChecked(info):+ if info.targetId != "app" or info.state not in (UpdateState.AVAILABLE, UpdateState.IDLE):+ return+ self._updateService.changed.disconnect(onChecked)+ if info.state == UpdateState.IDLE:+ if info.error:+ InfoBar.error(self.tr("检查更新失败"), self.tr("无法获取最新版本信息"),+ duration=3000, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())+ else:+ InfoBar.success(self.tr("当前已是最新版本"), "",+ duration=3000, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())- from app.models.task import TaskOptions- from app.view.dialogs.release_info import ReleaseInfoDialog- parent = self.window()- dialog = ReleaseInfoDialog(release, parent)- dialog.accepted.connect(lambda: self._coroutineRunner.submit(- self._featureService.parse(TaskOptions(url=dialog.selectedAsset().downloadUrl)),- done=self._taskService.add,- owner=parent,- ))- dialog.open()-- def _onUpdateCheckFailed(self, error: str) -> None:- InfoBar.error(self.tr("检查更新失败"), self.tr("无法获取最新版本信息"),- duration=3000, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())+ self._updateService.changed.connect(onChecked)+ self._updateService.check()def _onOpenLogClicked(self) -> None:from app.config.paths import APP_DATA_DIR