The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(security): 更新与安装始终验证证书,不受用户设置影响
XiaoYouChRd350326885e7
diff --git a/app/client.py b/app/client.pyindex 150688b1..ad9b6c1e 100644--- a/app/client.py+++ b/app/client.py@@ -103,11 +103,14 @@ def buildClient(sourceUserAgent: str = "",timeout: int | None = None,readTimeout: int | None = None,+ shouldVerifySsl: bool | None = None,) -> Client:resolved = toEmulation("") if emulation is ... else emulation+ if shouldVerifySsl is None:+ shouldVerifySsl = cfg.shouldVerifySsl.value# wreq 内置的根证书跟着 wreq 发版才更新,eMudhra 私钥泄露(2026-10)时还信任被吊销的中间证书config: ClientConfig = {- "tls_verify": Path(certifi.where()) if cfg.shouldVerifySsl.value else False,+ "tls_verify": Path(certifi.where()) if shouldVerifySsl else False,"redirect": Policy.limited(10),}if cfg.shouldUseSystemDns.value:@@ -169,7 +172,7 @@ async def fetchFile(outputPath: Path,onProgress: Callable[[float], None] | None = None,) -> None:- client = buildClient(readTimeout=FETCH_READ_TIMEOUT)+ client = buildClient(readTimeout=FETCH_READ_TIMEOUT, shouldVerifySsl=True)try:outputPath.parent.mkdir(parents=True, exist_ok=True)response = await client.get(url)diff --git a/app/sources.py b/app/sources.pyindex 50aed5df..a6046bfb 100644--- a/app/sources.py+++ b/app/sources.py@@ -9,6 +9,7 @@ from typing import Anyfrom loguru import logger+# 取到的版本信息和文件会被安装执行,所以一律验证证书,不看用户设置from app.client import buildClient, fetchFilefrom app.models.task import TaskError@@ -107,7 +108,7 @@ async def fetchLatestRelease(repo: Repo) -> Release:endpoints = SOURCES[source]url = f"{endpoints.api}/{repo.nameOn(source)}/releases/latest"headers = {"accept": "application/vnd.github+json"} if source == "github" else {}- client = buildClient(headers=headers, timeout=15)+ client = buildClient(headers=headers, timeout=15, shouldVerifySsl=True)try:resp = await client.get(url)resp.raise_for_status()@@ -141,7 +142,7 @@ async def fetchJson(repo: Repo, branch: str, path: str) -> tuple[dict, str]:async def attempt(source):endpoints = SOURCES[source]url = f"{endpoints.raw}/{repo.nameOn(source)}{endpoints.rawInfix}{branch}/{path}"- client = buildClient(timeout=15)+ client = buildClient(timeout=15, shouldVerifySsl=True)try:resp = await client.get(url)resp.raise_for_status()@@ -167,7 +168,7 @@ async def fetchRawFile(async def probe(source):endpoints = SOURCES[source]url = f"{endpoints.raw}/{repo.nameOn(source)}{endpoints.rawInfix}{branch}/{path}"- client = buildClient(headers={"Range": "bytes=0-0"}, timeout=10)+ client = buildClient(headers={"Range": "bytes=0-0"}, timeout=10, shouldVerifySsl=True)try:resp = await client.get(url)try:@@ -193,7 +194,7 @@ async def fetchRawFile(async def probeDownloadUrl(repo: Repo, tag: str, asset: str) -> str:async def probe(source):url = buildDownloadUrl(repo, tag, asset, source=source)- client = buildClient(headers={"Range": "bytes=0-0"}, timeout=10)+ client = buildClient(headers={"Range": "bytes=0-0"}, timeout=10, shouldVerifySsl=True)try:resp = await client.get(url)try:@@ -241,7 +242,7 @@ def buildPypiUrl(package: str, *, source: str) -> str:async def fetchPypiReleases(package: str) -> dict[str, list[dict]]:async def attempt(source):url = buildPypiUrl(package, source=source)- client = buildClient(timeout=15)+ client = buildClient(timeout=15, shouldVerifySsl=True)try:resp = await client.get(url)resp.raise_for_status()@@ -264,7 +265,7 @@ async def fetchPypiReleases(package: str) -> dict[str, list[dict]]:async def fetchPypiFile(url: str, outputPath: Path, onProgress: Callable[[float], None] | None = None) -> None:async def probe(candidate):- client = buildClient(headers={"Range": "bytes=0-0"}, timeout=10)+ client = buildClient(headers={"Range": "bytes=0-0"}, timeout=10, shouldVerifySsl=True)try:resp = await client.get(candidate)try: