A full-featured download manager.
chore(release): prepare 2.0.0-beta.27 (#1995)
Dr_rOot6a77297effcd
diff --git a/.claude/rules/git-workflow.md b/.claude/rules/git-workflow.mdindex cc20f226..8373c32a 100644--- a/.claude/rules/git-workflow.md+++ b/.claude/rules/git-workflow.md@@ -58,10 +58,9 @@ them with local publishing steps.- Do not manually upload release files, reuse unverified artifacts, bypassprotected environments, weaken signing-input isolation, or overwrite anexisting immutable container tag.-- Protected stable tags publish one verified amd64/arm64 Snap build set to- `latest/edge`; prerelease tag runs stop after source validation and do not- build or publish Snap artifacts. Promote those exact revisions with- `snap-promote.yml` from protected `main`; never rebuild during promotion.- Stable rejects prereleases.+- Protected stable and beta tags publish one verified amd64/arm64 Snap build+ set to `latest/edge`. Promote those exact revisions with `snap-promote.yml`+ from protected `main`; never rebuild during promotion. Stable rejects+ prereleases.- If a release gate fails, fix the source or workflow and run the completegated path again. Do not publish a partial platform set.diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.ymlindex 8e8b0ee4..c357a29e 100644--- a/.github/workflows/snap.yml+++ b/.github/workflows/snap.yml@@ -3,8 +3,8 @@# Snap is deliberately independent from the GitHub Release workflow:# - amd64 and arm64 are built on matching native Ubuntu runners;# - pull requests and manual runs never receive Store credentials;-# - protected stable release tags publish a complete two-architecture build-# set to latest/edge only; prerelease tag runs stop after source validation;+# - protected stable and beta release tags publish a complete+# two-architecture build set to latest/edge only;# - candidate and stable receive that exact build set through snap-promote.yml.name: Snap@@ -60,7 +60,6 @@ jobs:timeout-minutes: 5outputs:version: ${{ steps.metadata.outputs.version }}- prerelease: ${{ steps.metadata.outputs.prerelease }}steps:- name: Checkout release sourceuses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1@@ -97,9 +96,6 @@ jobs:build:name: Build Snap / ${{ matrix.snap_arch }}- if: >-- github.event_name != 'push' ||- needs.preflight.outputs.prerelease == 'false'needs: preflightruns-on: ${{ matrix.os }}timeout-minutes: 90@@ -244,7 +240,6 @@ jobs:name: Publish complete build set to edgeif: >-github.event_name == 'push' &&- needs.preflight.outputs.prerelease == 'false' &&startsWith(github.ref, 'refs/tags/v') &&github.ref_protected == trueneeds: [preflight, build]diff --git a/README.md b/README.mdindex 70bc4877..160633e6 100644--- a/README.md+++ b/README.md@@ -22,8 +22,8 @@ The same core powers two ways to run Motrix:## 🧪 Beta testingMotrix Turbo v2 is currently in beta. After its remaining release gates pass,-download [v2.0.0-beta.26 from GitHub Releases](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.26)-and read the [full release notes](./docs/release-notes/2.0.0-beta.26.md) before+download [v2.0.0-beta.27 from GitHub Releases](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.27)+and read the [full release notes](./docs/release-notes/2.0.0-beta.27.md) beforeinstalling it.Back up your existing Motrix data and downloads before testing. Migration from@@ -124,25 +124,28 @@ Plugins are bundled as a single ES2020 module and run inside a QuickJS sandbox wDownload Motrix from [motrix.app](https://motrix.app) and choose the package for your operating system. Most Mac users should choose the Apple Silicon build; Intel builds are available for older Macs with Intel processors.After the remaining release gates pass, the current beta desktop packages-will be distributed through the GitHub prerelease linked above. Snap is not-published for this beta; prerelease tag runs stop after source validation and-do not build or publish Snap artifacts. Choose the package that matches your-operating system and architecture:+will be distributed through the GitHub prerelease linked above. The protected+release tag also publishes verified Snap builds to `latest/edge`. Choose the+package that matches your operating system and architecture:| Platform | Architectures | Packages / channel | Recommendation ||----------|---------------|--------------------|----------------|| macOS 12+ | `arm64` (Apple Silicon), `x64` (Intel) | `.dmg` / `.zip` | Use the `.dmg` matching your Mac; choose `x64` only for an Intel-based Mac || Windows | `x64` | `.exe` (NSIS installer) / `.zip` | Use the `.exe` installer for a normal installation or `.zip` for a manually extracted copy || Linux | `x64`, `arm64` | `.AppImage` / `.deb` / `.rpm` | Use the portable `.AppImage` on any distribution, `.deb` on Debian or Ubuntu, or `.rpm` on Fedora or openSUSE |+| Linux (Snap Store) | `amd64`, `arm64` | `latest/edge` | Install the strictly confined beta with `sudo snap install motrix --edge` |The `.AppImage` asks on first launch whether to register its desktop entry andURL-scheme handlers under your user data directory; declining leaves your systemuntouched. You can enable or remove this desktop integration at any time fromSettings → Integration.-This beta does not publish a Snap. Flatpak is validated separately-and is not published by the release tag. Windows `arm64` and all 32-bit-packages are not available. Windows `x64` packages are unsigned and may-trigger a Windows SmartScreen warning.+The Snap Store package is strictly confined. Its approved `personal-files`+interface permits Motrix to register Native Messaging hosts for supported+browsers; it does not grant general access to files outside the normal Snap+interfaces. Flatpak is validated separately and is not published by the+release tag. Windows `arm64` and all 32-bit packages are not available.+Windows `x64` packages are unsigned and may trigger a Windows SmartScreen+warning.### Command-line client@@ -162,7 +165,7 @@ downloaded resources:```bashmkdir -p motrix-data downloadssudo chown 1000:1000 motrix-data downloads-export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.26'+export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.27'export MOTRIX_PUBLIC_URL='http://nas.example.lan:8080'docker compose pull serverdocker compose up -d --waitdiff --git a/README.zh-CN.md b/README.zh-CN.mdindex 12cb573d..6f385459 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -22,8 +22,8 @@ Motrix 是一款界面简洁、功能丰富的桌面下载管理器,可处理## 🧪 Beta 测试Motrix Turbo v2 目前仍处于 beta 阶段。剩余发布门禁通过后,请从 GitHub Releases-下载 [v2.0.0-beta.26](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.26),-并在安装前阅读[完整发布说明](./docs/release-notes/2.0.0-beta.26.zh-CN.md)。+下载 [v2.0.0-beta.27](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.27),+并在安装前阅读[完整发布说明](./docs/release-notes/2.0.0-beta.27.zh-CN.md)。测试前请备份现有 Motrix 数据和下载文件。Motrix v1 数据的迁移路径尚未经过验证,请勿让本 beta 使用您唯一一份 v1 数据。条件允许时,建议通过独立的系统@@ -122,17 +122,20 @@ pnpm exec motrix-plugin lint # 检查打包产物访问 Motrix 官网 [motrix.app](https://motrix.app),选择对应操作系统的安装包。macOS 用户通常下载 Apple Silicon 版本即可;如果使用较早的 Intel 芯片 Mac,请选择 Intel 版本。剩余发布门禁通过后,当前 beta 桌面安装包将通过上方链接的 GitHub 预发布版-提供。本 beta 不发布 Snap;预发布 tag 的 Snap run 会在 source validation 后停止,-不会构建或发布 Snap artifact。请根据操作系统和架构选择安装包:+提供。受保护的发布 tag 也会把验证过的 Snap 构建发布到+`latest/edge`。请根据操作系统和架构选择安装包:| 平台 | 架构 | 安装包 / 通道 | 选择建议 ||------|------|---------------|----------|| macOS 12+ | `arm64`(Apple Silicon)、`x64`(Intel) | `.dmg` / `.zip` | 选择与 Mac 架构匹配的 `.dmg`;仅 Intel Mac 使用 `x64` || Windows | `x64` | `.exe`(NSIS 安装包)/ `.zip` | 常规安装使用 `.exe`;`.zip` 可解压后手动运行 || Linux | `x64`、`arm64` | `.AppImage` / `.deb` / `.rpm` | 任意发行版可使用便携的 `.AppImage`,Debian 或 Ubuntu 使用 `.deb`,Fedora 或 openSUSE 使用 `.rpm` |+| Linux(Snap Store) | `amd64`、`arm64` | `latest/edge` | 使用 `sudo snap install motrix --edge` 安装严格限制的 beta |`.AppImage` 首次启动时会询问是否把桌面入口和 URL scheme 处理程序注册到你的用户数据目录;拒绝则不改动系统。之后随时可以在「设置 → 集成」中启用或移除该桌面集成。-本 beta 不发布 Snap。Flatpak 会单独验证,不会随该版本 tag 发布。+Snap Store 安装包使用严格限制。已批准的 `personal-files` interface 允许 Motrix+为支持的浏览器注册 Native Messaging host,不会授予常规 Snap interface+之外的通用文件访问权限。Flatpak 会单独验证,不会随该版本 tag 发布。同时不提供 Windows `arm64` 和任何 32 位安装包。Windows `x64` 安装包未签名,可能触发 Windows SmartScreen 警告。@@ -153,7 +156,7 @@ Beta 只发布不可变的版本 tag,不会更新 `latest`;仓库的 `compos```bashmkdir -p motrix-data downloadssudo chown 1000:1000 motrix-data downloads-export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.26'+export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.27'export MOTRIX_PUBLIC_URL='http://nas.example.lan:8080'docker compose pull serverdocker compose up -d --waitdiff --git a/docs/release-notes/2.0.0-beta.27.md b/docs/release-notes/2.0.0-beta.27.mdnew file mode 100644index 00000000..d467160f--- /dev/null+++ b/docs/release-notes/2.0.0-beta.27.md@@ -0,0 +1,110 @@+# Motrix 2.0.0-beta.27++English | [简体中文](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.27/docs/release-notes/2.0.0-beta.27.zh-CN.md)++Motrix 2.0.0-beta.27 enables protected beta releases to publish verified+`amd64` and `arm64` Snap builds to the Snap Store, adds GeoIP support to the+Headless Server, and improves aria2 behavior, Windows integration, typography,+packaging, and desktop details. It is intended for public distribution only+after every protected release gate passes.++## Highlights++- Protected stable and beta tags now build, verify, and upload one complete+ two-architecture Snap set before releasing its exact revisions to+ `latest/edge`. Pull requests and manual runs remain build-only, and+ `candidate` or `stable` promotion continues to reuse the already verified+ revisions.+- The Headless Server now exposes the same GeoIP and peer queries as the+ Electron app, forwards GeoIP events, closes the manager cleanly during+ shutdown, and prints a copyable Server URL when it starts. Its Add Task+ dialog now follows the desktop layout and animation behavior+ ([#1986](https://github.com/agalwood/Motrix/pull/1986)).+- aria2 runtime defaults are aligned across new and existing profiles, while+ BitTorrent preview and file-selection behavior more consistently follows the+ task's authoritative metadata+ ([#1982](https://github.com/agalwood/Motrix/pull/1982)).+- New HTTP downloads now honor the active performance profile's connection+ count instead of overriding it with five connections+ ([#1989](https://github.com/agalwood/Motrix/issues/1989)).+- The Files inspector now restores indexed single-file torrent names, refreshes+ live progress, and preserves the display order of bracketed file names+ ([#1991](https://github.com/agalwood/Motrix/issues/1991),+ [#1992](https://github.com/agalwood/Motrix/issues/1992)).+- The Info Hash copy action now copies the raw hash. Selecting SOCKS5 no longer+ sends an unsupported proxy option to the download engine, while app-update+ and tracker proxy scopes remain available+ ([#1990](https://github.com/agalwood/Motrix/issues/1990),+ [#1994](https://github.com/agalwood/Motrix/issues/1994)).+- The development runner now uses `cross-spawn`, allowing `pnpm start` to+ resolve its child command correctly on Windows+ ([#1981](https://github.com/agalwood/Motrix/issues/1981)).+- Windows 11 default-app detection now prefers `UserChoiceLatest`, the CLI+ refreshes its Node path discovery, and concurrent directory-picker requests+ no longer open duplicate native dialogs+ ([#1967](https://github.com/agalwood/Motrix/pull/1967),+ [#1973](https://github.com/agalwood/Motrix/pull/1973)).+- Cross-platform font fallbacks now preserve bundled Inter text while choosing+ appropriate native CJK fonts for the active platform and locale+ ([#1972](https://github.com/agalwood/Motrix/pull/1972)).+- Server artifacts now include the Motrix license, and the desktop preserves+ its window title while exposing favicon and Apple touch icons+ ([#1983](https://github.com/agalwood/Motrix/pull/1983)).++## Before testing++This is prerelease software. Back up existing Motrix application data and+downloads before installing it. Migration from Motrix v1 data has not yet been+validated, so do not use your only copy of v1 data with this beta.++When practical, test v2 in parallel using a separate OS account, machine, or+Docker data directory. Do not rely on this beta for your only copy of important+downloads.++After the protected release completes, Snap testers can install the strictly+confined build with `sudo snap install motrix --edge`. Verify that normal+downloads, removable media, and browser Native Messaging integration behave as+expected. Existing installations tracking `latest/edge` should upgrade to the+same beta.27 revision set.++## Planned downloads after release gates pass++| Distribution | Architectures | Planned output |+|--------------|---------------|----------------|+| macOS 12 or later | `arm64` (Apple Silicon), `x64` (Intel) | DMG and ZIP |+| Windows | `x64` | Unsigned NSIS installer (`.exe`) and ZIP |+| Linux | `x64`, `arm64` | AppImage, DEB, and RPM |+| Flatpak Native Host companion | `linux/x64`, `linux/arm64` | `Motrix-Native-Host-2.0.0-beta.27-linux-<arch>.tar.gz` |+| Docker Hub / GHCR | `linux/amd64`, `linux/arm64` | Immutable `2.0.0-beta.27` tag in both registries |+| Snap Store | `amd64`, `arm64` | Verified build set on `latest/edge` |++After every container gate passes, the versioned image references will be+`docker.io/motrixapp/motrix-server:2.0.0-beta.27` and+`ghcr.io/agalwood/motrix-server:2.0.0-beta.27`. See the+[Docker Server deployment guide](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.27/docs/docker-server.md)+for storage, networking, and upgrade guidance.++## Distribution notes++- AppImage desktop integration is opt-in and confined to the current user's+ XDG data directory. Browser-extension hand-off is not yet available from the+ AppImage package because its Native Messaging host does not have a stable+ path outside the mounted image.+- Flatpak is validated separately and is not published by the release tag; the+ GitHub prerelease includes its Native Host companion archives.+- Windows `arm64` and all 32-bit packages are not available.+- Windows packages are unsigned and may trigger a Windows SmartScreen warning.+ Download them only from the official GitHub prerelease after it is published.+- Beta container tags are immutable and do not update `latest`, `stable`, or+ other stable floating tags.+- The Snap package is strictly confined. Its approved `personal-files`+ interface is limited to registering Native Messaging host manifests for+ supported browsers. Beta publication updates `latest/edge` only; it does not+ promote the build to `candidate` or `stable`.++## Feedback++Please report reproducible problems through+[GitHub Issues](https://github.com/agalwood/Motrix/issues). Include your+operating system, architecture, package type, and the steps needed to reproduce+the issue.diff --git a/docs/release-notes/2.0.0-beta.27.zh-CN.md b/docs/release-notes/2.0.0-beta.27.zh-CN.mdnew file mode 100644index 00000000..cf9ac3df--- /dev/null+++ b/docs/release-notes/2.0.0-beta.27.zh-CN.md@@ -0,0 +1,93 @@+# Motrix 2.0.0-beta.27++[English](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.27/docs/release-notes/2.0.0-beta.27.md) | 简体中文++Motrix 2.0.0-beta.27 允许受保护的 beta 发布把经过验证的 `amd64` 与+`arm64` Snap 构建发布到 Snap Store,并为 Headless Server 新增 GeoIP+支持,同时改进 aria2 行为、Windows 集成、字体、打包与桌面细节。只有在+所有受保护发布门禁通过后,本版本才适合公开分发。++## 主要改进++- 受保护的稳定版与 beta tag 现在会构建、验证并上传一套完整的双架构+ Snap,再把这些精确 revision 发布到 `latest/edge`。Pull request 与手动+ run 仍只构建不发布;晋级到 `candidate` 或 `stable` 时,仍会复用已验证的+ revision。+- Headless Server 现在提供与 Electron 应用一致的 GeoIP 与 peer 查询,会转发+ GeoIP 事件,关闭时会正确停止 manager,并在启动时输出可复制的 Server URL。+ Add Task 对话框也与桌面端布局和动画保持一致+ ([#1986](https://github.com/agalwood/Motrix/pull/1986))。+- aria2 runtime 默认值已在新建和现有 profile 之间对齐;BitTorrent 预览与文件+ 选择行为也会更稳定地以任务的权威元数据为准+ ([#1982](https://github.com/agalwood/Motrix/pull/1982))。+- 新建 HTTP 下载现在会使用当前性能配置的连接数,不再固定覆盖为 5 个连接+ ([#1989](https://github.com/agalwood/Motrix/issues/1989))。+- 文件检查器现在会还原索引暂存区中的单文件种子名称、实时刷新进度,并保持带+ 方括号文件名的显示顺序+ ([#1991](https://github.com/agalwood/Motrix/issues/1991)、+ [#1992](https://github.com/agalwood/Motrix/issues/1992))。+- Info Hash 复制按钮现在只复制原始哈希。选择 SOCKS5 时,不会再向下载引擎发送+ 不受支持的代理选项;应用更新与 Tracker 同步仍可使用该代理+ ([#1990](https://github.com/agalwood/Motrix/issues/1990)、+ [#1994](https://github.com/agalwood/Motrix/issues/1994))。+- 开发运行器已改用 `cross-spawn`,使 Windows 上的 `pnpm start` 可以正确找到并+ 启动子命令+ ([#1981](https://github.com/agalwood/Motrix/issues/1981))。+- Windows 11 默认应用检测现在优先使用 `UserChoiceLatest`;CLI 会刷新 Node+ 路径检测;并发的目录选择请求不再重复打开原生对话框+ ([#1967](https://github.com/agalwood/Motrix/pull/1967)、+ [#1973](https://github.com/agalwood/Motrix/pull/1973))。+- 跨平台字体 fallback 会保留内置 Inter 字体,并根据当前平台与 locale 选择合适的+ 原生 CJK 字体+ ([#1972](https://github.com/agalwood/Motrix/pull/1972))。+- Server 产物现在包含 Motrix license;桌面端会保留窗口标题,并提供 favicon 与+ Apple touch icon+ ([#1983](https://github.com/agalwood/Motrix/pull/1983))。++## 测试前须知++这是预发布软件。安装前请备份现有 Motrix 应用数据和下载文件。Motrix v1 数据的+迁移路径尚未经过验证,请勿让本 beta 使用您唯一的一份 v1 数据。++条件允许时,请使用独立的操作系统账号、设备或 Docker 数据目录并行测试 v2。请勿仅+依赖本 beta 保存重要下载文件。++受保护发布完成后,Snap 测试者可使用 `sudo snap install motrix --edge`+安装严格限制的构建。请检查普通下载、可移动存储设备与浏览器 Native Messaging+集成是否正常。已跟踪 `latest/edge` 的安装应升级到同一组 beta.27 revision。++## 发布门禁通过后计划提供的下载++| 分发方式 | 架构 | 计划产物 |+|---------|------|---------|+| macOS 12 或更高版本 | `arm64`(Apple Silicon)、`x64`(Intel) | DMG 和 ZIP |+| Windows | `x64` | 未签名 NSIS 安装程序(`.exe`)和 ZIP |+| Linux | `x64`、`arm64` | AppImage、DEB 和 RPM |+| Flatpak Native Host companion | `linux/x64`、`linux/arm64` | `Motrix-Native-Host-2.0.0-beta.27-linux-<arch>.tar.gz` |+| Docker Hub / GHCR | `linux/amd64`、`linux/arm64` | 两个仓库中的不可变 `2.0.0-beta.27` 标签 |+| Snap Store | `amd64`、`arm64` | `latest/edge` 上的已验证构建集 |++所有容器门禁通过后,可使用以下带版本镜像:+`docker.io/motrixapp/motrix-server:2.0.0-beta.27` 和+`ghcr.io/agalwood/motrix-server:2.0.0-beta.27`。存储、网络与升级说明请参阅+[Docker Server 部署指南](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.27/docs/docker-server.zh-CN.md)。++## 分发说明++- AppImage 桌面集成需要用户主动启用,且只会写入当前用户的 XDG 数据目录。由于 Native+ Messaging host 在挂载镜像之外没有稳定路径,浏览器扩展暂时无法向 AppImage+ 安装包转交下载任务。+- Flatpak 单独验证,不由 release tag 发布;GitHub 预发布版会包含它的 Native Host+ companion 压缩包。+- 不提供 Windows `arm64` 和所有 32 位安装包。+- Windows 安装包未签名,可能触发 Windows SmartScreen 警告。请仅从已发布的官方+ GitHub 预发布版下载。+- Beta 容器标签不可变,也不会更新 `latest`、`stable` 或其他稳定通道浮动标签。+- Snap 安装包使用严格限制。已批准的 `personal-files` interface 仅用于为支持的+ 浏览器注册 Native Messaging host manifest。Beta 发布只会更新 `latest/edge`,不会把+ 构建晋级到 `candidate` 或 `stable`。++## 反馈++如遇到可复现的问题,请通过 [GitHub Issues](https://github.com/agalwood/Motrix/issues)+反馈,并附上操作系统、架构、安装包类型和复现步骤。diff --git a/flatpak/app.motrix.native.metainfo.xml b/flatpak/app.motrix.native.metainfo.xmlindex bb31064f..0a70a30f 100644--- a/flatpak/app.motrix.native.metainfo.xml+++ b/flatpak/app.motrix.native.metainfo.xml@@ -76,6 +76,17 @@<releases><!-- Update this list on every release; Flathub linter requires the mostrecent version listed here to match the manifest's source tag. -->+ <release version="2.0.0-beta.27" date="2026-08-27">+ <description>+ <p>+ Protected beta tags now publish verified amd64 and arm64 Snap builds+ to latest/edge. This release also adds Server GeoIP support, aligns+ aria2 defaults and BitTorrent preview behavior, improves Windows+ integration and cross-platform fonts, and fixes several packaging+ and desktop details.+ </p>+ </description>+ </release><release version="2.0.0-beta.26" date="2026-08-25"><description><p>diff --git a/package.json b/package.jsonindex 4070a778..48862c43 100644--- a/package.json+++ b/package.json@@ -3,7 +3,7 @@"type": "module","productName": "Motrix","homepage": "https://motrix.app",- "version": "2.0.0-beta.26",+ "version": "2.0.0-beta.27","packageManager": "[email protected]+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621","description": "A full-featured download manager","keywords": [],@@ -94,6 +94,7 @@"@types/ws": "^8.18.1","@types/yauzl": "^3.4.0","@vitest/coverage-v8": "^4.1.10",+ "cross-spawn": "^7.0.6","electron": "43.4.0","electron-builder": "26.15.7","esbuild": "^0.28.2",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex cc44d66b..032a1224 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -207,6 +207,9 @@ importers:'@vitest/coverage-v8':specifier: ^4.1.10version: 4.1.10([email protected])+ cross-spawn:+ specifier: ^7.0.6+ version: 7.0.6electron:specifier: 43.4.0version: 43.4.0([email protected])diff --git a/scripts/dev.mjs b/scripts/dev.mjsindex 3c09fcd8..f46e253d 100644--- a/scripts/dev.mjs+++ b/scripts/dev.mjs@@ -14,11 +14,11 @@// Signals:// SIGINT / SIGTERM — cleanly kill Electron, exit the runner.-import { spawn } from 'node:child_process'import { createRequire } from 'node:module'import path from 'node:path'import process from 'node:process'import { fileURLToPath } from 'node:url'+import spawn from 'cross-spawn'import { build, createServer } from 'vite'const require = createRequire(import.meta.url)diff --git a/src/core/proxy/serializers.test.ts b/src/core/proxy/serializers.test.tsindex 56aa7867..4ade2882 100644--- a/src/core/proxy/serializers.test.ts+++ b/src/core/proxy/serializers.test.ts@@ -31,6 +31,16 @@ describe('proxyToAria2Options', () => {expect(r).toEqual({ allProxy: 'http://p.example.com:8080', noProxy: '' })})+ it('does not pass socks5 to aria2', () => {+ expect(+ proxyToAria2Options({+ ...enabledHttp,+ protocol: 'socks5',+ scopes: { download: true, updateApp: false, updateTrackers: false },+ })+ ).toBeNull()+ })+it('joins bypass with comma', () => {const r = proxyToAria2Options({...enabledHttp,diff --git a/src/core/proxy/serializers.ts b/src/core/proxy/serializers.tsindex d6bdf37c..369f6ea9 100644--- a/src/core/proxy/serializers.ts+++ b/src/core/proxy/serializers.ts@@ -4,6 +4,7 @@ export function proxyToAria2Options(p: ProxySettings): { allProxy: string; noProxy: string } | null {if (!p.enabled || !p.scopes.download) return null+ if (p.protocol === 'socks5') return nullif (!p.host || p.port <= 0) return nullreturn {allProxy: buildProxyUrl(p),diff --git a/src/main/ipc/queries/get-task-files.test.ts b/src/main/ipc/queries/get-task-files.test.tsindex 187e1e6e..ab2fcb92 100644--- a/src/main/ipc/queries/get-task-files.test.ts+++ b/src/main/ipc/queries/get-task-files.test.ts@@ -376,4 +376,78 @@ describe('getTaskFiles handler', () => {expect(result[0]?.path).toBe('CD1/track01.flac')})++ it('restores the torrent name for an indexed single-file payload', async () => {+ const workspacePath = '/Users/x/Downloads/.motrix/0123456789abcdefabcd'+ const absolutePath = `${workspacePath}/p`+ const torrentRootName = 'ubuntu-25.10-desktop-amd64.iso'+ const db = {+ getTaskFiles: vi.fn(() => [+ {+ fileIndex: 0,+ path: absolutePath,+ size: 6_500_000_000,+ selected: true,+ },+ ]),+ }+ const taskManager = {+ getById: vi.fn(() =>+ mkTask({+ status: TaskStatus.Downloading,+ diskPath: workspacePath,+ saveDir: '/Users/x/Downloads',+ instances: [+ {+ instanceId: 'primary:t1',+ motrixId: 't1',+ gid: 'gid1',+ phase: TaskInstancePhase.BtDownload,+ status: TaskStatus.Downloading,+ progress: 0,+ totalBytes: 0,+ downloadedBytes: 0,+ uploadedBytes: 0,+ diskPath: workspacePath,+ transitionPhase: TransitionPhase.Idle,+ uris: [],+ uriHash: null,+ payload: {+ btStorageLayout: {+ version: 1,+ strategy: 'indexed-staging',+ workspacePath,+ payloadEntry: 'p',+ torrentRootName,+ multiFile: false,+ },+ },+ createdAt: 1,+ updatedAt: 1,+ },+ ],+ })+ ),+ }+ const engine = {+ getTaskFiles: vi.fn(async () => [+ {+ index: 0,+ path: absolutePath,+ size: 6_500_000_000,+ completedBytes: 3_250_000_000,+ selected: true,+ },+ ]),+ }+ const handler = createGetTaskFilesHandler({+ db,+ taskManager,+ engine,+ } as unknown as Parameters<typeof createGetTaskFilesHandler>[0])++ const result = await handler('t1')++ expect(result[0]?.path).toBe(torrentRootName)+ })})diff --git a/src/main/ipc/queries/get-task-files.ts b/src/main/ipc/queries/get-task-files.tsindex c50da6a4..92dcda62 100644--- a/src/main/ipc/queries/get-task-files.ts+++ b/src/main/ipc/queries/get-task-files.ts@@ -1,7 +1,11 @@+import path from 'node:path'import type { EngineAdapter } from '@core/engine/engine-adapter'import { getLogger } from '@core/logger'import type { MotrixDatabase } from '@core/session/motrix-database'-import { getBtPayloadPath } from '@core/task/bt-storage-layout'+import {+ getBtPayloadPath,+ getBtStorageLayout,+} from '@core/task/bt-storage-layout'import type { TaskManager } from '@core/task/task-manager'import { relativizeTorrentPath } from '@shared/lib/path-ext'import type { DownloadTask, TaskFile } from '@shared/types/task'@@ -22,9 +26,19 @@ interface Deps {}function relativize(absolutePath: string, task: DownloadTask): string {+ const layout = getBtStorageLayout(task)+ const payloadPath = getBtPayloadPath(task)+ if (+ layout &&+ !layout.multiFile &&+ payloadPath &&+ path.normalize(absolutePath) === path.normalize(payloadPath)+ ) {+ return layout.torrentRootName+ }return relativizeTorrentPath(absolutePath,- getBtPayloadPath(task),+ payloadPath,task.diskPath,task.finalPath,task.saveDirdiff --git a/src/renderer/components/add-task/add-task-form.test.tsx b/src/renderer/components/add-task/add-task-form.test.tsxindex 31586916..d75fb91d 100644--- a/src/renderer/components/add-task/add-task-form.test.tsx+++ b/src/renderer/components/add-task/add-task-form.test.tsx@@ -271,6 +271,34 @@ describe('AddTaskForm', () => {expect(onSubmitSuccess).toHaveBeenCalledWith('ok-gid')})+ it('uses the current performance profile split for new downloads', async () => {+ const user = userEvent.setup()+ const { transport } = await import('@renderer/lib/transport')+ vi.mocked(transport.invoke).mockImplementation(async (channel: string) => {+ if (channel === 'query:getSettings') {+ return {+ app: { defaultSaveDir: '/d', autofillClipboardLinks: true },+ engine: { split: 32 },+ }+ }+ return { outcome: 'created', gid: 'profile-gid', taskId: 'profile-task' }+ })+ renderForm()++ await waitFor(() =>+ expect(transport.invoke).toHaveBeenCalledWith('query:getSettings')+ )+ await user.type(screen.getByRole('textbox'), 'https://a/profile.zip')+ await user.click(screen.getByRole('button', { name: /download/i }))++ await waitFor(() =>+ expect(transport.invoke).toHaveBeenCalledWith(+ 'command:createTask',+ expect.objectContaining({ connections: 32 })+ )+ )+ })+it('requires confirmation before creating a renamed torrent copy', async () => {const onSubmitSuccess = vi.fn()const user = userEvent.setup()diff --git a/src/renderer/components/add-task/add-task-form.tsx b/src/renderer/components/add-task/add-task-form.tsxindex 9828b7bf..01035906 100644--- a/src/renderer/components/add-task/add-task-form.tsx+++ b/src/renderer/components/add-task/add-task-form.tsx@@ -27,6 +27,7 @@ import {type TaskCreateCommandResult,type TaskCreateRequest,} from '@shared/schemas/add-task'+import { DEFAULT_ENGINE_SETTINGS } from '@shared/schemas/engine-settings'import { useCallback, useEffect, useRef, useState } from 'react'import {type DeepPartial,@@ -57,7 +58,7 @@ const BASE_DEFAULTS: DeepPartial<AddTaskFormValues> = {tab: 'links',urls: '',saveDir: '',- split: 5,+ split: DEFAULT_ENGINE_SETTINGS.split,}export function AddTaskForm({@@ -83,6 +84,11 @@ export function AddTaskForm({})const clipboardAutofillRequest = useRef(0)+ const hasExplicitSplitDefault = useRef(+ defaultValues !== undefined &&+ 'split' in defaultValues &&+ defaultValues.split !== undefined+ )// Read once for each actual open. The desktop add-task window is precreated// while hidden, so only its user-triggered SetAddTaskMode event starts a@@ -118,16 +124,15 @@ export function AddTaskForm({useExternalHydration(form, subscribeEvents, autofillClipboardLinks)- // Backfill saveDir from user settings when nothing populated it via- // URL params or an external hydration event. Without this the form- // starts with "" and silently fails Zod min(1) validation on submit.+ // Backfill settings that affect each new task. URL params or explicit+ // caller defaults retain precedence over this asynchronous hydration.useEffect(() => {- if (form.getValues('saveDir')) returnlet cancelled = false;(async () => {try {const settings = (await transport.invoke(Queries.GetSettings)) as {app?: { defaultSaveDir?: string }+ engine?: { split?: number }}const dir = settings?.app?.defaultSaveDirif (!cancelled && dir && !form.getValues('saveDir')) {@@ -135,8 +140,17 @@ export function AddTaskForm({shouldValidate: false,})}+ const split = settings?.engine?.split+ if (+ !cancelled &&+ !hasExplicitSplitDefault.current &&+ !form.getFieldState('split').isDirty &&+ typeof split === 'number'+ ) {+ form.setValue('split', split, { shouldValidate: false })+ }} catch {- // Best effort — user can still pick a folder manually.+ // Best effort — local defaults keep the form usable.}})()return () => {diff --git a/src/renderer/components/add-task/advanced-panel.tsx b/src/renderer/components/add-task/advanced-panel.tsxindex 2eb6596c..45db0d33 100644--- a/src/renderer/components/add-task/advanced-panel.tsx+++ b/src/renderer/components/add-task/advanced-panel.tsx@@ -15,6 +15,7 @@ import { Textarea } from '@renderer/components/ui/textarea'import { cn } from '@renderer/lib/utils'import { EXTERNAL_URLS } from '@shared/external-urls'import type { AddTaskFormValues } from '@shared/schemas/add-task'+import { DEFAULT_ENGINE_SETTINGS } from '@shared/schemas/engine-settings'import { ChevronRight, CircleQuestionMark } from 'lucide-react'import { type ReactNode, useLayoutEffect, useState } from 'react'import { useFormContext, useWatch } from 'react-hook-form'@@ -77,7 +78,7 @@ function LinksAdvancedFields() {type="number"min={1}max={128}- defaultValue={5}+ defaultValue={DEFAULT_ENGINE_SETTINGS.split}/><DenseFieldcontrol={control}diff --git a/src/renderer/components/add-task/use-external-hydration.test.ts b/src/renderer/components/add-task/use-external-hydration.test.tsindex 16d2cf5d..8e9653fa 100644--- a/src/renderer/components/add-task/use-external-hydration.test.ts+++ b/src/renderer/components/add-task/use-external-hydration.test.ts@@ -116,6 +116,33 @@ describe('useExternalHydration', () => {expect(values.urls).toBe('https://a/b')})+ it('SetAddTaskMode preserves the hydrated split setting', () => {+ const { result } = renderHook(() =>+ useForm({+ defaultValues: {+ tab: 'links',+ urls: '',+ saveDir: '/preset',+ split: 32,+ },+ })+ )+ renderHook(() =>+ useExternalHydration(+ result.current as unknown as UseFormReturn<AddTaskFormValues>,+ true+ )+ )++ act(() => {+ fire(Events.SetAddTaskMode, { mode: 'links', url: 'https://a/b' })+ })++ expect((result.current.getValues() as Record<string, unknown>).split).toBe(+ 32+ )+ })+it('notifies after SetAddTaskMode resets the form', () => {const { result } = renderHook(() =>useForm({diff --git a/src/renderer/components/add-task/use-external-hydration.ts b/src/renderer/components/add-task/use-external-hydration.tsindex 7e13ef1d..0895d746 100644--- a/src/renderer/components/add-task/use-external-hydration.ts+++ b/src/renderer/components/add-task/use-external-hydration.ts@@ -58,7 +58,10 @@ export function useExternalHydration(const onSetMode = (...args: unknown[]) => {const parsed = setAddTaskModeEventPayloadSchema.safeParse(args[0])if (!parsed.success) return- const defaults = urlParamsToFormDefaults(parsed.data)+ const defaults = {+ ...urlParamsToFormDefaults(parsed.data),+ split: form.getValues('split'),+ }// A mode switch without an explicit saveDir must not wipe whatever// is already in the field (e.g. the user's defaultSaveDir that the// form backfilled at mount). Symmetric to onProtocol below.diff --git a/src/renderer/components/file-list/file-list.test.tsx b/src/renderer/components/file-list/file-list.test.tsxindex e654ee35..f0c7bd5e 100644--- a/src/renderer/components/file-list/file-list.test.tsx+++ b/src/renderer/components/file-list/file-list.test.tsx@@ -59,6 +59,21 @@ describe('FileList', () => {expect(screen.getByText('subtitle.srt')).toBeDefined()})+ it('preserves bracketed file-name display order', () => {+ const path = '[aa1][bb2] cc3.ext'+ render(+ <FileList<TorrentFileInfo>+ files={[{ index: 0, path, size: 1, extension: '.ext' }]}+ selectedIndices={[]}+ onSelectionChange={vi.fn()}+ />+ )++ const fileName = screen.getByText(path)+ expect(fileName).toHaveAttribute('dir', 'auto')+ expect(fileName).not.toHaveClass('[direction:rtl]')+ })+it('calls onSelectionChange when toggling a file off', () => {const onSelectionChange = vi.fn()render(diff --git a/src/renderer/components/file-list/file-list.tsx b/src/renderer/components/file-list/file-list.tsxindex 296cbe64..ef0d3144 100644--- a/src/renderer/components/file-list/file-list.tsx+++ b/src/renderer/components/file-list/file-list.tsx@@ -120,7 +120,8 @@ export function FileList<T extends BaseFileRow = BaseFileRow>({aria-label={file.path}/><span- className="min-w-0 flex-1 truncate text-xs [direction:rtl] [text-align:left]"+ className="min-w-0 flex-1 truncate text-xs"+ dir="auto"title={file.path}>{file.path}diff --git a/src/renderer/hooks/use-task-files.test.ts b/src/renderer/hooks/use-task-files.test.tsindex 38cfe4a4..1586f748 100644--- a/src/renderer/hooks/use-task-files.test.ts+++ b/src/renderer/hooks/use-task-files.test.ts@@ -78,13 +78,44 @@ describe('useTaskFiles', () => {expect(transportMock.invoke).toHaveBeenCalledTimes(1)})+ it('refetches live files when the matching task updates', async () => {+ renderHook(() => useTaskFiles('t1', true))+ await waitFor(() => expect(transportMock.invoke).toHaveBeenCalledTimes(1))+ expect(transportMock.on).toHaveBeenCalledWith(+ Events.TaskUpdated,+ expect.any(Function)+ )++ act(() => {+ listeners.get(Events.TaskUpdated)?.forEach((cb) => {+ cb([{ id: 't1' }])+ })+ })++ await waitFor(() => expect(transportMock.invoke).toHaveBeenCalledTimes(2))+ })++ it('does not subscribe to task updates when live refresh is disabled', async () => {+ renderHook(() => useTaskFiles('t1'))+ await waitFor(() => expect(transportMock.invoke).toHaveBeenCalledTimes(1))++ expect(transportMock.on).not.toHaveBeenCalledWith(+ Events.TaskUpdated,+ expect.any(Function)+ )+ })+it('unsubscribes on unmount', async () => {- const { unmount } = renderHook(() => useTaskFiles('t1'))+ const { unmount } = renderHook(() => useTaskFiles('t1', true))await waitFor(() => expect(transportMock.on).toHaveBeenCalled())unmount()expect(transportMock.off).toHaveBeenCalledWith(Events.TaskFilesUpdated,expect.any(Function))+ expect(transportMock.off).toHaveBeenCalledWith(+ Events.TaskUpdated,+ expect.any(Function)+ )})})diff --git a/src/renderer/hooks/use-task-files.ts b/src/renderer/hooks/use-task-files.tsindex 55ae7a37..e5611883 100644--- a/src/renderer/hooks/use-task-files.ts+++ b/src/renderer/hooks/use-task-files.ts@@ -2,40 +2,66 @@ import { transport } from '@renderer/lib/transport'import { Events } from '@shared/protocol/events'import { Queries } from '@shared/protocol/queries'import type { TaskFile } from '@shared/types/task'-import { useCallback, useEffect, useState } from 'react'+import { useCallback, useEffect, useRef, useState } from 'react'interface TaskFilesUpdatedPayload {taskId: string}-export function useTaskFiles(taskId: string) {+export function useTaskFiles(taskId: string, live = false) {const [files, setFiles] = useState<TaskFile[]>([])const [loading, setLoading] = useState(true)+ const requestGeneration = useRef(0)- const fetchFiles = useCallback(async () => {- setLoading(true)- try {- const result = (await transport.invoke(- Queries.GetTaskFiles,- taskId- )) as TaskFile[]- setFiles(result)- } finally {- setLoading(false)- }- }, [taskId])+ const fetchFiles = useCallback(+ async (showLoading = true) => {+ const request = ++requestGeneration.current+ if (showLoading) setLoading(true)+ try {+ const result = (await transport.invoke(+ Queries.GetTaskFiles,+ taskId+ )) as TaskFile[]+ if (request !== requestGeneration.current) return+ setFiles(result)+ } finally {+ if (request === requestGeneration.current) {+ setLoading(false)+ }+ }+ },+ [taskId]+ )useEffect(() => {- void fetchFiles()const onUpdated = (...args: unknown[]) => {const payload = args[0] as TaskFilesUpdatedPayload | undefined- if (payload?.taskId === taskId) void fetchFiles()+ if (payload?.taskId === taskId) void fetchFiles(false)+ }+ const onTaskUpdated = (...args: unknown[]) => {+ const payload = args[0]+ if (+ !Array.isArray(payload) ||+ payload.some(+ (task) =>+ typeof task === 'object' &&+ task !== null &&+ 'id' in task &&+ task.id === taskId+ )+ ) {+ void fetchFiles(false)+ }}transport.on(Events.TaskFilesUpdated, onUpdated)+ if (live) transport.on(Events.TaskUpdated, onTaskUpdated)+ void fetchFiles()return () => {transport.off(Events.TaskFilesUpdated, onUpdated)+ if (live) transport.off(Events.TaskUpdated, onTaskUpdated)+ requestGeneration.current += 1}- }, [taskId, fetchFiles])+ }, [taskId, live, fetchFiles])- return { files, loading, refetch: fetchFiles }+ return { files, loading, refetch: () => fetchFiles(true) }}diff --git a/src/renderer/routes/downloads/inspector/files-tab.test.tsx b/src/renderer/routes/downloads/inspector/files-tab.test.tsxindex d851f1f2..5efc228c 100644--- a/src/renderer/routes/downloads/inspector/files-tab.test.tsx+++ b/src/renderer/routes/downloads/inspector/files-tab.test.tsx@@ -170,6 +170,35 @@ describe('FilesTab', () => {).not.toBeInTheDocument()})+ it('uses task progress for a live single-file BT torrent', () => {+ ;(useTaskFiles as unknown as ReturnType<typeof vi.fn>).mockReturnValue({+ files: [+ {+ index: 0,+ path: 'ubuntu-25.10-desktop-amd64.iso',+ size: 100,+ selected: true,+ completedBytes: 50,+ },+ ],+ loading: false,+ refetch: vi.fn(),+ })++ render(+ <FilesTab+ task={mockTask({+ status: TaskStatus.Downloading,+ progress: 0.53,+ fileCount: 1,+ })}+ />+ )++ expect(screen.getByText('53%')).toBeInTheDocument()+ expect(useTaskFiles).toHaveBeenCalledWith('t1', true)+ })+it('treats HTTP task as read-only regardless of file count', () => {;(useTaskFiles as unknown as ReturnType<typeof vi.fn>).mockReturnValue({files: [diff --git a/src/renderer/routes/downloads/inspector/files-tab.tsx b/src/renderer/routes/downloads/inspector/files-tab.tsxindex 59d1a78c..a164c158 100644--- a/src/renderer/routes/downloads/inspector/files-tab.tsx+++ b/src/renderer/routes/downloads/inspector/files-tab.tsx@@ -28,7 +28,8 @@ function arraysEqualSorted(a: number[], b: number[]): boolean {export function FilesTab({ task }: { task: DownloadTask }) {const { t } = useTranslation()- const { files } = useTaskFiles(task.id)+ const isActive = ACTIVE_DOWNLOAD.has(task.status)+ const { files } = useTaskFiles(task.id, isActive)const initial = task.bt?.selectedFiles ?? []const [draft, setDraft] = useState<number[]>(initial)// Single-file tasks (HTTP/FTP always; single-file BT/Magnet/Metalink) have@@ -58,9 +59,12 @@ export function FilesTab({ task }: { task: DownloadTask }) {onSelectionChange={isReadOnly ? undefined : setDraft}readOnly={isReadOnly}renderRowTrailing={(f) =>- ACTIVE_DOWNLOAD.has(task.status) ? (+ isActive ? (<span className="shrink-0 text-xs tabular-nums text-muted-foreground">- {Math.floor((f.completedBytes / Math.max(f.size, 1)) * 100)}%+ {files.length === 1+ ? Math.round(task.progress * 100)+ : Math.floor((f.completedBytes / Math.max(f.size, 1)) * 100)}+ %</span>) : null}diff --git a/src/renderer/routes/downloads/inspector/overview-tab.test.tsx b/src/renderer/routes/downloads/inspector/overview-tab.test.tsxindex 8fadb0b0..a0a56780 100644--- a/src/renderer/routes/downloads/inspector/overview-tab.test.tsx+++ b/src/renderer/routes/downloads/inspector/overview-tab.test.tsx@@ -8,10 +8,6 @@ vi.mock('@renderer/lib/transport', () => ({vi.mock('@renderer/lib/open-add-task-dialog', () => ({openAddTaskDialog: vi.fn().mockResolvedValue(undefined),}))-const { toastAddMock } = vi.hoisted(() => ({ toastAddMock: vi.fn() }))-vi.mock('@renderer/components/ui/toast', () => ({- toast: { add: toastAddMock, close: vi.fn() },-}))import '@renderer/lib/i18n'import { TooltipProvider } from '@renderer/components/ui/tooltip'@@ -140,12 +136,10 @@ describe('OverviewTab', () => {expect(screen.queryByText('3/8')).not.toBeInTheDocument()})- it('copies a magnet URI for the info hash', async () => {+ it('copies the raw info hash', async () => {renderOverviewTab(task)await userEvent.click(screen.getByRole('button'))- expect(navigator.clipboard.writeText).toHaveBeenCalledWith(- 'magnet:?xt=urn:btih:abc&dn=x'- )+ expect(navigator.clipboard.writeText).toHaveBeenCalledWith('abc')})describe('Error status', () => {diff --git a/src/renderer/routes/downloads/inspector/overview-tab.tsx b/src/renderer/routes/downloads/inspector/overview-tab.tsxindex b293a693..200741ea 100644--- a/src/renderer/routes/downloads/inspector/overview-tab.tsx+++ b/src/renderer/routes/downloads/inspector/overview-tab.tsx@@ -6,16 +6,13 @@ import {AlertTitle,} from '@renderer/components/ui/alert'import { Button } from '@renderer/components/ui/button'-import { toast } from '@renderer/components/ui/toast'import {Tooltip,TooltipContent,TooltipTrigger,} from '@renderer/components/ui/tooltip'-import { fetchTaskBtDetail } from '@renderer/hooks/use-task-bt-detail'import { resolveFailureReason } from '@renderer/lib/failure-reason'import { formatBytes, formatDurationHMS } from '@renderer/lib/format'-import { infoHashToMagnetUri } from '@renderer/lib/magnet'import type { DownloadTask } from '@shared/types/task'import { TaskStatus, TaskType } from '@shared/types/task'import { canAttemptRetry } from '@shared/types/task-actions'@@ -186,26 +183,7 @@ export function OverviewTab({ task }: { task: DownloadTask }) {<CopyButtonvariant="ghost"className="has-[>svg]:px-0 p-0 h-[18px] w-[18px] rounded-md [&_svg:not([class*='size-'])]:size-3"- content={async () => {- let detail: Awaited<ReturnType<typeof fetchTaskBtDetail>>- try {- detail = await fetchTaskBtDetail(task.id)- } catch (err) {- // Abort the copy (CopyButton skips the clipboard- // write on a rejected content) and say so — a- // tracker-less magnet copied "successfully" can be- // unusable for private torrents.- toast.add({- title: t('panel.downloads.action.copyUrlFailed'),- type: 'error',- })- throw err- }- return infoHashToMagnetUri(task.infoHash ?? '', {- name: task.name,- trackers: detail.announceList.flat(),- })- }}+ content={task.infoHash}/></div>}diff --git a/src/renderer/routes/settings/cards/network-dialog.test.tsx b/src/renderer/routes/settings/cards/network-dialog.test.tsxindex 9159d105..64e133dc 100644--- a/src/renderer/routes/settings/cards/network-dialog.test.tsx+++ b/src/renderer/routes/settings/cards/network-dialog.test.tsx@@ -177,4 +177,51 @@ describe('<NetworkDialog>', () => {expect(screen.getByDisplayValue('10.0.0.1')).toBeInTheDocument()})})++ it('disables download proxying when importing socks5', async () => {+ vi.mocked(transport.invoke).mockImplementation(async (channel: string) => {+ if (channel === Queries.GetSettings) {+ return {+ ...FIXTURE,+ proxy: {+ ...FIXTURE.proxy,+ enabled: true,+ scopes: { ...FIXTURE.proxy.scopes, download: true },+ },+ }+ }+ if (channel === Queries.GetSystemProxy) {+ return { protocol: 'socks5', host: '127.0.0.1', port: 1080 }+ }+ return { saved: true, requiresRestart: false, changedRestartKeys: [] }+ })++ render(+ <NetworkDialog+ open+ onClose={vi.fn()}+ labelKey="settings.cards.network.title"+ descKey="settings.cards.network.desc"+ />+ )++ const user = userEvent.setup()+ await user.click(+ await screen.findByRole('button', { name: /import from system/i })+ )++ await waitFor(() => {+ expect(+ screen.getByText(/does not support SOCKS5 proxies/i)+ ).toBeInTheDocument()+ expect(screen.getAllByRole('switch')[2]).toHaveAttribute(+ 'aria-disabled',+ 'true'+ )+ expect(screen.getAllByRole('switch')[2]).toHaveAttribute(+ 'aria-checked',+ 'false'+ )+ })+ })})diff --git a/src/renderer/routes/settings/cards/proxy-section.tsx b/src/renderer/routes/settings/cards/proxy-section.tsxindex e913969f..b5bfd64f 100644--- a/src/renderer/routes/settings/cards/proxy-section.tsx+++ b/src/renderer/routes/settings/cards/proxy-section.tsx@@ -61,6 +61,15 @@ export function ProxySection({ form }: { form: UseFormReturn<NetworkFields> }) {}, [userValue])const proxyEnabled = form.watch('proxy.enabled')+ const proxyProtocol = form.watch('proxy.protocol')+ const downloadProxyUnsupported = proxyProtocol === 'socks5'++ const updateProtocol = (protocol: ProxySettings['protocol']) => {+ form.setValue('proxy.protocol', protocol, { shouldDirty: true })+ if (protocol === 'socks5' && form.getValues('proxy.scopes.download')) {+ form.setValue('proxy.scopes.download', false, { shouldDirty: true })+ }+ }const handleAuthToggle = (checked: boolean) => {setShowAuth(checked)@@ -82,7 +91,7 @@ export function ProxySection({ form }: { form: UseFormReturn<NetworkFields> }) {})return}- form.setValue('proxy.protocol', detected.protocol, { shouldDirty: true })+ updateProtocol(detected.protocol)form.setValue('proxy.host', detected.host, { shouldDirty: true })form.setValue('proxy.port', detected.port, { shouldDirty: true })// Importing implies the user wants to USE this proxy; flip the master@@ -172,7 +181,7 @@ export function ProxySection({ form }: { form: UseFormReturn<NetworkFields> }) {<DropdownMenuRadioGroupvalue={protoField.value}onValueChange={(v) =>- protoField.onChange(+ updateProtocol(v as ProxySettings['protocol'])}@@ -328,12 +337,17 @@ export function ProxySection({ form }: { form: UseFormReturn<NetworkFields> }) {{t('settings.network.proxy.scopeDownload')}</FormLabel><FormDescription className="text-xs">- {t('settings.network.proxy.scopeDownloadDesc')}+ {t(+ downloadProxyUnsupported+ ? 'settings.network.proxy.scopeDownloadSocks5Unsupported'+ : 'settings.network.proxy.scopeDownloadDesc'+ )}</FormDescription></div><FormControl><Switchchecked={field.value}+ disabled={downloadProxyUnsupported}onCheckedChange={field.onChange}/></FormControl>diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.jsonindex f78fc41a..fb9a45e2 100644--- a/src/shared/locales/en-US.json+++ b/src/shared/locales/en-US.json@@ -1349,6 +1349,7 @@"scopesDesc": "Choose which kinds of traffic go through the proxy.","scopeDownload": "Downloads","scopeDownloadDesc": "Files fetched by the engine.",+ "scopeDownloadSocks5Unsupported": "The download engine does not support SOCKS5 proxies.","scopeUpdateApp": "App update check","scopeUpdateAppDesc": "Electron auto-updater HTTPS calls.","scopeUpdateTrackers": "Tracker sync",diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.jsonindex 7e4a40cb..5299c3e6 100644--- a/src/shared/locales/zh-CN.json+++ b/src/shared/locales/zh-CN.json@@ -1336,6 +1336,7 @@"scopesDesc": "选择哪些流量通过代理。","scopeDownload": "下载","scopeDownloadDesc": "由引擎下载的文件。",+ "scopeDownloadSocks5Unsupported": "下载引擎不支持 SOCKS5 代理。","scopeUpdateApp": "应用更新检查","scopeUpdateAppDesc": "Electron 自动更新检查的 HTTPS 请求。","scopeUpdateTrackers": "Tracker 同步",diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.jsonindex dc848349..dcdfbfc6 100644--- a/src/shared/locales/zh-TW.json+++ b/src/shared/locales/zh-TW.json@@ -1336,6 +1336,7 @@"scopesDesc": "選擇哪些流量要通過 Proxy。","scopeDownload": "下載","scopeDownloadDesc": "由引擎取得的檔案。",+ "scopeDownloadSocks5Unsupported": "下載引擎不支援 SOCKS5 Proxy。","scopeUpdateApp": "應用程式更新檢查","scopeUpdateAppDesc": "Electron 自動更新程式的 HTTPS 呼叫。","scopeUpdateTrackers": "Tracker 同步",diff --git a/src/shared/schemas/add-task.test.ts b/src/shared/schemas/add-task.test.tsindex 150fd705..31a3056e 100644--- a/src/shared/schemas/add-task.test.ts+++ b/src/shared/schemas/add-task.test.ts@@ -8,6 +8,7 @@ import {taskCreateRequestSchema,urlParamsToFormDefaults,} from './add-task'+import { DEFAULT_ENGINE_SETTINGS } from './engine-settings'describe('addTaskFormSchema', () => {it('accepts minimal links tab', () => {@@ -18,7 +19,7 @@ describe('addTaskFormSchema', () => {})expect(result.success).toBe(true)if (result.success && result.data.tab === 'links') {- expect(result.data.split).toBe(5)+ expect(result.data.split).toBe(DEFAULT_ENGINE_SETTINGS.split)}})diff --git a/src/shared/schemas/add-task.ts b/src/shared/schemas/add-task.tsindex 141bd5ff..cd494756 100644--- a/src/shared/schemas/add-task.ts+++ b/src/shared/schemas/add-task.ts@@ -1,4 +1,5 @@import { z } from 'zod'+import { DEFAULT_ENGINE_SETTINGS } from './engine-settings'const torrentFileSchema = z.object({index: z.number().int().nonnegative(),@@ -21,7 +22,12 @@ const linksTabSchema = z.object({urls: z.string().min(1, { message: 'task.add.errors.urlsRequired' }),saveDir: z.string().min(1, { message: 'task.add.errors.saveDirRequired' }),filename: z.string().optional(),- split: z.number().int().min(1).max(128).default(5),+ split: z+ .number()+ .int()+ .min(1)+ .max(128)+ .default(DEFAULT_ENGINE_SETTINGS.split),userAgent: z.string().optional(),referer: z.string().optional(),cookie: z.string().optional(),diff --git a/src/shared/schemas/proxy-settings.test.ts b/src/shared/schemas/proxy-settings.test.tsindex 226d8706..3d640771 100644--- a/src/shared/schemas/proxy-settings.test.ts+++ b/src/shared/schemas/proxy-settings.test.ts@@ -44,6 +44,14 @@ describe('proxySettingsSchema', () => {})})+ it('disables the unsupported download scope for socks5', () => {+ const r = proxySettingsSchema.parse({+ protocol: 'socks5',+ scopes: { download: true },+ })+ expect(r.scopes.download).toBe(false)+ })+it('truncates bypass list past max via fallback', () => {const long = Array.from({ length: 100 }, (_, i) => `host${i}`)expect(proxySettingsSchema.parse({ bypass: long }).bypass).toEqual([])diff --git a/src/shared/schemas/proxy-settings.ts b/src/shared/schemas/proxy-settings.tsindex dc977fa9..711d972f 100644--- a/src/shared/schemas/proxy-settings.ts+++ b/src/shared/schemas/proxy-settings.ts@@ -1,22 +1,31 @@import type { ProxySettings } from '@shared/types/settings'import { z } from 'zod'-export const proxySettingsSchema = z.object({- enabled: z.boolean().catch(false),- protocol: z.enum(['http', 'https', 'socks5']).catch('http'),- host: z.string().max(253).catch(''),- port: z.number().int().min(1).max(65535).catch(8080),- user: z.string().max(256).catch(''),- password: z.string().max(256).catch(''),- bypass: z.array(z.string().max(253)).max(64).catch([]),- scopes: z- .object({- download: z.boolean().catch(false),- updateApp: z.boolean().catch(false),- updateTrackers: z.boolean().catch(false),- })- .catch({ download: false, updateApp: false, updateTrackers: false }),-})+export const proxySettingsSchema = z+ .object({+ enabled: z.boolean().catch(false),+ protocol: z.enum(['http', 'https', 'socks5']).catch('http'),+ host: z.string().max(253).catch(''),+ port: z.number().int().min(1).max(65535).catch(8080),+ user: z.string().max(256).catch(''),+ password: z.string().max(256).catch(''),+ bypass: z.array(z.string().max(253)).max(64).catch([]),+ scopes: z+ .object({+ download: z.boolean().catch(false),+ updateApp: z.boolean().catch(false),+ updateTrackers: z.boolean().catch(false),+ })+ .catch({ download: false, updateApp: false, updateTrackers: false }),+ })+ .transform((settings) =>+ settings.protocol === 'socks5' && settings.scopes.download+ ? {+ ...settings,+ scopes: { ...settings.scopes, download: false },+ }+ : settings+ )export const DEFAULT_PROXY_SETTINGS: ProxySettings = proxySettingsSchema.parse({}diff --git a/tests/scripts/dev-cross-spawn.test.ts b/tests/scripts/dev-cross-spawn.test.tsnew file mode 100644index 00000000..61a3366c--- /dev/null+++ b/tests/scripts/dev-cross-spawn.test.ts@@ -0,0 +1,18 @@+import { readFileSync } from 'node:fs'+import path from 'node:path'+import { describe, expect, it } from 'vitest'++const ROOT = path.resolve(import.meta.dirname, '../..')++describe('development runner process spawning', () => {+ it('uses a direct cross-spawn dependency for Windows command resolution', () => {+ const source = readFileSync(path.join(ROOT, 'scripts/dev.mjs'), 'utf8')+ const packageJson = JSON.parse(+ readFileSync(path.join(ROOT, 'package.json'), 'utf8')+ ) as { devDependencies?: Record<string, string> }++ expect(source).toContain("import spawn from 'cross-spawn'")+ expect(source).not.toContain("from 'node:child_process'")+ expect(packageJson.devDependencies?.['cross-spawn']).toBe('^7.0.6')+ })+})diff --git a/tests/scripts/workflow-snap.test.ts b/tests/scripts/workflow-snap.test.tsindex 3603a8d8..a29d4bb8 100644--- a/tests/scripts/workflow-snap.test.ts+++ b/tests/scripts/workflow-snap.test.ts@@ -166,26 +166,24 @@ describe('Snap build workflow contract', () => {}})- it('publishes only protected stable tags through the edge environment', () => {+ it('publishes protected stable and beta tags through the edge environment', () => {const preflight = workflowJob(snapWorkflow, 'preflight')const preflightOutputs = asRecord(preflight.outputs, 'preflight outputs')const build = workflowJob(snapWorkflow, 'build')const publish = workflowJob(snapWorkflow, 'publish-edge')- const buildCondition = stringField(build, 'if')const condition = stringField(publish, 'if')const environment = asRecord(publish.environment, 'publish environment')- expect(stringField(preflightOutputs, 'prerelease')).toBe(- `\${{ steps.metadata.outputs.prerelease }}`- )- expect(buildCondition).toContain("github.event_name != 'push'")- expect(buildCondition).toContain(- "needs.preflight.outputs.prerelease == 'false'"+ expect(stringField(preflightOutputs, 'version')).toBe(+ `\${{ steps.metadata.outputs.version }}`)+ expect(build).not.toHaveProperty('if')expect(condition).toContain("github.event_name == 'push'")- expect(condition).toContain("needs.preflight.outputs.prerelease == 'false'")expect(condition).toContain("startsWith(github.ref, 'refs/tags/v')")expect(condition).toContain('github.ref_protected == true')+ expect(snapSource).not.toContain(+ "needs.preflight.outputs.prerelease == 'false'"+ )expect(stringField(environment, 'name')).toBe('snap-store-edge')expect(jobNeeds(publish)).toEqual(expect.arrayContaining(['preflight', 'build'])