The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(update): x64 程序跑在 ARM 上时更新失败
XiaoYouChRe456cb7b9d84
diff --git a/app/platform/arch.py b/app/platform/arch.pyindex 6c165675..3b1f4101 100644--- a/app/platform/arch.py+++ b/app/platform/arch.py@@ -1,5 +1,8 @@import platform+import sysconfigARCH_ALIASES = {"amd64": "x86_64", "x86_64": "x86_64", "arm64": "arm64", "aarch64": "arm64", "arm64_v8a": "arm64"}MACHINE_ARCH = ARCH_ALIASES[platform.machine().lower()]+# Windows 上 platform.machine() 查询 WMI,x64 程序跑在 ARM 上也返回 ARM64;BUILD_ARCH 取解释器自身的架构+BUILD_ARCH = ARCH_ALIASES[sysconfig.get_platform().rsplit("-", 1)[1]]diff --git a/app/services/update_service.py b/app/services/update_service.pyindex 7f1065e7..90cd3265 100644--- a/app/services/update_service.py+++ b/app/services/update_service.py@@ -2,7 +2,6 @@ from __future__ import annotationsimport asyncioimport os-import platformimport shutilimport subprocessimport sys@@ -20,6 +19,7 @@ from app.checksum import parseChecksum, toChecksumfrom app.config.constants import VERSIONfrom app.config.paths import APP_DATA_DIR, FEATURES_DIR, EXECUTABLE_DIRfrom app.platform.android import IS_ANDROID+from app.platform.arch import BUILD_ARCH, MACHINE_ARCHfrom app.models.pack import PackManifestfrom app.models.task import TaskError, toTaskErrorfrom app.sources import fetchJson, fetchRawFile, fetchReleaseAsset@@ -31,11 +31,6 @@ if TYPE_CHECKING:STAGING_DIR = APP_DATA_DIR / "update_staging"OS_MAP = {"win32": "Windows", "darwin": "macOS", "linux": "Linux"}-MACHINE_MAP = {"AMD64": "x86_64", "x86_64": "x86_64", "aarch64": "arm64", "arm64": "arm64"}---def buildPlatformKey() -> str:- return f"{OS_MAP[sys.platform]}-{MACHINE_MAP[platform.machine()]}"def extractZip(archivePath: Path, targetDir: Path) -> None:@@ -207,12 +202,12 @@ class UpdateService:appData = self._versionsData.get("app", {})version = appData.get("version", "")tag = f"v{version}"- platformKey = buildPlatformKey()+ platformKey = f"{OS_MAP[sys.platform]}-{MACHINE_ARCH}"patches = appData.get("patches", {})patch = patches.get(platformKey)- if patch and patch.get("from") == VERSION:+ if patch and patch.get("from") == VERSION and BUILD_ARCH == MACHINE_ARCH:sha = patch.get("sha256", "")outputPath = STAGING_DIR / "patch.hdiff"