A full-featured download manager.
fix(release): prepare beta.2 recovery (#1850)
Dr_rOot353c785ff7b2
diff --git a/.claude/rules/electron-vite.md b/.claude/rules/electron-vite.mdindex d381b99e..a89e7e76 100644--- a/.claude/rules/electron-vite.md+++ b/.claude/rules/electron-vite.md@@ -42,8 +42,10 @@ and packaged-file checks.hoisted` unless the Electron packaging smoke job proves isolated linkingworks.- Install-script permission is controlled by pnpm 11 `allowBuilds`. Keep- `electron` allowed: its install script supplies the runtime and license- payload required by packaging and legal checks.+ `electron` allowed for compatibility, but do not rely on `pnpm install` to+ hydrate Electron 43: it exposes `install.js` as a package bin without a+ `postinstall` script. Packaging and legal-check workflows must explicitly+ run `node node_modules/electron/install.js` before consuming `dist/`.- Native modules such as `better-sqlite3` must match the active ABI. Tests usethe Node ABI; Electron and E2E use the Electron ABI. Preserve the`ensure-native-abi.mjs` hooks when changing test or start scripts.diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 2efff78b..770f36be 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -45,10 +45,9 @@ jobs:MOTRIX_SKIP_ELECTRON_REBUILD: '1'MOTRIX_SKIP_ENGINE_FETCH: '1'- # pnpm's side-effects cache (default on) can reuse an electron store- # entry recorded while its build script was still blocked, leaving- # dist/ absent after install. The notice contract needs dist/LICENSE;- # this is idempotent and near-instant when dist/ already matches.+ # Electron 43 has no package postinstall, so pnpm install does not+ # hydrate dist/. The notice contract needs the runtime license payload;+ # the package installer is idempotent when dist/ already matches.- name: Ensure Electron runtime payloadrun: node node_modules/electron/install.js@@ -143,6 +142,7 @@ jobs:tests/scripts/native-binary-target.test.tstests/scripts/obsidian-docs.test.tstests/scripts/release-metadata.test.ts+ tests/scripts/release-version-contract.test.tstests/scripts/snap-artifact.test.tstests/scripts/snap-build-set-release.test.tstests/scripts/snap-project.test.ts@@ -346,8 +346,8 @@ jobs:env:MOTRIX_SKIP_ENGINE_FETCH: '1'- # Same side-effects-cache guard as the ci job: build:legal and the- # electron-builder smoke both need electron's dist/ payload.+ # Electron 43 does not hydrate dist/ during pnpm install. build:legal+ # and the electron-builder smoke both require that runtime payload.- name: Ensure Electron runtime payloadrun: node node_modules/electron/install.jsdiff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.ymlindex 6f846590..40225e15 100644--- a/.github/workflows/flatpak.yml+++ b/.github/workflows/flatpak.yml@@ -143,9 +143,9 @@ jobs:retention-days: 1# The install above is --ignore-scripts by design (offline-source- # verification), so electron's postinstall never runs here. The notice- # contract needs electron's dist/ payload (dist/LICENSE +- # dist/LICENSES.chromium.html) — fetch it explicitly.+ # verification), and Electron 43 has no package postinstall to hydrate+ # dist/ anyway. The notice contract needs dist/LICENSE and+ # dist/LICENSES.chromium.html, so fetch the runtime explicitly.- name: Fetch Electron runtime for the notice contractrun: node node_modules/electron/install.jsdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex aa981dbd..4b2167d5 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -209,6 +209,11 @@ jobs:# Fetching the package target is explicit in the next step.MOTRIX_SKIP_ENGINE_FETCH: '1'+ # Electron 43 does not declare a postinstall script, so pnpm install+ # does not hydrate dist/ with the runtime and license payload.+ - name: Ensure Electron runtime payload+ run: node node_modules/electron/install.js+- name: Fetch target aria2run: >-pnpm run fetch:enginediff --git a/.github/workflows/snap.yml b/.github/workflows/snap.ymlindex 43632b85..5901bdb6 100644--- a/.github/workflows/snap.yml+++ b/.github/workflows/snap.yml@@ -156,9 +156,8 @@ jobs:env:MOTRIX_SKIP_ENGINE_FETCH: '1'- # Same side-effects-cache guard as the ci job: pnpm can reuse an- # electron store entry recorded while its build script was blocked,- # leaving dist/ absent. The notice contract needs dist/LICENSE.+ # Electron 43 does not declare a postinstall script, so pnpm install+ # does not hydrate dist/ with the runtime and license payload.- name: Ensure Electron runtime payloadrun: node node_modules/electron/install.js@@ -278,23 +277,62 @@ jobs:EXPECTED_VERSION: ${{ needs.preflight.outputs.version }}run: |set -euo pipefail- shopt -s nullglob- snaps=(release/snap-upload/*.snap)- if (( ${#snaps[@]} != 2 )); then- echo "Expected exactly two Snap artifacts, found ${#snaps[@]}" >&2+ download_root='release/snap-upload'+ verified_root='release/snap-verified'+ downloaded_snaps=()+ while IFS= read -r -d '' snap; do+ downloaded_snaps+=("$snap")+ done < <(find "$download_root" -name '*.snap' -print0)+ if (( ${#downloaded_snaps[@]} != 2 )); then+ echo "Expected exactly two Snap artifacts, found ${#downloaded_snaps[@]}" >&2exit 1fi+ if [[ -e "$verified_root" || -L "$verified_root" ]]; then+ echo "Verified Snap staging path already exists" >&2+ exit 1+ fi+ mkdir "$verified_root"+ first_basename=''for arch in amd64 arm64; do- matches=(release/snap-upload/*_"${arch}".snap)+ arch_root="${download_root}/snap-${arch}"+ if [[ ! -d "$arch_root" ]]; then+ echo "Missing downloaded ${arch} artifact directory" >&2+ exit 1+ fi+ matches=()+ while IFS= read -r -d '' snap; do+ matches+=("$snap")+ done < <(find "$arch_root" -type f -name '*.snap' -print0)if (( ${#matches[@]} != 1 )); thenecho "Expected exactly one ${arch} Snap artifact" >&2exit 1fi+ snap="${matches[0]}"+ basename="$(basename "$snap")"+ if [[ -n "$first_basename" && "$basename" == "$first_basename" ]]; then+ echo "Duplicate Snap artifact basename: $basename" >&2+ exit 1+ fi+ first_basename="$basename"+ if [[ ! "$basename" =~ _${arch}\.snap$ ]]; then+ echo "Unexpected ${arch} Snap artifact name: $basename" >&2+ exit 1+ finode scripts/verify-snap-artifact.mjs \- --snap "${matches[0]}" \+ --snap "$snap" \--arch "$arch" \--version "$EXPECTED_VERSION"+ install -m 0644 -- \+ "$snap" "${verified_root}/motrix_verified_${arch}.snap"done+ verified_snaps=()+ while IFS= read -r -d '' snap; do+ verified_snaps+=("$snap")+ done < <(find "$verified_root" -type f -name '*.snap' -print0)+ if (( ${#verified_snaps[@]} != 2 )); then+ echo "Expected exactly two verified Snap artifacts" >&2+ exit 1+ fi- name: Install Snapcraft 9timeout-minutes: 10@@ -322,18 +360,13 @@ jobs:shell: bashrun: |set -euo pipefail- shopt -s nullglob- snaps=(release/snap-upload/*.snap)declare -A revisions- for snap in "${snaps[@]}"; do- case "$(basename "$snap")" in- *_amd64.snap) arch='amd64' ;;- *_arm64.snap) arch='arm64' ;;- *)- echo "Cannot determine architecture from $snap" >&2- exit 1- ;;- esac+ for arch in amd64 arm64; do+ snap="release/snap-verified/motrix_verified_${arch}.snap"+ if [[ ! -f "$snap" || -L "$snap" ]]; then+ echo "Missing verified ${arch} Snap artifact" >&2+ exit 1+ fiupload_log="${RUNNER_TEMP}/snap-upload-${arch}.log"LC_ALL=C.UTF-8 snapcraft upload "$snap" 2>&1 | tee "$upload_log"revisions["$arch"]="$(diff --git a/README.md b/README.mdindex 3892a7dc..36434762 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. Download-[v2.0.0-beta.1 from GitHub Releases](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.1)-and read the [full release notes](./docs/release-notes/2.0.0-beta.1.md)+[v2.0.0-beta.2 from GitHub Releases](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.2)+and read the [full release notes](./docs/release-notes/2.0.0-beta.2.md)before installing it.Back up your existing Motrix data and downloads before testing. Migration from@@ -146,7 +146,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.1'+export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.2'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 85d1e6eb..06f2a17c 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.1](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.1),-并阅读[完整发布说明](./docs/release-notes/2.0.0-beta.1.zh-CN.md)。+下载 [v2.0.0-beta.2](https://github.com/agalwood/Motrix/releases/tag/v2.0.0-beta.2),+并阅读[完整发布说明](./docs/release-notes/2.0.0-beta.2.zh-CN.md)。测试前请备份现有 Motrix 数据和下载文件。Motrix v1 数据的迁移路径尚未经过验证,请勿让本 beta 使用您唯一一份 v1 数据。条件允许时,建议通过独立的系统@@ -141,7 +141,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.1'+export MOTRIX_IMAGE='docker.io/motrixapp/motrix-server:2.0.0-beta.2'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.1.md b/docs/release-notes/2.0.0-beta.1.mdindex bd3beb42..87235b48 100644--- a/docs/release-notes/2.0.0-beta.1.md+++ b/docs/release-notes/2.0.0-beta.1.md@@ -1,10 +1,18 @@# Motrix 2.0.0-beta.1-English | [简体中文](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.1/docs/release-notes/2.0.0-beta.1.zh-CN.md)+English | [简体中文](./2.0.0-beta.1.zh-CN.md)-Motrix 2.0.0-beta.1 is the first public beta of Motrix Turbo, the rebuilt v2-desktop app and headless server. It starts public validation of the shared-download core, MDXP integrations, and sandboxed plugin system.+> [!IMPORTANT]+> This release attempt did not complete. Both tag-triggered pipelines stopped+> before external distribution, so beta.1 has no GitHub Release, R2 update+> feed, Docker Hub or GHCR image, or Snap Store revision. Use+> [Motrix 2.0.0-beta.2](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.2/docs/release-notes/2.0.0-beta.2.md)+> instead. The remaining sections are retained as a historical record of the+> intended beta.1 scope.++Motrix 2.0.0-beta.1 was intended to be the first public beta of Motrix Turbo,+the rebuilt v2 desktop app and headless server. Its planned scope covered the+shared download core, MDXP integrations, and sandboxed plugin system.## Highlights@@ -19,7 +27,7 @@ download core, MDXP integrations, and sandboxed plugin system.- A QuickJS plugin sandbox with capability consent, signed builtin plugins,and an in-app plugin marketplace.- Persistent, multi-architecture Server containers for NAS and home-server- deployments, published to both Docker Hub and GHCR.+ deployments, with publication planned for Docker Hub and GHCR.- A rebuilt release pipeline with isolated macOS signing, optional WindowsAuthenticode signing, package verification, third-party notices, and an SPDXSBOM.@@ -42,9 +50,9 @@ important downloads.plugins- Headless Server deployment, persistent storage, and remote pairing-## Available downloads+## Intended downloads (not published)-| Distribution | Architectures | Published output |+| Distribution | Architectures | Intended output ||--------------|---------------|------------------|| macOS 12 or later | `arm64` (Apple Silicon), `x64` (Intel) | DMG and ZIP || Windows | `x64` | NSIS installer (`.exe`) and ZIP |@@ -52,9 +60,9 @@ important downloads.| Docker Hub / GHCR | `linux/amd64`, `linux/arm64` | Immutable `2.0.0-beta.1` tag in both registries || Snap Store | `amd64`, `arm64` | `latest/edge` |-Container images are available as+The planned container image names were`docker.io/motrixapp/motrix-server:2.0.0-beta.1` and-`ghcr.io/agalwood/motrix-server:2.0.0-beta.1`. See the+`ghcr.io/agalwood/motrix-server:2.0.0-beta.1`; they were not published. See the[Docker Server deployment guide](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.1/docs/docker-server.md)for storage, networking, and upgrade guidance.@@ -63,9 +71,9 @@ for storage, networking, and upgrade guidance.- AppImage is not published for this beta.- Flatpak is validated separately and is not published by the release tag.- Windows `arm64` and all 32-bit packages are not available.-- Windows packages in this beta are not Authenticode-signed and may trigger a- Windows SmartScreen warning. Download them only from this official GitHub- release.+- The intended Windows packages would not have been Authenticode-signed and+ could have triggered a Windows SmartScreen warning. No beta.1 Windows+ package was published.- Beta container tags are immutable and do not update `latest`, `stable`, orother stable floating tags.diff --git a/docs/release-notes/2.0.0-beta.1.zh-CN.md b/docs/release-notes/2.0.0-beta.1.zh-CN.mdindex c85b7a39..084a26d9 100644--- a/docs/release-notes/2.0.0-beta.1.zh-CN.md+++ b/docs/release-notes/2.0.0-beta.1.zh-CN.md@@ -1,10 +1,17 @@# Motrix 2.0.0-beta.1-[English](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.1/docs/release-notes/2.0.0-beta.1.md) | 简体中文+[English](./2.0.0-beta.1.md) | 简体中文-Motrix 2.0.0-beta.1 是 Motrix Turbo 的首个公开 beta,包含重新开发的 v2-桌面应用和 Headless server。该版本开始公开验证共用下载内核、MDXP 集成和-沙箱化插件系统。+> [!IMPORTANT]+> 本次发布尝试未完成:两条由 tag 触发的流水线均在对外分发前停止,+> 因此 beta.1 没有 GitHub Release、R2 更新数据源、Docker Hub 或 GHCR+> 镜像,也没有 Snap Store revision。请改用+> [Motrix 2.0.0-beta.2](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.2/docs/release-notes/2.0.0-beta.2.zh-CN.md)。+> 下文仅作为 beta.1 原定范围的历史记录保留。++Motrix 2.0.0-beta.1 原计划作为 Motrix Turbo 的首个公开 beta,其原定范围+包含重新开发的 v2 桌面应用和 Headless server、共用下载内核、MDXP 集成+和沙箱化插件系统。## 主要变化@@ -16,7 +23,7 @@ Motrix 2.0.0-beta.1 是 Motrix Turbo 的首个公开 beta,包含重新开发- 官方 CLI 和浏览器任务交接统一使用 MDXP,并支持本地安全发现及远程 Server的 device-code 配对。- 提供带能力授权的 QuickJS 插件沙箱、已签名的内置插件和应用内插件市场。-- 面向 NAS 和家庭服务器提供持久化、多架构 Server 容器,并同时发布到+- 面向 NAS 和家庭服务器提供持久化、多架构 Server 容器,原计划同时发布到Docker Hub 与 GHCR。- 重建发布流水线,隔离 macOS 签名步骤、支持可选的 Windows Authenticode签名,并加入安装包验证、第三方声明和 SPDX SBOM。@@ -35,9 +42,9 @@ Motrix 2.0.0-beta.1 是 Motrix Turbo 的首个公开 beta,包含重新开发- 桌面集成、通过 MDXP 进行的浏览器和 CLI 任务交接,以及沙箱化插件- Headless Server 部署、数据持久化和远程配对-## 可用下载+## 原计划下载(未发布)-| 发布方式 | 架构 | 发布产物 |+| 发布方式 | 架构 | 原计划产物 ||----------|------|----------|| macOS 12 或更高版本 | `arm64`(Apple Silicon)、`x64`(Intel) | DMG 和 ZIP || Windows | `x64` | NSIS 安装包(`.exe`)和 ZIP |@@ -45,8 +52,8 @@ Motrix 2.0.0-beta.1 是 Motrix Turbo 的首个公开 beta,包含重新开发| Docker Hub / GHCR | `linux/amd64`、`linux/arm64` | 两个 registry 中均发布不可变 tag `2.0.0-beta.1` || Snap Store | `amd64`、`arm64` | `latest/edge` |-容器镜像地址为 `docker.io/motrixapp/motrix-server:2.0.0-beta.1` 和-`ghcr.io/agalwood/motrix-server:2.0.0-beta.1`。数据持久化、网络和升级方法请参阅+原计划的容器镜像地址为 `docker.io/motrixapp/motrix-server:2.0.0-beta.1` 和+`ghcr.io/agalwood/motrix-server:2.0.0-beta.1`,但它们并未发布。数据持久化、网络和升级方法请参阅[Docker Server 部署指南](../docker-server.zh-CN.md)。## 已知发布限制@@ -54,8 +61,8 @@ Motrix 2.0.0-beta.1 是 Motrix Turbo 的首个公开 beta,包含重新开发- 本 beta 不发布 AppImage。- Flatpak 会单独验证,不会随该版本 tag 发布。- 不提供 Windows `arm64` 和任何 32 位安装包。-- 本 beta 的 Windows 安装包未进行 Authenticode 签名,可能触发 Windows- SmartScreen 警告。请仅从此 GitHub 官方 Release 下载。+- 原计划的 Windows 安装包不会进行 Authenticode 签名,因而可能触发+ Windows SmartScreen 警告。beta.1 实际并未发布 Windows 安装包。- Beta 容器 tag 不可变,不会更新 `latest`、`stable` 或其他稳定版浮动 tag。## 反馈diff --git a/docs/release-notes/2.0.0-beta.2.md b/docs/release-notes/2.0.0-beta.2.mdnew file mode 100644index 00000000..894623f3--- /dev/null+++ b/docs/release-notes/2.0.0-beta.2.md@@ -0,0 +1,90 @@+# Motrix 2.0.0-beta.2++English | [简体中文](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.2/docs/release-notes/2.0.0-beta.2.zh-CN.md)++Motrix 2.0.0-beta.2 is the first Motrix Turbo beta intended for public+distribution. It begins public validation of the rebuilt v2 desktop app and+headless server, shared download core, MDXP integrations, and sandboxed plugin+system.++The `v2.0.0-beta.1` tag started the protected release paths, but both+tag-triggered pipelines stopped before external distribution. It created no+GitHub Release, R2 update feed, Docker Hub or GHCR container image, or Snap+Store revision. This beta.2 release supersedes it.++## Release recovery fixes++- Corrected Electron runtime dependency hydration so the packaged desktop app+ contains the runtime modules required when it launches.+- Corrected Snap artifact staging so the tag pipeline can verify and publish+ the exact `amd64` and `arm64` build outputs.++## Highlights++- A ground-up desktop rebuild with Electron 43, React 19, and TypeScript 7,+ including a customizable Dashboard, dark mode, a cross-platform application+ menu, and clearer task-inspector feedback.+- One host-neutral download core for both the desktop app and the new Node/Web+ Server, with SQLite session recovery, tracker management, UPnP/NAT-PMP, and+ HTTP, FTP, BitTorrent, and magnet support.+- MDXP-based integration for the official CLI and browser handoff, including+ secure local discovery and device-code pairing for remote Server instances.+- A QuickJS plugin sandbox with capability consent, signed builtin plugins,+ and an in-app plugin marketplace.+- Persistent, multi-architecture Server containers for NAS and home-server+ deployments, published to both Docker Hub and GHCR.+- A rebuilt release pipeline with isolated macOS signing, optional Windows+ Authenticode signing, package verification, third-party notices, and an SPDX+ SBOM.++## Before testing++This is prerelease software. Back up your 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. Please do not rely on this beta for your only copy of+important downloads.++## What to test++- HTTP, FTP, BitTorrent, and magnet downloads, including pause/resume and+ session recovery+- Desktop integrations, browser and CLI handoff through MDXP, and sandboxed+ plugins+- Headless Server deployment, persistent storage, and remote pairing++## Available downloads++| Distribution | Architectures | Published output |+|--------------|---------------|------------------|+| macOS 12 or later | `arm64` (Apple Silicon), `x64` (Intel) | DMG and ZIP |+| Windows | `x64` | NSIS installer (`.exe`) and ZIP |+| Linux | `x64`, `arm64` | DEB and RPM |+| Docker Hub / GHCR | `linux/amd64`, `linux/arm64` | Immutable `2.0.0-beta.2` tag in both registries |+| Snap Store | `amd64`, `arm64` | `latest/edge` |++Container images are available as+`docker.io/motrixapp/motrix-server:2.0.0-beta.2` and+`ghcr.io/agalwood/motrix-server:2.0.0-beta.2`. See the+[Docker Server deployment guide](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.2/docs/docker-server.md)+for storage, networking, and upgrade guidance.++## Known distribution limits++- AppImage is not published for this beta.+- Flatpak is validated separately and is not published by the release tag.+- Windows `arm64` and all 32-bit packages are not available.+- Windows packages in this beta are not Authenticode-signed and may trigger a+ Windows SmartScreen warning. Download them only from this official GitHub+ release.+- Beta container tags are immutable and do not update `latest`, `stable`, or+ other stable floating tags.++## 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.2.zh-CN.md b/docs/release-notes/2.0.0-beta.2.zh-CN.mdnew file mode 100644index 00000000..fee71302--- /dev/null+++ b/docs/release-notes/2.0.0-beta.2.zh-CN.md@@ -0,0 +1,76 @@+# Motrix 2.0.0-beta.2++[English](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.2/docs/release-notes/2.0.0-beta.2.md) | 简体中文++Motrix 2.0.0-beta.2 是首个计划对外发布的 Motrix Turbo beta。+该版本开始公开验证重新开发的 v2 桌面应用与 Headless server、共用下载+内核、MDXP 集成和沙箱化插件系统。++`v2.0.0-beta.1` tag 触发了受保护的发布路径,但两条由 tag 触发的+流水线都在对外分发前停止。beta.1 未创建 GitHub Release,也未发布 R2+更新数据源、Docker Hub 或 GHCR 容器镜像及 Snap Store revision。本 beta.2+版本取代 beta.1。++## 发布恢复修复++- 修正 Electron runtime 依赖的补全流程,确保打包后的桌面应用包含启动时所需+ 的 runtime module。+- 修正 Snap 产物的 staging 流程,使 tag 流水线能够验证并发布确定的+ `amd64` 和 `arm64` 构建产物。++## 主要变化++- 使用 Electron 43、React 19 和 TypeScript 7 从头重建桌面应用,提供可自定义+ Dashboard、深色模式、跨平台应用菜单,以及更清晰的任务检查器反馈。+- 桌面应用和全新的 Node/Web Server 共用与宿主无关的下载内核,支持 SQLite+ session 恢复、Tracker 管理、UPnP/NAT-PMP,以及 HTTP、FTP、BitTorrent 和+ 磁力链接下载。+- 官方 CLI 和浏览器任务交接统一使用 MDXP,并支持本地安全发现及远程 Server+ 的 device-code 配对。+- 提供带能力授权的 QuickJS 插件沙箱、已签名的内置插件和应用内插件市场。+- 面向 NAS 和家庭服务器提供持久化、多架构 Server 容器,并同时发布到+ Docker Hub 与 GHCR。+- 重建发布流水线,隔离 macOS 签名步骤、支持可选的 Windows Authenticode+ 签名,并加入安装包验证、第三方声明和 SPDX SBOM。++## 测试前须知++这是预发布软件。安装前请备份现有 Motrix 应用数据和下载文件。Motrix v1+数据的迁移路径尚未经过验证,请勿让本 beta 使用您唯一一份 v1 数据。++条件允许时,建议通过独立的系统账户、设备或 Docker 数据目录与现有环境+并行测试 v2。请勿让本 beta 成为重要下载文件的唯一存储位置。++## 建议测试项++- HTTP、FTP、BitTorrent 和磁力链接下载,包括暂停/继续与 session 恢复+- 桌面集成、通过 MDXP 进行的浏览器和 CLI 任务交接,以及沙箱化插件+- Headless Server 部署、数据持久化和远程配对++## 可用下载++| 发布方式 | 架构 | 发布产物 |+|----------|------|----------|+| macOS 12 或更高版本 | `arm64`(Apple Silicon)、`x64`(Intel) | DMG 和 ZIP |+| Windows | `x64` | NSIS 安装包(`.exe`)和 ZIP |+| Linux | `x64`、`arm64` | DEB 和 RPM |+| Docker Hub / GHCR | `linux/amd64`、`linux/arm64` | 两个 registry 中均发布不可变 tag `2.0.0-beta.2` |+| Snap Store | `amd64`、`arm64` | `latest/edge` |++容器镜像地址为 `docker.io/motrixapp/motrix-server:2.0.0-beta.2` 和+`ghcr.io/agalwood/motrix-server:2.0.0-beta.2`。数据持久化、网络和升级方法请参阅+[Docker Server 部署指南](https://github.com/agalwood/Motrix/blob/v2.0.0-beta.2/docs/docker-server.zh-CN.md)。++## 已知发布限制++- 本 beta 不发布 AppImage。+- Flatpak 会单独验证,不会随该版本 tag 发布。+- 不提供 Windows `arm64` 和任何 32 位安装包。+- 本 beta 的 Windows 安装包未进行 Authenticode 签名,可能触发 Windows+ SmartScreen 警告。请仅从此 GitHub 官方 Release 下载。+- Beta 容器 tag 不可变,不会更新 `latest`、`stable` 或其他稳定版浮动 tag。++## 反馈++请通过 [GitHub Issues](https://github.com/agalwood/Motrix/issues) 报告可复现的问题,+并附上操作系统、架构、安装包类型和复现步骤。diff --git a/flatpak/app.motrix.native.metainfo.xml b/flatpak/app.motrix.native.metainfo.xmlindex e5ff88db..5c0cf04a 100644--- a/flatpak/app.motrix.native.metainfo.xml+++ b/flatpak/app.motrix.native.metainfo.xml@@ -76,13 +76,13 @@<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" date="2026-05-07">+ <release version="2.0.0-beta.2" date="2026-08-15"><description><p>- Initial Motrix Turbo release. Rewritten on Electron 43, Vite 8,- React 19, TypeScript 7 and Zod 4. Hardened native module ABI- handling and sqlite-backed session persistence replace the legacy- aria2 control file.+ First Motrix Turbo beta intended for public distribution. Rewritten+ on Electron 43, Vite 8, React 19, TypeScript 7 and Zod 4, with+ corrected Electron runtime dependency hydration and Snap artifact+ staging.</p></description></release>diff --git a/package.json b/package.jsonindex 7ed2c010..1adb4a0d 100644--- a/package.json+++ b/package.json@@ -3,7 +3,7 @@"type": "module","productName": "Motrix","homepage": "https://motrix.app",- "version": "2.0.0-beta.1",+ "version": "2.0.0-beta.2","packageManager": "[email protected]+sha512.521705bce689924eac72f5a3587122f362689ef6571e55ba80076fd637c11132ecffada26fad4ea79c485bfddbfd3d5a2a5b05805a77e893de71ec8a6cca3bb1","description": "A full-featured download manager","keywords": [],diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 821b94ce..3f31c148 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -10,9 +10,9 @@ nodeLinker: hoisted# pnpm 11 build-script gate (replaces onlyBuiltDependencies /# ignoredBuiltDependencies — packages not listed have their scripts skipped):-# - electron: postinstall downloads dist/ — the runtime binary plus-# dist/LICENSE and dist/LICENSES.chromium.html, required by build:legal,-# check:third-party-notices, and electron-builder.+# - electron: retained for compatibility with releases that expose an+# install script. Electron 43 only exposes install.js as a package bin, so+# packaging and legal-check workflows must hydrate dist/ explicitly.# - better-sqlite3: native module rebuilt against the pinned ABI.# - electron-winstaller / esbuild: harmless arch-selection scripts, allowed# to keep installs warning-free (esbuild binaries ship via @esbuild/*diff --git a/tests/scripts/release-version-contract.test.ts b/tests/scripts/release-version-contract.test.tsnew file mode 100644index 00000000..878acd58--- /dev/null+++ b/tests/scripts/release-version-contract.test.ts@@ -0,0 +1,112 @@+import { readFileSync } from 'node:fs'+import path from 'node:path'+import { describe, expect, it } from 'vitest'+// @ts-expect-error -- JavaScript release script intentionally has no declarations+import { resolveReleaseMetadata } from '../../scripts/release-metadata.mjs'++const ROOT = path.resolve(import.meta.dirname, '../..')++function read(relativePath: string): string {+ return readFileSync(path.join(ROOT, relativePath), 'utf8')+}++const packageVersion = (JSON.parse(read('package.json')) as { version: string })+ .version+const releaseTag = `v${packageVersion}`++describe('release version contract', () => {+ it('keeps package metadata, server fallback, and Flatpak metadata aligned', () => {+ expect(+ resolveReleaseMetadata({+ eventName: 'workflow_dispatch',+ refName: 'main',+ refProtected: 'false',+ packageVersion,+ }).version+ ).toBe(packageVersion)++ const serverSource = read('src/server/index.ts')+ expect(serverSource).toContain(+ "import packageJson from '../../package.json' with { type: 'json' }"+ )+ expect(serverSource).toContain(+ 'process.env.MOTRIX_APP_VERSION ?? packageJson.version'+ )++ const metainfo = read('flatpak/app.motrix.native.metainfo.xml')+ const latestRelease =+ /<release version="([^"]+)" date="(\d{4}-\d{2}-\d{2})">/.exec(metainfo)+ expect(latestRelease?.[1]).toBe(packageVersion)+ expect(latestRelease?.[2]).toMatch(/^\d{4}-\d{2}-\d{2}$/)+ })++ it('advertises only the current release in both READMEs', () => {+ for (const [readmePath, notesPath] of [+ ['README.md', `docs/release-notes/${packageVersion}.md`],+ ['README.zh-CN.md', `docs/release-notes/${packageVersion}.zh-CN.md`],+ ] as const) {+ const source = read(readmePath)+ expect(source).toContain(+ `https://github.com/agalwood/Motrix/releases/tag/${releaseTag}`+ )+ expect(source).toContain(`./${notesPath}`)+ expect(source).toContain(+ `docker.io/motrixapp/motrix-server:${packageVersion}`+ )+ }+ })++ it('ships paired, tag-pinned notes for the current version', () => {+ const englishPath = `docs/release-notes/${packageVersion}.md`+ const chinesePath = `docs/release-notes/${packageVersion}.zh-CN.md`+ const english = read(englishPath)+ const chinese = read(chinesePath)++ expect(english).toContain(`# Motrix ${packageVersion}`)+ expect(chinese).toContain(`# Motrix ${packageVersion}`)+ expect(english).toContain(+ `https://github.com/agalwood/Motrix/blob/${releaseTag}/${chinesePath}`+ )+ expect(chinese).toContain(+ `https://github.com/agalwood/Motrix/blob/${releaseTag}/${englishPath}`+ )+ })++ it('preserves beta.2 recovery and distribution disclosures', () => {+ const betaVersion = '2.0.0-beta.2'+ const betaTag = `v${betaVersion}`+ const english = read(`docs/release-notes/${betaVersion}.md`)+ const chinese = read(`docs/release-notes/${betaVersion}.zh-CN.md`)++ expect(english).toContain(+ `https://github.com/agalwood/Motrix/blob/${betaTag}/docs/docker-server.md`+ )+ expect(chinese).toContain(+ `https://github.com/agalwood/Motrix/blob/${betaTag}/docs/docker-server.zh-CN.md`+ )++ for (const source of [english, chinese]) {+ expect(source).toContain(`motrix-server:${betaVersion}`)+ expect(source).toContain('v2.0.0-beta.1')+ expect(source).toContain('GitHub Release')+ expect(source).toContain('R2')+ expect(source).toContain('Snap')+ expect(source).toContain('AppImage')+ expect(source).toContain('Authenticode')+ expect(source).toContain('SmartScreen')+ }+ })++ it('marks beta.1 as an unpublished attempt superseded by beta.2', () => {+ const english = read('docs/release-notes/2.0.0-beta.1.md')+ const chinese = read('docs/release-notes/2.0.0-beta.1.zh-CN.md')++ expect(english).toContain('This release attempt did not complete')+ expect(english).toContain('Intended downloads (not published)')+ expect(chinese).toContain('本次发布尝试未完成')+ expect(chinese).toContain('原计划下载(未发布)')+ for (const source of [english, chinese]) {+ expect(source).toContain('v2.0.0-beta.2')+ }+ })+})diff --git a/tests/scripts/workflow-release-matrix.test.ts b/tests/scripts/workflow-release-matrix.test.tsindex f131dbf4..deee2198 100644--- a/tests/scripts/workflow-release-matrix.test.ts+++ b/tests/scripts/workflow-release-matrix.test.ts@@ -358,6 +358,29 @@ describe('CI and release target matrix contract', () => {})+ it('hydrates the Electron runtime after install and before the release notice gate', () => {+ const steps = jobSteps(targetMatrix(releaseWorkflow).job)+ const dependencyIndex = steps.findIndex(+ (step) => step.name === 'Install dependencies'+ )+ const electronIndex = steps.findIndex(+ (step) => step.name === 'Ensure Electron runtime payload'+ )+ const noticeIndex = steps.findIndex(+ (step) => step.name === 'Third-party notice contract'+ )++ expect(dependencyIndex).toBeGreaterThanOrEqual(0)+ expect(electronIndex).toBeGreaterThan(dependencyIndex)+ expect(noticeIndex).toBeGreaterThan(electronIndex)+ expect(stringField(steps[electronIndex] as LooseRecord, 'run')).toBe(+ 'node node_modules/electron/install.js'+ )+ expect(stringField(steps[noticeIndex] as LooseRecord, 'run')).toBe(+ 'pnpm run check:third-party-notices'+ )+ })+it('keeps the release assembler on the same target set', () => {expect(RELEASE_TARGETS.map((target: { name: string }) => target.name).sort()diff --git a/tests/scripts/workflow-snap.test.ts b/tests/scripts/workflow-snap.test.tsindex b147e115..a85552c1 100644--- a/tests/scripts/workflow-snap.test.ts+++ b/tests/scripts/workflow-snap.test.ts@@ -1,5 +1,15 @@-import { readFileSync } from 'node:fs'+import { spawnSync } from 'node:child_process'+import {+ chmodSync,+ mkdirSync,+ mkdtempSync,+ readdirSync,+ readFileSync,+ rmSync,+ writeFileSync,+} from 'node:fs'import { createRequire } from 'node:module'+import { tmpdir } from 'node:os'import path from 'node:path'import { describe, expect, it } from 'vitest'@@ -207,18 +217,18 @@ describe('Snap build workflow contract', () => {expect(steps.indexOf(inspectionTools as LooseRecord)).toBeLessThan(steps.indexOf(completeness as LooseRecord))- expect(stringField(completeness as LooseRecord, 'run')).toContain(- `\${#snaps[@]} != 2`- )- expect(stringField(completeness as LooseRecord, 'run')).toContain(- 'for arch in amd64 arm64'- )+ const completenessCommand = stringField(completeness as LooseRecord, 'run')+ expect(completenessCommand).toContain('for arch in amd64 arm64')+ expect(completenessCommand).toContain('scripts/verify-snap-artifact.mjs')const uploadEnvironment = asRecord(upload?.env, 'upload environment')expect(stringField(uploadEnvironment, 'SNAPCRAFT_STORE_CREDENTIALS')).toContain('secrets.SNAPCRAFT_STORE_CREDENTIALS')const uploadCommand = stringField(upload as LooseRecord, 'run')+ expect(uploadCommand).toContain(+ `release/snap-verified/motrix_verified_\${arch}.snap`+ )expect(uploadCommand).toContain('snapcraft upload "$snap"')expect(uploadCommand).not.toContain('--release')expect(uploadCommand).toContain('matchAll(/\\bRevision')@@ -251,6 +261,141 @@ describe('Snap build workflow contract', () => {expect(stringField(recordInputs, 'name')).toContain('github.run_attempt')expect(stringField(recordInputs, 'path')).toContain('SNAP_REVISION_FILE')})++ it('normalizes the real nested artifact layout into one exact verified set', () => {+ const fixture = createSnapUploadFixture()+ try {+ writeNestedSnap(+ fixture.root,+ 'amd64',+ 'motrix_2.0.0-beta.2_amd64.snap',+ 'amd64-payload'+ )+ writeNestedSnap(+ fixture.root,+ 'arm64',+ 'motrix_2.0.0-beta.2_arm64.snap',+ 'arm64-payload'+ )+ const reportDirectory = path.join(+ fixture.root,+ 'release',+ 'snap-upload',+ 'size-reports'+ )+ mkdirSync(reportDirectory, { recursive: true })+ writeFileSync(path.join(reportDirectory, 'linux-x64.json'), '{}')++ const result = runSnapSetVerification(fixture)++ expect(result.status, result.stderr).toBe(0)+ const verifiedDirectory = path.join(+ fixture.root,+ 'release',+ 'snap-verified'+ )+ expect(readdirSync(verifiedDirectory).sort()).toEqual([+ 'motrix_verified_amd64.snap',+ 'motrix_verified_arm64.snap',+ ])+ expect(+ readFileSync(+ path.join(verifiedDirectory, 'motrix_verified_amd64.snap'),+ 'utf8'+ )+ ).toBe('amd64-payload')+ expect(+ readFileSync(+ path.join(verifiedDirectory, 'motrix_verified_arm64.snap'),+ 'utf8'+ )+ ).toBe('arm64-payload')+ expect(+ readFileSync(fixture.verificationLog, 'utf8').trim().split('\n')+ ).toEqual([+ 'scripts/verify-snap-artifact.mjs --snap release/snap-upload/snap-amd64/motrix_2.0.0-beta.2_amd64.snap --arch amd64 --version 2.0.0-beta.2',+ 'scripts/verify-snap-artifact.mjs --snap release/snap-upload/snap-arm64/motrix_2.0.0-beta.2_arm64.snap --arch arm64 --version 2.0.0-beta.2',+ ])+ } finally {+ rmSync(fixture.root, { recursive: true, force: true })+ }+ })++ it.each([+ {+ label: 'a missing architecture',+ prepare(root: string) {+ writeNestedSnap(+ root,+ 'amd64',+ 'motrix_2.0.0-beta.2_amd64.snap',+ 'amd64'+ )+ },+ error: /Expected exactly two Snap artifacts, found 1/,+ },+ {+ label: 'an extra Snap',+ prepare(root: string) {+ writeNestedSnap(+ root,+ 'amd64',+ 'motrix_2.0.0-beta.2_amd64.snap',+ 'amd64'+ )+ writeNestedSnap(+ root,+ 'arm64',+ 'motrix_2.0.0-beta.2_arm64.snap',+ 'arm64'+ )+ writeFileSync(+ path.join(root, 'release', 'snap-upload', 'unexpected.snap'),+ 'extra'+ )+ },+ error: /Expected exactly two Snap artifacts, found 3/,+ },+ {+ label: 'a duplicate basename',+ prepare(root: string) {+ for (const arch of ['amd64', 'arm64'] as const) {+ writeNestedSnap(root, arch, 'motrix_2.0.0-beta.2_amd64.snap', arch)+ }+ },+ error: /Duplicate Snap artifact basename/,+ },+ {+ label: 'an architecture-mismatched name',+ prepare(root: string) {+ writeNestedSnap(+ root,+ 'amd64',+ 'motrix_2.0.0-beta.2_amd64.snap',+ 'amd64'+ )+ writeNestedSnap(+ root,+ 'arm64',+ 'motrix_2.0.0-beta.2_s390x.snap',+ 'arm64'+ )+ },+ error: /Unexpected arm64 Snap artifact name/,+ },+ ])('rejects $label before upload', ({ prepare, error }) => {+ const fixture = createSnapUploadFixture()+ try {+ prepare(fixture.root)++ const result = runSnapSetVerification(fixture)++ expect(result.status).not.toBe(0)+ expect(result.stderr).toMatch(error)+ } finally {+ rmSync(fixture.root, { recursive: true, force: true })+ }+ })})describe('Snap promotion workflow contract', () => {@@ -377,6 +522,60 @@ describe('Snap promotion workflow contract', () => {})})+interface SnapUploadFixture {+ root: string+ verificationLog: string+}++function createSnapUploadFixture(): SnapUploadFixture {+ const root = mkdtempSync(path.join(tmpdir(), 'motrix-snap-workflow-'))+ const binaryDirectory = path.join(root, 'bin')+ const verificationLog = path.join(root, 'verification.log')+ const nodeStub = path.join(binaryDirectory, 'node')+ mkdirSync(binaryDirectory, { recursive: true })+ mkdirSync(path.join(root, 'release', 'snap-upload'), { recursive: true })+ writeFileSync(+ nodeStub,+ [+ '#!/usr/bin/env bash',+ 'set -euo pipefail',+ `printf '%s\\n' "$*" >> "$VERIFY_LOG"`,+ '',+ ].join('\n')+ )+ chmodSync(nodeStub, 0o755)+ return { root, verificationLog }+}++function writeNestedSnap(+ root: string,+ arch: 'amd64' | 'arm64',+ name: string,+ contents: string+): void {+ const directory = path.join(root, 'release', 'snap-upload', `snap-${arch}`)+ mkdirSync(directory, { recursive: true })+ writeFileSync(path.join(directory, name), contents)+}++function runSnapSetVerification(fixture: SnapUploadFixture) {+ const completeness = jobSteps(workflowJob(snapWorkflow, 'publish-edge')).find(+ (step) => step.name === 'Verify complete upload set'+ )+ const command = stringField(completeness as LooseRecord, 'run')+ const binaryDirectory = path.join(fixture.root, 'bin')+ return spawnSync('bash', ['-c', command], {+ cwd: fixture.root,+ encoding: 'utf8',+ env: {+ ...process.env,+ EXPECTED_VERSION: '2.0.0-beta.2',+ PATH: `${binaryDirectory}:${process.env.PATH ?? ''}`,+ VERIFY_LOG: fixture.verificationLog,+ },+ })+}+function asRecord(value: unknown, label: string): LooseRecord {if (value === null || typeof value !== 'object' || Array.isArray(value)) {throw new TypeError(`${label} must be an object`)