Skip to content

A full-featured download manager.

fix(bridge): submit task cookies with aria2 motrix.13 (#2073)

Dr_rOot649090787fba
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4bf263e3..f7457ac9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -548,6 +548,7 @@ jobs:
run: >-
pnpm exec vitest run
src/core/engine/aria2/engine-websocket-contract.integration.test.ts
+ src/core/bridge-receiver/task-cookies.integration.test.ts
--reporter=verbose
- name: Upload Electron size report
diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
index 98b930fc..4660a041 100644
--- a/.github/workflows/flatpak.yml
+++ b/.github/workflows/flatpak.yml
@@ -303,7 +303,7 @@ jobs:
-path "*/native-messaging-hosts/*" \
\) -print -quit)"
output="$("$aria2c" --version)"
- printf "%s\n" "$output" | grep -qF "aria2 version 1.37.0-motrix.12"
+ printf "%s\n" "$output" | grep -qF "aria2 version 1.37.0-motrix.13"
printf "%s\n" "$output" | grep -qF "Async DNS"
printf "%s\n" "$output" | grep -qF "BitTorrent"
printf "%s\n" "$output" | grep -qF "HTTPS"
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 9292431d..8a58b46e 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -83,8 +83,8 @@ must obtain permission or replace the font before distributing the build.
Desktop builds bundle an `aria2c` executable pinned by
`scripts/engine.lock.json`:
-- **Version:** 1.37.0-motrix.12
-- **Source:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.12>
+- **Version:** 1.37.0-motrix.13
+- **Source:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.13>
- **License:** GNU General Public License v2.0 or later (`GPL-2.0-or-later`)
- **Full license text:** `THIRD_PARTY_LICENSES/aria2-COPYING`
- **OpenSSL exception / notice:**
diff --git a/THIRD_PARTY_NOTICES.zh-CN.md b/THIRD_PARTY_NOTICES.zh-CN.md
index 0250bc54..22260fe3 100644
--- a/THIRD_PARTY_NOTICES.zh-CN.md
+++ b/THIRD_PARTY_NOTICES.zh-CN.md
@@ -71,8 +71,8 @@ src/renderer/routes/settings/icons/[email protected]
桌面版随应用打包 `aria2c` 可执行文件,版本由 `scripts/engine.lock.json` 固定:
-- **版本:** 1.37.0-motrix.12
-- **对应源码:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.12>
+- **版本:** 1.37.0-motrix.13
+- **对应源码:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.13>
- **许可证:** GNU General Public License v2.0 or later(`GPL-2.0-or-later`)
- **完整许可证文本:** `THIRD_PARTY_LICENSES/aria2-COPYING`
- **OpenSSL 例外条款 / 声明:**
diff --git a/flatpak/app.motrix.native.yml b/flatpak/app.motrix.native.yml
index 17c0f4b9..066eb32e 100644
--- a/flatpak/app.motrix.native.yml
+++ b/flatpak/app.motrix.native.yml
@@ -101,7 +101,7 @@ modules:
set -e
output="$(src/aria2c --version)"
printf '%s\n' "$output"
- printf '%s\n' "$output" | grep -qF 'aria2 version 1.37.0-motrix.12'
+ printf '%s\n' "$output" | grep -qF 'aria2 version 1.37.0-motrix.13'
for feature in \
'Async DNS' \
'BitTorrent' \
@@ -123,8 +123,8 @@ modules:
sources:
- type: git
url: https://github.com/motrixapp/aria2.git
- tag: v1.37.0-motrix.12
- commit: c9143bbf9c16f8c8563e41e7da2a23face4d5a8c
+ tag: v1.37.0-motrix.13
+ commit: 45efd7372e17724e5a902e1b114972570fec11db
x-checker-data:
type: git
tag-pattern: ^v([\d.]+-motrix\.\d+)$
@@ -136,9 +136,9 @@ modules:
commands:
- |
sed -i -E \
- 's/AC_INIT\(\[aria2\],\[[^]]+\]/AC_INIT([aria2],[1.37.0-motrix.12]/' \
+ 's/AC_INIT\(\[aria2\],\[[^]]+\]/AC_INIT([aria2],[1.37.0-motrix.13]/' \
configure.ac
- grep -qF 'AC_INIT([aria2],[1.37.0-motrix.12]' configure.ac
+ grep -qF 'AC_INIT([aria2],[1.37.0-motrix.13]' configure.ac
- type: script
dest-filename: autogen.sh
commands:
diff --git a/scripts/engine.lock.json b/scripts/engine.lock.json
index 346b7c61..30a7d21c 100644
--- a/scripts/engine.lock.json
+++ b/scripts/engine.lock.json
@@ -1,50 +1,50 @@
{
"engine": "aria2",
"repo": "motrixapp/aria2",
- "tag": "v1.37.0-motrix.12",
- "version": "1.37.0-motrix.12",
+ "tag": "v1.37.0-motrix.13",
+ "version": "1.37.0-motrix.13",
"assets": {
"darwin-arm64": {
- "file": "aria2c-1.37.0-motrix.12-darwin-arm64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.13-darwin-arm64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "2840fff685b167363dc28d7abe0fa2494b37612e843f50bc800c82d1a8e6abf9",
- "binarySha256": "3cea06e46cb96e97fd5415606238bc829c5a96114d58539aacb613f3ab1d162c"
+ "archiveSha256": "260f071ed35e505fad022a5ad3cf483a15c06c2aefa5890c3a23aa5d7dae4ab3",
+ "binarySha256": "fecc91561445c5b4d778661cd863a29b37e6a20ff3ff4fcf8d68737aee7c61bd"
},
"darwin-x64": {
- "file": "aria2c-1.37.0-motrix.12-darwin-x64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.13-darwin-x64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "52cc4394cd16b7bcdcbf10bc8922419f616ca53dec490b1f488c21e5361d270e",
- "binarySha256": "596a46cb2fca72cf5a5ded79e3a31eb339ad7e76a5f1b5d8c5362e2ca5945c8b"
+ "archiveSha256": "f2fcab27cb94fdb1f572e7e249037aeaa89a57ddca0e42329cf134f3bc5fe199",
+ "binarySha256": "d7f223a6b37c6244f081369474c09cd8b3abc5ce4688697c8441a4234cb9d120"
},
"win32-x64": {
- "file": "aria2c-1.37.0-motrix.12-win32-x64.zip",
+ "file": "aria2c-1.37.0-motrix.13-win32-x64.zip",
"bin": "aria2c.exe",
- "archiveSha256": "223e1a8bb1ae09e757d101dbf1eb1ff4c966cc18e94533f83c2f7107cd516804",
- "binarySha256": "1939e4c95851f9f5e4164bbcf5a5d81bfee7fa31b1cd9c689e97c2e1faaa4cff"
+ "archiveSha256": "6067a33dd74a8463ca41d035f643752e335fd4f73fae4dad08bdb4941c42c024",
+ "binarySha256": "e87a1b7e9fcfc83cca8627d7c5839c6b4b4e14d30b1a74c762c81ddf98c4cafc"
},
"win32-ia32": {
- "file": "aria2c-1.37.0-motrix.12-win32-ia32.zip",
+ "file": "aria2c-1.37.0-motrix.13-win32-ia32.zip",
"bin": "aria2c.exe",
- "archiveSha256": "e918f01f62a430d2528fba10ce739d253cec2b53cc307fbf7768be755e397e81",
- "binarySha256": "894cb58d526efdafba67b56e41c58effacfb683b107e3386b7cecb0a5c6b888a"
+ "archiveSha256": "05ead6c515a3f0a9ab845d53d51af6b04581f51a6c624d3ed16e4f0a50578e23",
+ "binarySha256": "f31a2b8f2c20f0547e6603954ac8dafbf915ea547d70ac292af67396bfb3669c"
},
"linux-x64": {
- "file": "aria2c-1.37.0-motrix.12-linux-x64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.13-linux-x64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "01154ab255bb4313339bd63091e4ddb21996c23fe8fb0ee59d24a2f44b490b16",
- "binarySha256": "5028997089de58841858ba91532775d90f2198dbaa58b835d4ca637d768df176"
+ "archiveSha256": "30e66a069bcb5123b3c61036f375b4f665a867c2fae461952c8a6087ab35c0c8",
+ "binarySha256": "1eaeb5550f65b8aa0a1074d86e6739ecf0e89e1f9df850b41df9ec90ae747d3b"
},
"linux-arm64": {
- "file": "aria2c-1.37.0-motrix.12-linux-arm64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.13-linux-arm64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "3d585e05cfcbdf206b9ef77a5374b8430525a6b108973adca8e7a92548e98f8a",
- "binarySha256": "1b63459a9939fde39c31937c03b2ef07a614c0b3851a82d70b92569b175df1b3"
+ "archiveSha256": "f9225da9bd7d761758d5affc8152a5bac8f5802c388e44750e2ea4f99a736ffc",
+ "binarySha256": "9ad331def5d7e26ca0d8c3207d4991fe27154de996314ebf1b8143232b42fe66"
},
"linux-arm": {
- "file": "aria2c-1.37.0-motrix.12-linux-armv7l.tar.gz",
+ "file": "aria2c-1.37.0-motrix.13-linux-armv7l.tar.gz",
"bin": "aria2c",
- "archiveSha256": "d3c6c511a04041b992e5805a1047fd4a2f5725c0969a28d00c67bf00f99c8cfb",
- "binarySha256": "f3d824ad203cbdfea462177df49ca1202bf3cd75035be5554712d3b9c4aebc11"
+ "archiveSha256": "9b8002bcd434bd9d1d084bb30192284bf02ed76cd21d0b3280bb429b3d75c3af",
+ "binarySha256": "a01d1cde937c27450f6ee854db95765475d3b1a409b1f74c11703b0971d31747"
}
}
}
diff --git a/scripts/verify-flatpak-packaging.mjs b/scripts/verify-flatpak-packaging.mjs
index 33dd5404..a22dbd26 100644
--- a/scripts/verify-flatpak-packaging.mjs
+++ b/scripts/verify-flatpak-packaging.mjs
@@ -18,8 +18,8 @@ export const FLATPAK_BUILDER_TOOLS_COMMIT =
// tag resolves to is pinned by hand (and cross-checked against the manifest).
export const ARIA2_SOURCE = Object.freeze({
url: 'https://github.com/motrixapp/aria2.git',
- // v1.37.0-motrix.12 — current Motrix aria2 fork release
- commit: 'c9143bbf9c16f8c8563e41e7da2a23face4d5a8c',
+ // v1.37.0-motrix.13 — current Motrix aria2 fork release
+ commit: '45efd7372e17724e5a902e1b114972570fec11db',
})
const PNPM_SOURCE = Object.freeze({
diff --git a/src/core/bridge-receiver/bridge-receiver.test.ts b/src/core/bridge-receiver/bridge-receiver.test.ts
index 6a98dbd9..2abefacf 100644
--- a/src/core/bridge-receiver/bridge-receiver.test.ts
+++ b/src/core/bridge-receiver/bridge-receiver.test.ts
@@ -1,6 +1,3 @@
-import { mkdtemp, rm } from 'node:fs/promises'
-import { tmpdir } from 'node:os'
-import { join } from 'node:path'
import { NOOP_TASK_ACTIVITY_RECORDER } from '@core/activity'
import type { SegmentAria2 } from '@core/download/segment-downloader'
import { TaskManager } from '@core/task/task-manager'
@@ -9,7 +6,7 @@ import { Events } from '@shared/protocol/events'
import type { DownloadTask } from '@shared/types/task'
import { TaskStatus } from '@shared/types/task'
import { makeDownloadTask } from '@test-utils/task'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
import { BridgeReceiver } from './bridge-receiver'
/** Minimal fake SegmentAria2 — never actually called in routing tests. */
@@ -26,7 +23,6 @@ function fakeDeps(
over: Partial<ConstructorParameters<typeof BridgeReceiver>[0]> = {}
) {
return {
- dataDir: '',
defaultSaveDir: '/tmp/save',
pickName: async (_d: string, n: string) => n,
createTask: vi.fn(async () => ({ gid: 'gid-1', taskId: 'task-abc' })),
@@ -57,16 +53,8 @@ function fakeDeps(
}
describe('BridgeReceiver', () => {
- let dataDir: string
- beforeEach(async () => {
- dataDir = await mkdtemp(join(tmpdir(), 'bridge-recv-'))
- })
- afterEach(async () => {
- await rm(dataDir, { recursive: true, force: true })
- })
-
it('handle: direct submit returns taskId and calls createTask', async () => {
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
const result = await r.handle(
{
@@ -101,7 +89,6 @@ describe('BridgeReceiver', () => {
// touch ONLY the coordinator.
const removeTask = vi.fn(async () => {})
const deps = fakeDeps({
- dataDir,
removeTask,
ffmpegBinaryPath: '/usr/bin/ffmpeg', // construct the media coordinator
})
@@ -122,7 +109,7 @@ describe('BridgeReceiver', () => {
// download/submit is extension-only. The agent-facing gate already keeps a
// cli off this method at the unary layer; this is the defense-in-depth
// guard so the receiver never reads extensionId/browser off a cli identity.
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
await expect(
r.handle(
@@ -152,7 +139,7 @@ describe('BridgeReceiver', () => {
})
it('start: subscribes to EventBus.TaskUpdated', () => {
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
r.start()
expect(deps.eventBus.on).toHaveBeenCalled()
@@ -162,7 +149,7 @@ describe('BridgeReceiver', () => {
// Regression for the discovered Plan 02 bug: Events.TaskUpdated carries
// taskManager.getAll() (an array), and TaskCompleted/TaskFailed are never
// emitted on the core bus — so the WS push must iterate + derive.
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
r.start()
const listener = (
@@ -202,14 +189,14 @@ describe('BridgeReceiver', () => {
// The deps.removeTask now takes the MDXP taskId (== DownloadTask.id)
// directly; the core removeTask action also keys by task.id, so the
// identity round-trips end-to-end without a gid lookup.
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
await r.cancel('task-abc')
expect(deps.removeTask).toHaveBeenCalledWith('task-abc')
})
it('stop: unsubscribes the same TaskUpdated listener it registered', () => {
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
r.start()
const onListener = (
@@ -223,14 +210,14 @@ describe('BridgeReceiver', () => {
})
it('restoreInflight: no-op', async () => {
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
await r.restoreInflight()
})
it('routes a magnet submit to a bt createTask', async () => {
const createTask = vi.fn(async () => ({ gid: 'g', taskId: 'mt1' }))
- const deps = fakeDeps({ dataDir, createTask })
+ const deps = fakeDeps({ createTask })
const receiver = new BridgeReceiver(deps as never)
const out = await receiver.handle(
{
@@ -309,7 +296,7 @@ describe('BridgeReceiver', () => {
} as never
it('hls submit throws unsupported-kind when ffmpegBinaryPath is null', async () => {
- const deps = fakeDeps({ dataDir, ffmpegBinaryPath: null })
+ const deps = fakeDeps({ ffmpegBinaryPath: null })
const r = new BridgeReceiver(deps as never)
await expect(r.handle(hlsSubmitParams, extCtx)).rejects.toMatchObject({
name: 'BridgeReceiverError',
@@ -326,7 +313,7 @@ describe('BridgeReceiver', () => {
container: 'mp4' as const,
},
}
- const deps = fakeDeps({ dataDir, ffmpegBinaryPath: null })
+ const deps = fakeDeps({ ffmpegBinaryPath: null })
const r = new BridgeReceiver(deps as never)
await expect(r.handle(dashParams, extCtx)).rejects.toMatchObject({
name: 'BridgeReceiverError',
@@ -335,7 +322,7 @@ describe('BridgeReceiver', () => {
})
it('mux submit throws unsupported-kind when ffmpegBinaryPath is null', async () => {
- const deps = fakeDeps({ dataDir, ffmpegBinaryPath: null })
+ const deps = fakeDeps({ ffmpegBinaryPath: null })
const r = new BridgeReceiver(deps as never)
await expect(r.handle(muxSubmitParams, extCtx)).rejects.toMatchObject({
name: 'BridgeReceiverError',
@@ -364,7 +351,6 @@ describe('BridgeReceiver', () => {
// MediaTaskCoordinator mkdtemp + makeDownloader injection.
// Simplest offline approach: spy on the dispatch method post-construction.
const deps = fakeDeps({
- dataDir,
ffmpegBinaryPath: '/usr/bin/ffmpeg',
fetchManifest: stubFetchManifest,
taskManager: new TaskManager(),
@@ -393,7 +379,6 @@ describe('BridgeReceiver', () => {
it('mux submit routes to MuxPipeline.dispatch when ffmpegBinaryPath is set', async () => {
const deps = fakeDeps({
- dataDir,
ffmpegBinaryPath: '/usr/bin/ffmpeg',
fetchManifest: vi.fn(async () => ''),
taskManager: new TaskManager(),
@@ -458,7 +443,6 @@ describe('BridgeReceiver', () => {
}))
const deps = fakeDeps({
- dataDir,
ffmpegBinaryPath: '/usr/bin/ffmpeg',
fetchManifest: vi.fn(async () => ''),
taskManager: new TaskManager(),
@@ -516,7 +500,6 @@ describe('BridgeReceiver', () => {
}))
const picked: string[] = []
const deps = fakeDeps({
- dataDir,
ffmpegBinaryPath: '/usr/bin/ffmpeg',
fetchManifest: vi.fn(async () => ''),
taskManager: new TaskManager(),
@@ -551,7 +534,6 @@ describe('BridgeReceiver', () => {
const resolveToMux = vi.fn(async (_url: string) => null)
const deps = fakeDeps({
- dataDir,
resolveToMux,
})
const r = new BridgeReceiver(deps as never)
@@ -570,7 +552,7 @@ describe('BridgeReceiver', () => {
it('resolveToMux absent (undefined) falls through to direct dispatch (full no-regression)', async () => {
// When resolveToMux is not set at all, direct submit proceeds as before
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
const result = await r.handle(directParams, extCtx)
@@ -660,7 +642,7 @@ describe('BridgeReceiver', () => {
it('direct submit with cookies → resolveToMux called with serialized cookie header as 2nd arg', async () => {
const resolveToMux = vi.fn(async () => null)
- const deps = fakeDeps({ dataDir, resolveToMux })
+ const deps = fakeDeps({ resolveToMux })
const r = new BridgeReceiver(deps as never)
await r.handle(bilibiliPageParams, extCtx)
expect(resolveToMux).toHaveBeenCalledWith(
@@ -681,7 +663,7 @@ describe('BridgeReceiver', () => {
},
},
}
- const deps = fakeDeps({ dataDir, resolveToMux })
+ const deps = fakeDeps({ resolveToMux })
const r = new BridgeReceiver(deps as never)
await r.handle(paramsNoCookies, extCtx)
// 2nd arg should be undefined (empty cookies → no cookie forwarding)
@@ -728,12 +710,12 @@ describe('BridgeReceiver', () => {
resolveCreate = r
})
)
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
const p1 = r.handle(submitParams('key-aaaaaaaa'), extCtx)
const p2 = r.handle(submitParams('key-aaaaaaaa'), extCtx)
- // createTask is reached only after the async adapt (cookie-jar write);
+ // createTask is reached only after asynchronous name selection;
// wait for the first dispatch to arrive there before releasing it.
await vi.waitFor(() => expect(createTask).toHaveBeenCalled())
resolveCreate({ gid: 'g', taskId: 'task-1' })
@@ -749,7 +731,7 @@ describe('BridgeReceiver', () => {
gid: 'g',
taskId: `task-${++n}`,
}))
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
const r1 = await r.handle(submitParams('key-bbbbbbbb'), extCtx)
@@ -764,7 +746,7 @@ describe('BridgeReceiver', () => {
gid: 'g',
taskId: `task-${++n}`,
}))
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
const r1 = await r.handle(submitParams('key-cccccccc'), extCtx)
@@ -778,7 +760,7 @@ describe('BridgeReceiver', () => {
.fn()
.mockRejectedValueOnce(new Error('engine down'))
.mockResolvedValueOnce({ gid: 'g', taskId: 'task-retry' })
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
await expect(
@@ -795,7 +777,7 @@ describe('BridgeReceiver', () => {
gid: 'g',
taskId: `task-${++n}`,
}))
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
await r.handle(submitParams(), extCtx)
@@ -812,7 +794,7 @@ describe('BridgeReceiver', () => {
.fn()
.mockImplementationOnce(() => first)
.mockImplementation(async () => ({ gid: 'g', taskId: 'quick' }))
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
const pending = r.handle(submitParams('key-pending-000'), extCtx)
@@ -844,7 +826,7 @@ describe('BridgeReceiver', () => {
gid: 'g',
taskId: `task-${++n}`,
}))
- const deps = fakeDeps({ dataDir, createTask: createTask as never })
+ const deps = fakeDeps({ createTask: createTask as never })
const r = new BridgeReceiver(deps as never)
const otherCtx = {
identity: {
@@ -896,7 +878,6 @@ describe('BridgeReceiver', () => {
})
const createTask = vi.fn(async () => ({ gid: 'g', taskId: 'task-abc' }))
const deps = fakeDeps({
- dataDir,
createTask: createTask as never,
waitForReady: () => gate,
} as never)
@@ -904,7 +885,7 @@ describe('BridgeReceiver', () => {
const pending = r.handle(directParams(), extCtx)
// Drain a few macrotask turns — without the gate the dispatch would
- // have reached createTask by now (adapt's cookie-jar write is the
+ // have reached createTask by now (adapt's name selection is the
// only other async step).
await new Promise((res) => setTimeout(res, 10))
expect(createTask).not.toHaveBeenCalled()
@@ -916,7 +897,7 @@ describe('BridgeReceiver', () => {
})
it('dispatches immediately when no gate is wired (back-compat)', async () => {
- const deps = fakeDeps({ dataDir })
+ const deps = fakeDeps()
const r = new BridgeReceiver(deps as never)
const result = await r.handle(directParams(), extCtx)
expect(result.taskId).toBe('task-abc')
diff --git a/src/core/bridge-receiver/bridge-receiver.ts b/src/core/bridge-receiver/bridge-receiver.ts
index dd7d7f79..23a7c29e 100644
--- a/src/core/bridge-receiver/bridge-receiver.ts
+++ b/src/core/bridge-receiver/bridge-receiver.ts
@@ -53,7 +53,6 @@ export function serializeCookieHeader(
}
export interface BridgeReceiverDeps {
- dataDir: string
defaultSaveDir: string
pickName: AdapterDeps['pickName']
createTask: ConstructorParameters<typeof DirectPipeline>[0]['createTask']
@@ -189,7 +188,6 @@ export class BridgeReceiver {
constructor(private readonly deps: BridgeReceiverDeps) {
this.adapter = new SubmitDownloadAdapter({
- dataDir: deps.dataDir,
defaultSaveDir: deps.defaultSaveDir,
pickName: deps.pickName,
mintTaskId: newTaskId,
@@ -303,7 +301,7 @@ export class BridgeReceiver {
identity: Extract<MdxpSessionContext['identity'], { kind: 'extension' }>
): Promise<{ taskId: string }> {
// Hold the submit until startup restore has settled (see the dep doc).
- // Awaited before adapt so even the name pick / cookie-jar write see the
+ // Awaited before adapt so even the name pick sees the
// final on-disk state left by restore/recovery.
if (this.deps.waitForReady) {
await this.deps.waitForReady()
diff --git a/src/core/bridge-receiver/cookie-jar.test.ts b/src/core/bridge-receiver/cookie-jar.test.ts
deleted file mode 100644
index 7a5e2b7e..00000000
--- a/src/core/bridge-receiver/cookie-jar.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { mkdtemp, readFile, rm } from 'node:fs/promises'
-import { tmpdir } from 'node:os'
-import { join } from 'node:path'
-import { afterEach, beforeEach, describe, expect, it } from 'vitest'
-import { writeCookieJar } from './cookie-jar'
-
-describe('writeCookieJar', () => {
- let dir: string
- beforeEach(async () => {
- dir = await mkdtemp(join(tmpdir(), 'bridge-jar-'))
- })
- afterEach(async () => {
- await rm(dir, { recursive: true, force: true })
- })
-
- it('writes Netscape format file aria2 can read', async () => {
- const path = join(dir, 'jar.txt')
- await writeCookieJar(path, [
- {
- name: 'a',
- value: '1',
- domain: 'example.com',
- path: '/',
- secure: true,
- httpOnly: false,
- sameSite: 'unspecified',
- expiresAt: 1700000000,
- },
- {
- name: 'b',
- value: '2',
- domain: '.example.com',
- path: '/',
- secure: false,
- httpOnly: true,
- sameSite: 'unspecified',
- },
- ])
- const text = await readFile(path, 'utf-8')
- expect(text).toContain('# Netscape HTTP Cookie File')
- // aria2 expects tab-separated: domain flag path secure expires name value
- const lines = text.split('\n').filter((l) => l && !l.startsWith('#'))
- expect(lines).toHaveLength(2)
- expect(lines[0]).toBe('example.com\tFALSE\t/\tTRUE\t1700000000\ta\t1')
- expect(lines[1]).toBe('.example.com\tTRUE\t/\tFALSE\t0\tb\t2')
- })
-
- it('creates parent directories', async () => {
- const path = join(dir, 'nested', 'deep', 'jar.txt')
- await writeCookieJar(path, [])
- const text = await readFile(path, 'utf-8')
- expect(text).toContain('# Netscape HTTP Cookie File')
- })
-})
diff --git a/src/core/bridge-receiver/cookie-jar.ts b/src/core/bridge-receiver/cookie-jar.ts
deleted file mode 100644
index 8ca5e80d..00000000
--- a/src/core/bridge-receiver/cookie-jar.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { mkdir, writeFile } from 'node:fs/promises'
-import { dirname } from 'node:path'
-
-interface CookieInput {
- name: string
- value: string
- domain: string
- path: string
- secure: boolean
- httpOnly: boolean
- sameSite: string
- expiresAt?: number
-}
-
-/**
- * Write a Netscape HTTP Cookie File. aria2's `--load-cookies` consumes
- * this format. Each line is tab-separated:
- *
- * domain flag path secure expires name value
- *
- * `flag` is "TRUE" if the cookie applies to subdomains (domain starts
- * with a dot). `secure` is "TRUE" if HTTPS-only. `expires` is unix
- * seconds; 0 means session cookie.
- */
-export async function writeCookieJar(
- filePath: string,
- cookies: ReadonlyArray<CookieInput>
-): Promise<void> {
- await mkdir(dirname(filePath), { recursive: true })
- const lines = ['# Netscape HTTP Cookie File']
- for (const c of cookies) {
- const flag = c.domain.startsWith('.') ? 'TRUE' : 'FALSE'
- const secure = c.secure ? 'TRUE' : 'FALSE'
- const expires = c.expiresAt ?? 0
- lines.push(
- [c.domain, flag, c.path, secure, expires, c.name, c.value].join('\t')
- )
- }
- await writeFile(filePath, `${lines.join('\n')}\n`, 'utf-8')
-}
diff --git a/src/core/bridge-receiver/pipelines/direct-pipeline.test.ts b/src/core/bridge-receiver/pipelines/direct-pipeline.test.ts
index aa7016b0..5a58b25c 100644
--- a/src/core/bridge-receiver/pipelines/direct-pipeline.test.ts
+++ b/src/core/bridge-receiver/pipelines/direct-pipeline.test.ts
@@ -11,7 +11,15 @@ function buildAdapted(): AdaptedDirect {
kind: 'direct',
primaryUrl: 'http://example.com/x.mp4',
sanitizedHeaders: { 'X-Custom': 'v' },
- jarPath: '/tmp/jar.txt',
+ cookies: [
+ {
+ name: 'session',
+ value: 'synthetic-cookie',
+ domain: 'example.com',
+ path: '/',
+ secure: false,
+ },
+ ],
pageUrl: 'http://example.com/page',
sourceMeta: {
kind: 'direct',
@@ -69,13 +77,13 @@ describe('DirectPipeline.dispatch', () => {
expect(opts).toMatchObject({
source: 'bridge',
sourceMeta: { kind: 'direct', sessionKey: 'chromium:e' },
+ cookies: buildAdapted().cookies,
})
- // extraEngineOptions carries only cookies + referer. It must NOT
+ // extraEngineOptions carries only the referer. It must NOT
// re-specify header: Aria2Adapter applies extraEngineOptions last, so a
// header here would clobber (and discard) any plugin rewrite of
// params.headers.
- expect(opts.extraEngineOptions).toMatchObject({
- 'load-cookies': '/tmp/jar.txt',
+ expect(opts.extraEngineOptions).toEqual({
referer: 'http://example.com/page',
})
expect(opts.extraEngineOptions).not.toHaveProperty('header')
diff --git a/src/core/bridge-receiver/pipelines/direct-pipeline.ts b/src/core/bridge-receiver/pipelines/direct-pipeline.ts
index 56936555..3464ef60 100644
--- a/src/core/bridge-receiver/pipelines/direct-pipeline.ts
+++ b/src/core/bridge-receiver/pipelines/direct-pipeline.ts
@@ -53,12 +53,12 @@ export class DirectPipeline {
// beforeCreate plugin made to params.headers. Dropping the duplicate lets
// the plugin-mutable params.headers win.
const extraEngineOptions: Record<string, string | string[]> = {
- 'load-cookies': adapted.jarPath,
referer: adapted.pageUrl,
}
const { taskId } = await this.deps.createTask(req, undefined, {
source: 'bridge',
sourceMeta: adapted.sourceMeta,
+ cookies: adapted.cookies,
extraEngineOptions,
})
return { taskId }
diff --git a/src/core/bridge-receiver/submit-download-adapter.test.ts b/src/core/bridge-receiver/submit-download-adapter.test.ts
index 07171741..7375ecd8 100644
--- a/src/core/bridge-receiver/submit-download-adapter.test.ts
+++ b/src/core/bridge-receiver/submit-download-adapter.test.ts
@@ -1,4 +1,4 @@
-import { mkdtemp, rm } from 'node:fs/promises'
+import { mkdtemp, readdir, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import type { DownloadSubmitParams } from '@motrix/mdxp'
@@ -49,13 +49,12 @@ describe('SubmitDownloadAdapter.adapt', () => {
const adapter = (overrides: Partial<{ defaultSaveDir: string }> = {}) =>
new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: overrides.defaultSaveDir ?? '/tmp/save',
pickName: async (_dir, n) => n,
mintTaskId: () => 'task-1',
})
- it('happy path: validates, sanitizes, writes jar, returns adapted', async () => {
+ it('keeps scoped cookies in memory without writing a jar', async () => {
const result = await adapter().adapt(baseInput(), {
extensionId: 'e',
browser: 'chromium',
@@ -65,7 +64,18 @@ describe('SubmitDownloadAdapter.adapt', () => {
expect(result.taskId).toBe('task-1')
expect(result.saveDir).toBe('/tmp/save')
expect(result.finalName).toBe('demo.mp4')
- expect(result.jarPath).toContain('task-1')
+ expect(result.cookies).toEqual([
+ {
+ name: 'a',
+ value: '1',
+ domain: 'example.com',
+ path: '/',
+ hostOnly: true,
+ secure: false,
+ httpOnly: false,
+ },
+ ])
+ expect(await readdir(dataDir)).toEqual([])
expect(result.sanitizedHeaders).toEqual({ 'X-Custom': 'v' })
expect(result.sourceMeta.sessionKey).toBe('chromium:e')
})
@@ -88,6 +98,29 @@ describe('SubmitDownloadAdapter.adapt', () => {
).rejects.toMatchObject({ code: 'invalid-url-scheme' })
})
+ it('preserves domain scope and millisecond expiry while omitting browser-only fields', async () => {
+ const input = baseInput()
+ if (input.selection.kind !== 'direct') throw new Error('expected direct')
+ const original = input.selection.primary.cookies[0]!
+ original.domain = '.example.com'
+ original.secure = true
+ original.expiresAt = 2102444800000.75
+ const result = await adapter().adapt(input, {
+ extensionId: 'e',
+ browser: 'chromium',
+ })
+ if (result.kind !== 'direct') throw new Error('expected direct')
+ expect(result.cookies[0]).toMatchObject({
+ domain: '.example.com',
+ hostOnly: false,
+ secure: true,
+ expiresAt: 2102444800000,
+ })
+ expect(result.cookies[0]).not.toHaveProperty('sameSite')
+ original.value = 'changed-after-adapt'
+ expect(result.cookies[0]?.value).toBe('1')
+ })
+
it('sanitizes filename: control chars stripped, max 200', async () => {
const input: DownloadSubmitParams = {
...baseInput(),
@@ -127,7 +160,6 @@ describe('SubmitDownloadAdapter.adapt', () => {
it('adapts an hls selection (was unsupported-kind)', async () => {
const a = new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: '/tmp/save',
pickName: async (_d, n) => n,
mintTaskId: () => 't1',
@@ -163,7 +195,6 @@ describe('SubmitDownloadAdapter.adapt', () => {
it('adapts a dash selection', async () => {
const a = new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: '/tmp/save',
pickName: async (_d, n) => n,
mintTaskId: () => 't1',
@@ -199,7 +230,6 @@ describe('SubmitDownloadAdapter.adapt', () => {
it('adapts a mux selection into video/audio urls', async () => {
const a = new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: '/tmp/save',
pickName: async (_d, n) => n,
mintTaskId: () => 't1',
@@ -235,7 +265,6 @@ describe('SubmitDownloadAdapter.adapt', () => {
it('hls: appends the container extension BEFORE the dedup pick', async () => {
const picked: string[] = []
const a = new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: '/tmp/save',
pickName: async (_d, n) => {
picked.push(n)
@@ -267,7 +296,6 @@ describe('SubmitDownloadAdapter.adapt', () => {
it('mux: appends the container extension BEFORE the dedup pick (mkv)', async () => {
const picked: string[] = []
const a = new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: '/tmp/save',
pickName: async (_d, n) => {
picked.push(n)
@@ -300,7 +328,6 @@ describe('SubmitDownloadAdapter.adapt', () => {
it('mux: trusts an existing known media extension rather than double-appending', async () => {
const picked: string[] = []
const a = new SubmitDownloadAdapter({
- dataDir,
defaultSaveDir: '/tmp/save',
pickName: async (_d, n) => {
picked.push(n)
diff --git a/src/core/bridge-receiver/submit-download-adapter.ts b/src/core/bridge-receiver/submit-download-adapter.ts
index e9a2418e..46917528 100644
--- a/src/core/bridge-receiver/submit-download-adapter.ts
+++ b/src/core/bridge-receiver/submit-download-adapter.ts
@@ -1,15 +1,12 @@
-import { join } from 'node:path'
+import type { DownloadCookie } from '@core/engine/engine-adapter'
import type { DownloadSubmitParams } from '@motrix/mdxp'
import { type Browser, makeSessionKey } from '@shared/protocol/bridge'
import type { BridgeSourceMeta, SourceMeta } from '@shared/types/task'
-import { writeCookieJar } from './cookie-jar'
import { BridgeReceiverError } from './errors'
import { stripHopByHopHeaders } from './header-replay'
import { ensureMediaExtension } from './pipelines/media-final-name'
export interface AdapterDeps {
- /** Root for cookie jars: <userData>/bridge-receiver. */
- dataDir: string
/** appSettings.defaultSaveDir; used when client did not specify saveDir. */
defaultSaveDir: string
/** FinalNamePicker shim — wraps existing picker so tests can stub. */
@@ -25,7 +22,7 @@ export interface AdaptedDirect {
kind: 'direct'
primaryUrl: string
sanitizedHeaders: Record<string, string>
- jarPath: string
+ cookies: readonly DownloadCookie[]
sourceMeta: BridgeSourceMeta
pageUrl: string
}
@@ -137,8 +134,6 @@ export class SubmitDownloadAdapter {
selection.container
)
)
- const jarPath = join(this.deps.dataDir, 'cookies', `${taskId}.txt`)
- await writeCookieJar(jarPath, selection.primary.cookies)
const sanitizedHeaders = stripHopByHopHeaders(selection.primary.headers)
const base = {
taskId,
@@ -173,11 +168,6 @@ export class SubmitDownloadAdapter {
selection.container
)
)
- const jarPath = join(this.deps.dataDir, 'cookies', `${taskId}.txt`)
- await writeCookieJar(jarPath, [
- ...selection.video.cookies,
- ...selection.audio.cookies,
- ])
return {
kind: 'mux',
taskId,
@@ -200,9 +190,6 @@ export class SubmitDownloadAdapter {
const finalName = await this.deps.pickName(saveDir, sanitized)
const sanitizedHeaders = stripHopByHopHeaders(selection.primary.headers)
- const jarPath = join(this.deps.dataDir, 'cookies', `${taskId}.txt`)
- await writeCookieJar(jarPath, selection.primary.cookies)
-
return {
taskId,
saveDir,
@@ -210,7 +197,20 @@ export class SubmitDownloadAdapter {
kind: 'direct',
primaryUrl,
sanitizedHeaders,
- jarPath,
+ // Export only the engine-neutral fields. SameSite describes browser
+ // navigation context and is not part of the engine's cookie contract.
+ cookies: selection.primary.cookies.map((cookie) => ({
+ name: cookie.name,
+ value: cookie.value,
+ domain: cookie.domain,
+ path: cookie.path,
+ hostOnly: !cookie.domain.startsWith('.'),
+ secure: cookie.secure,
+ httpOnly: cookie.httpOnly,
+ ...(cookie.expiresAt === undefined
+ ? {}
+ : { expiresAt: Math.max(0, Math.floor(cookie.expiresAt)) }),
+ })),
sourceMeta: this.makeSourceMeta('direct', input, source, meta),
pageUrl: source.pageUrl,
}
diff --git a/src/core/bridge-receiver/task-cookies.integration.test.ts b/src/core/bridge-receiver/task-cookies.integration.test.ts
new file mode 100644
index 00000000..108dba8e
--- /dev/null
+++ b/src/core/bridge-receiver/task-cookies.integration.test.ts
@@ -0,0 +1,199 @@
+import { mkdtemp, readFile, rm } from 'node:fs/promises'
+import { createServer, type Server } from 'node:http'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import { handleCreateTask } from '@core/task/create-task-handler'
+import { TaskManager } from '@core/task/task-manager'
+import type { DownloadSubmitParams } from '@motrix/mdxp'
+import { ErrorCode } from '@shared/errors'
+import { DEFAULT_ENGINE_SETTINGS } from '@shared/schemas/engine-settings'
+import { DEFAULT_PROXY_SETTINGS } from '@shared/schemas/proxy-settings'
+import {
+ type Aria2Handle,
+ bundledAria2Exists,
+ canBindLoopbackTcp,
+ connectAdapter,
+ spawnAria2ForTest,
+} from '@test-utils/aria2'
+import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
+import { DirectPipeline } from './pipelines/direct-pipeline'
+import { SubmitDownloadAdapter } from './submit-download-adapter'
+
+describe.skipIf(!bundledAria2Exists() || !canBindLoopbackTcp())(
+ 'browser task cookies through the bundled engine',
+ () => {
+ let root: string
+ let server: Server
+ let base: string
+ let handle: Aria2Handle
+ let wired: Awaited<ReturnType<typeof connectAdapter>>
+ const received = new Map<string, string | undefined>()
+
+ beforeAll(async () => {
+ root = await mkdtemp(path.join(tmpdir(), 'motrix-browser-cookies-'))
+ server = createServer((req, res) => {
+ received.set(req.url ?? '/', req.headers.cookie)
+ res.end(
+ req.headers.cookie?.includes('sid=account-') ? 'REAL_FILE' : 'NO_AUTH'
+ )
+ })
+ await new Promise<void>((resolve) =>
+ server.listen(0, '127.0.0.1', resolve)
+ )
+ const address = server.address()
+ if (!address || typeof address === 'string')
+ throw new Error('missing address')
+ base = `http://127.0.0.1:${address.port}`
+ handle = await spawnAria2ForTest({ baseDir: root })
+ wired = await connectAdapter(handle)
+ await wired.rpc.changeGlobalOption({
+ 'enable-dht': 'false',
+ 'max-concurrent-downloads': '8',
+ })
+ }, 30_000)
+
+ afterAll(async () => {
+ wired?.disconnect()
+ await handle?.kill()
+ server?.closeAllConnections()
+ if (server)
+ await new Promise<void>((resolve) => server.close(() => resolve()))
+ if (root) await rm(root, { recursive: true, force: true })
+ })
+
+ it('downloads as separate browser accounts and keeps cookies out of task records', async () => {
+ const tasks = new TaskManager()
+ const gids = new Map<string, string>()
+ type Deps = Parameters<typeof handleCreateTask>[1]
+ const deps = {
+ adapter: wired.adapter,
+ settingsManager: {
+ getApp: () => ({ defaultSaveDir: root }),
+ getEngine: () => DEFAULT_ENGINE_SETTINGS,
+ getProxy: () => DEFAULT_PROXY_SETTINGS,
+ },
+ finalNamePicker: { pick: async (_dir: string, name: string) => name },
+ torrentMetaStore: {},
+ taskManager: tasks,
+ activityRecorder: { recordSubmitted: vi.fn() },
+ eventBus: { emit: vi.fn() },
+ publishTaskUpdate: vi.fn(),
+ } as unknown as Deps
+ const pipeline = new DirectPipeline({
+ createTask: async (request, _unused, options) => {
+ const result = await handleCreateTask(request, deps, options)
+ gids.set(result.taskId, result.gid)
+ return result
+ },
+ removeTask: async () => {},
+ })
+ let serial = 0
+ const adapter = new SubmitDownloadAdapter({
+ defaultSaveDir: root,
+ pickName: async (_dir, name) => name,
+ mintTaskId: () => `browser-cookie-${++serial}`,
+ })
+ await Promise.all(
+ ['account-A', 'account-B', null].map(async (account, index) => {
+ // Start at the typed core boundary so the fixture can use a
+ // loopback URL without MDXP's public-hostname restriction.
+ const input: DownloadSubmitParams = {
+ source: {
+ pageUrl: base,
+ pageTitle: 'Fixture',
+ detectedAt: Date.now(),
+ },
+ selection: {
+ kind: 'direct',
+ primary: {
+ url: `${base}/file-${index}`,
+ headers: { Cookie: 'sid=RAW_HEADER_MUST_NOT_WIN' },
+ cookies: account
+ ? [
+ {
+ name: 'sid',
+ value: account,
+ domain: '127.0.0.1',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ sameSite: 'unspecified',
+ expiresAt: Date.now() + 60000,
+ },
+ ]
+ : [],
+ refererPolicy: 'strict-origin-when-cross-origin',
+ },
+ },
+ meta: {
+ suggestedFilename: `file-${index}.bin`,
+ qualityLabel: 'original',
+ },
+ }
+ const adapted = await adapter.adapt(input, {
+ extensionId: 'fixture',
+ browser: 'chromium',
+ })
+ if (adapted.kind !== 'direct') throw new Error('expected direct')
+ const { taskId } = await pipeline.dispatch(adapted)
+ const gid = gids.get(taskId)
+ if (!gid) throw new Error('missing engine id')
+ await vi.waitFor(
+ async () => {
+ expect((await wired.rpc.tellStatus(gid)).status).toBe('complete')
+ },
+ { timeout: 10_000, interval: 50 }
+ )
+ const task = tasks.getById(taskId)
+ if (!task) throw new Error('missing task')
+ expect(await readFile(task.diskPath, 'utf8')).toBe(
+ account ? 'REAL_FILE' : 'NO_AUTH'
+ )
+ expect(received.get(`/file-${index}`)).toBe(
+ account ? `sid=${account};` : undefined
+ )
+ expect(task.instances[0]?.payload).toMatchObject({
+ directReplay: {
+ replayability: 'requires-credentials',
+ requestModifiers: expect.arrayContaining(['cookies']),
+ },
+ })
+ })
+ )
+ const records = JSON.stringify(tasks.getAll())
+ for (const secret of [
+ 'account-A',
+ 'account-B',
+ 'RAW_HEADER_MUST_NOT_WIN',
+ ]) {
+ expect(records).not.toContain(secret)
+ }
+ }, 20_000)
+
+ it.runIf(process.env.MOTRIX_LEGACY_ARIA2_TEST_BIN)(
+ 'rejects an older real engine without submitting an unauthenticated task',
+ async () => {
+ const legacy = await spawnAria2ForTest({
+ baseDir: root,
+ binaryPath: process.env.MOTRIX_LEGACY_ARIA2_TEST_BIN,
+ })
+ const legacyWired = await connectAdapter(legacy)
+ try {
+ await expect(
+ legacyWired.adapter.createDownload({
+ uris: [`${base}/legacy`],
+ saveDir: root,
+ cookies: [],
+ })
+ ).rejects.toMatchObject({ code: ErrorCode.EngineFeatureUnavailable })
+ expect(await legacyWired.rpc.tellActive()).toEqual([])
+ expect(await legacyWired.rpc.tellWaiting(0, 100)).toEqual([])
+ expect(received.has('/legacy')).toBe(false)
+ } finally {
+ legacyWired.disconnect()
+ await legacy.kill()
+ }
+ }
+ )
+ }
+)
diff --git a/src/core/engine/aria2/aria2-adapter.test.ts b/src/core/engine/aria2/aria2-adapter.test.ts
index 00debbca..4b8d1d54 100644
--- a/src/core/engine/aria2/aria2-adapter.test.ts
+++ b/src/core/engine/aria2/aria2-adapter.test.ts
@@ -19,6 +19,7 @@ function createMockRpc(): Aria2RpcClient {
disconnect: vi.fn(),
isConnected: vi.fn(() => true),
addUri: vi.fn(),
+ addUriWithCookies: vi.fn(),
addTorrent: vi.fn(),
addMetalink: vi.fn(),
remove: vi.fn(),
@@ -417,6 +418,98 @@ describe('Aria2Adapter', () => {
})
describe('createDownload', () => {
+ it.each([
+ { cookies: [] },
+ { cookies: [{ name: 'sid', value: 'synthetic', domain: 'example.com' }] },
+ ])(
+ 'keeps explicit cookie contexts on the dedicated RPC',
+ async ({ cookies }) => {
+ const rpc = createMockRpc()
+ vi.mocked(rpc.addUriWithCookies).mockResolvedValue('cookie-gid')
+ const adapter = new Aria2Adapter(rpc)
+ await expect(
+ adapter.createDownload({
+ uris: ['https://example.com/file'],
+ saveDir: '/tmp',
+ cookies,
+ })
+ ).resolves.toBe('cookie-gid')
+ expect(rpc.addUriWithCookies).toHaveBeenCalledWith(
+ ['https://example.com/file'],
+ cookies,
+ expect.objectContaining({ dir: '/tmp' })
+ )
+ expect(rpc.addUri).not.toHaveBeenCalled()
+ }
+ )
+
+ it('rejects an unsupported cookie RPC without retrying a credential-free download', async () => {
+ const rpc = createMockRpc()
+ vi.mocked(rpc.addUriWithCookies).mockRejectedValue(
+ new Error('No such method: aria2.addUriWithCookies')
+ )
+ const adapter = new Aria2Adapter(rpc)
+ await expect(
+ adapter.createDownload({
+ uris: ['https://example.com/file'],
+ saveDir: '/tmp',
+ cookies: [],
+ })
+ ).rejects.toMatchObject({ code: ErrorCode.EngineFeatureUnavailable })
+ expect(rpc.addUri).not.toHaveBeenCalled()
+ expect(rpc.addUriWithCookies).toHaveBeenCalledTimes(1)
+ })
+
+ it('retains the cookie context during connection-limit compatibility retries', async () => {
+ const rpc = createMockRpc()
+ vi.mocked(rpc.addUriWithCookies)
+ .mockRejectedValueOnce(
+ new Error(
+ 'errorCode=28: max-connection-per-server must be between 1 and 16'
+ )
+ )
+ .mockResolvedValueOnce('cookie-gid')
+ const adapter = new Aria2Adapter(rpc)
+ adapter.setFeatureReport(featureReport())
+ const cookies = [
+ { name: 'sid', value: 'synthetic', domain: 'example.com' },
+ ]
+ await adapter.createDownload({
+ uris: ['https://example.com/file'],
+ saveDir: '/tmp',
+ connections: 64,
+ cookies,
+ })
+ expect(rpc.addUriWithCookies).toHaveBeenNthCalledWith(
+ 1,
+ expect.any(Array),
+ cookies,
+ expect.objectContaining({ split: '64' })
+ )
+ expect(rpc.addUriWithCookies).toHaveBeenNthCalledWith(
+ 2,
+ expect.any(Array),
+ cookies,
+ expect.objectContaining({ split: '16' })
+ )
+ expect(rpc.addUri).not.toHaveBeenCalled()
+ })
+
+ it('rejects metadata proofs that cannot represent task cookies', async () => {
+ const rpc = createMockRpc()
+ const adapter = new Aria2Adapter(rpc)
+ adapter.setDirectResourceMetadataProfile(DIRECT_RESOURCE_METADATA_PROFILE)
+ await expect(
+ adapter.createDownload({
+ uris: ['https://example.com/file'],
+ saveDir: '/tmp',
+ cookies: [],
+ directResourceMetadataProfile: DIRECT_RESOURCE_METADATA_PROFILE,
+ })
+ ).rejects.toThrow('request profile')
+ expect(rpc.addUriWithCookies).not.toHaveBeenCalled()
+ })
+
it('pins the metadata-owned baseline and preserves explicit credentials', async () => {
const rpc = createMockRpc()
vi.mocked(rpc.addUri).mockResolvedValue('profile-gid')
diff --git a/src/core/engine/aria2/aria2-adapter.ts b/src/core/engine/aria2/aria2-adapter.ts
index 650917b5..7e6e7b11 100644
--- a/src/core/engine/aria2/aria2-adapter.ts
+++ b/src/core/engine/aria2/aria2-adapter.ts
@@ -27,6 +27,7 @@ import type {
AddTorrentParams,
CreateDownloadParams,
DirectResourceMetadataProfile,
+ DownloadCookie,
EngineAdapter,
} from '../engine-adapter'
import { DIRECT_RESOURCE_METADATA_PROFILE } from '../engine-adapter'
@@ -299,15 +300,36 @@ export class Aria2Adapter implements EngineAdapter {
private async addUriWithConnectionFallback(
uris: string[],
- options: Record<string, string | string[]>
+ options: Record<string, string | string[]>,
+ cookies?: readonly DownloadCookie[]
): Promise<string> {
+ const submit = (requestOptions: Record<string, string | string[]>) => {
+ if (cookies === undefined) return this.rpc.addUri(uris, requestOptions)
+ return this.rpc
+ .addUriWithCookies(uris, cookies, requestOptions)
+ .catch((error: unknown) => {
+ if (
+ error instanceof Error &&
+ /(?:no such method|method not found).*addUriWithCookies/i.test(
+ error.message
+ )
+ ) {
+ throw new AppError(
+ ErrorCode.EngineFeatureUnavailable,
+ 'Task cookies require aria2 1.37.0-motrix.13 or a compatible engine. Update the download engine.',
+ error
+ )
+ }
+ throw error
+ })
+ }
const firstOptions =
this.connectionOptionLimit === null
? options
: this.capConnectionOptions(options, this.connectionOptionLimit)
try {
- return await this.rpc.addUri(uris, firstOptions)
+ return await submit(firstOptions)
} catch (error) {
const fallbackOptions = this.capConnectionOptions(
firstOptions,
@@ -323,7 +345,7 @@ export class Aria2Adapter implements EngineAdapter {
{ err: error },
'aria2 rejected connection options; retrying with compatibility limit'
)
- return this.rpc.addUri(uris, fallbackOptions)
+ return submit(fallbackOptions)
}
}
@@ -344,7 +366,8 @@ export class Aria2Adapter implements EngineAdapter {
const metadataProfile = params.directResourceMetadataProfile
if (
metadataProfile !== undefined &&
- this.getDirectResourceMetadataProfile() !== metadataProfile
+ (params.cookies !== undefined ||
+ this.getDirectResourceMetadataProfile() !== metadataProfile)
) {
throw new Error(
'aria2 HTTP request profile changed before download dispatch'
@@ -496,7 +519,8 @@ export class Aria2Adapter implements EngineAdapter {
const actualGid = await this.addUriWithConnectionFallback(
params.uris,
- options
+ options,
+ params.cookies
)
if (
requestedGid !== undefined &&
diff --git a/src/core/engine/aria2/aria2-rpc-client.test.ts b/src/core/engine/aria2/aria2-rpc-client.test.ts
index 1e00878f..66e93248 100644
--- a/src/core/engine/aria2/aria2-rpc-client.test.ts
+++ b/src/core/engine/aria2/aria2-rpc-client.test.ts
@@ -77,6 +77,55 @@ describe('Aria2RpcClient', () => {
})
describe('connect / disconnect', () => {
+ it('preserves cookie values, boolean types and millisecond expiry in authenticated RPC parameters', async () => {
+ const cookies = [
+ {
+ name: 'sid',
+ value: 'synthetic',
+ domain: 'example.com',
+ secure: true,
+ expiresAt: 2102444800000,
+ },
+ ]
+ fakeProtocol.nextResult = 'cookie-gid'
+ await expect(
+ client.addUriWithCookies(
+ ['https://example.com/file'],
+ cookies,
+ { out: 'file' },
+ 2
+ )
+ ).resolves.toBe('cookie-gid')
+ expect(fakeProtocol.calls).toEqual([
+ {
+ method: 'aria2.addUriWithCookies',
+ params: [
+ 'token:my-secret',
+ ['https://example.com/file'],
+ cookies,
+ { out: 'file' },
+ 2,
+ ],
+ },
+ ])
+ })
+
+ it('keeps the options slot when only a cookie task queue position is supplied', async () => {
+ await client.addUriWithCookies(
+ ['https://example.com/file'],
+ [],
+ undefined,
+ 2
+ )
+ expect(fakeProtocol.calls[0]?.params).toEqual([
+ 'token:my-secret',
+ ['https://example.com/file'],
+ [],
+ {},
+ 2,
+ ])
+ })
+
it('connects to ws://127.0.0.1:{port}/jsonrpc', async () => {
await client.connect(16800)
diff --git a/src/core/engine/aria2/aria2-rpc-client.ts b/src/core/engine/aria2/aria2-rpc-client.ts
index f70fd717..a47b492d 100644
--- a/src/core/engine/aria2/aria2-rpc-client.ts
+++ b/src/core/engine/aria2/aria2-rpc-client.ts
@@ -1,3 +1,4 @@
+import type { DownloadCookie } from '../engine-adapter'
import type { JsonRpcProtocol } from './json-rpc-protocol'
import type {
Aria2HistoryCount,
@@ -94,6 +95,19 @@ export class Aria2RpcClient {
return this.call<string>('aria2.addUri', params)
}
+ addUriWithCookies(
+ uris: string[],
+ cookies: readonly DownloadCookie[],
+ options?: Record<string, string | string[]>,
+ position?: number
+ ): Promise<string> {
+ const params: unknown[] = [uris, cookies]
+ if (options !== undefined || position !== undefined)
+ params.push(options ?? {})
+ if (position !== undefined) params.push(position)
+ return this.call<string>('aria2.addUriWithCookies', params)
+ }
+
addTorrent(
torrentBase64: string,
uris?: string[],
diff --git a/src/core/engine/engine-adapter.ts b/src/core/engine/engine-adapter.ts
index c9dd1157..a6252bd9 100644
--- a/src/core/engine/engine-adapter.ts
+++ b/src/core/engine/engine-adapter.ts
@@ -77,6 +77,19 @@ export interface AddTorrentParams {
extraEngineOptions?: Record<string, string | string[]>
}
+/** An in-memory HTTP cookie, scoped by the engine on every request. */
+export interface DownloadCookie {
+ name: string
+ value: string
+ domain: string
+ path?: string
+ hostOnly?: boolean
+ secure?: boolean
+ httpOnly?: boolean
+ /** Unix milliseconds; omitted for a session cookie. */
+ expiresAt?: number
+}
+
export interface CreateDownloadParams {
uris: string[]
saveDir: string
@@ -86,6 +99,8 @@ export interface CreateDownloadParams {
gid?: string
filename?: string
headers?: Record<string, string>
+ /** An explicit task context, including an empty isolated store. Never persist. */
+ cookies?: readonly DownloadCookie[]
/** Effective engine User-Agent pinned for this request lifecycle. */
userAgent?: string
/**
@@ -99,8 +114,8 @@ export interface CreateDownloadParams {
* max-connection-per-server. Caller is responsible for clamping. */
connections?: number
proxy?: string
- /** Engine-agnostic passthrough for shell-supplied options (bridge cookie
- * jar / referer). The adapter honors keys it understands. */
+ /** Engine-agnostic passthrough for shell-supplied options, such as a
+ * referer. The adapter honors keys it understands. */
extraEngineOptions?: Record<string, string | string[]>
priority?: number
category?: string
diff --git a/src/core/task/create-task-handler.test.ts b/src/core/task/create-task-handler.test.ts
index cb231a14..be32063d 100644
--- a/src/core/task/create-task-handler.test.ts
+++ b/src/core/task/create-task-handler.test.ts
@@ -132,6 +132,7 @@ function httpRequest() {
function makeDeps(overrides: DepOverrides = {}): Deps & {
addUri: ReturnType<typeof vi.fn>
+ addUriWithCookies: ReturnType<typeof vi.fn>
addTorrent: ReturnType<typeof vi.fn>
pick: ReturnType<typeof vi.fn>
persist: ReturnType<typeof vi.fn>
@@ -158,6 +159,13 @@ function makeDeps(overrides: DepOverrides = {}): Deps & {
options: Record<string, unknown>
) => String(options.gid ?? overrides.addTorrentGid ?? 'gid-bt')
)
+ const addUriWithCookies = vi.fn(
+ async (
+ _uris: string[],
+ _cookies: unknown[],
+ options: Record<string, unknown>
+ ) => String(options.gid ?? 'cookie-gid')
+ )
const forceRemove = vi.fn(async () => undefined)
const removeDownloadResult = vi.fn(async () => undefined)
const pick = vi.fn(
@@ -179,6 +187,7 @@ function makeDeps(overrides: DepOverrides = {}): Deps & {
// subscriptions are required by the constructor and are no-op stubs here.
const rpcClient = {
addUri,
+ addUriWithCookies,
addTorrent,
forceRemove,
removeDownloadResult,
@@ -247,6 +256,7 @@ function makeDeps(overrides: DepOverrides = {}): Deps & {
activityRecorder,
eventBus,
addUri,
+ addUriWithCookies,
addTorrent,
pick,
persist,
@@ -279,6 +289,40 @@ function lastAddedTask(deps: { add: ReturnType<typeof vi.fn> }): DownloadTask {
}
describe('handleCreateTask', () => {
+ it('dispatches cookies only to the engine and blocks credential-free probing and replay', async () => {
+ const deps = makeDeps()
+ const probe = vi.fn()
+ const capture = vi.fn()
+ deps.directResourceValidator = { probe, capture }
+ const cookies = [
+ { name: 'sid', value: 'COOKIE_ONLY_IN_MEMORY', domain: 'a' },
+ ]
+ await handleCreateTask(
+ { type: 'http', uris: ['https://a/b'], saveDir: '/d', headers: [] },
+ deps,
+ { source: 'bridge', cookies }
+ )
+ expect(deps.addUriWithCookies).toHaveBeenCalledWith(
+ ['https://a/b'],
+ cookies,
+ expect.objectContaining({ dir: '/d' })
+ )
+ expect(deps.addUri).not.toHaveBeenCalled()
+ expect(probe).not.toHaveBeenCalled()
+ expect(capture).not.toHaveBeenCalled()
+ const task = lastAddedTask(deps)
+ expect(task.instances[0]?.payload).toMatchObject({
+ directReplay: {
+ requestModifiers: ['cookies'],
+ replayability: 'requires-credentials',
+ },
+ })
+ expect(JSON.stringify(task)).not.toContain('COOKIE_ONLY_IN_MEMORY')
+ expect(JSON.stringify(logInfo.mock.calls)).not.toContain(
+ 'COOKIE_ONLY_IN_MEMORY'
+ )
+ })
+
it('reuses an exact active torrent before allocating storage or an engine gid', async () => {
const bytes = makePublicTorrentFixture()
const parsed = await parseBtFileLayout(bytes)
diff --git a/src/core/task/create-task-handler.ts b/src/core/task/create-task-handler.ts
index 4215117b..8825bd29 100644
--- a/src/core/task/create-task-handler.ts
+++ b/src/core/task/create-task-handler.ts
@@ -201,8 +201,10 @@ export interface CreateTaskDeps {
export interface CreateTaskOptions {
source?: TaskSource // default 'user'
sourceMeta?: SourceMeta // default null
+ /** Ephemeral credentials; kept out of persisted task records and plugins. */
+ cookies?: CreateDownloadParams['cookies']
/** Engine option dictionary merged into the engine call: header
- * (repeated), load-cookies, referer. createTaskHandler forwards these
+ * (repeated), referer. createTaskHandler forwards these
* via CreateDownloadParams.extraEngineOptions; the adapter honors the
* keys it understands. */
extraEngineOptions?: Record<string, string | string[]>
@@ -523,8 +525,9 @@ async function handleCreateTaskUnderAdmission(
userAgent: engineSettings.userAgent,
connections: clampedConnections,
headers: headersRecord,
+ cookies: opts.cookies,
proxy: req.proxy,
- // Bridge cookie jar / referer; createDownload merges these raw AFTER
+ // Bridge referer; createDownload merges these raw AFTER
// dir/out so a shell-supplied option can override (matches old order).
extraEngineOptions: opts.extraEngineOptions,
}
@@ -1121,6 +1124,7 @@ function directResourceRequestContext(
params: Pick<
CreateDownloadParams,
| 'headers'
+ | 'cookies'
| 'proxy'
| 'extraEngineOptions'
| 'userAgent'
@@ -1131,6 +1135,7 @@ function directResourceRequestContext(
// Passthrough engine options can add cookies, a referer, headers, or other
// request semantics the metadata client cannot reconstruct safely.
if (
+ params.cookies !== undefined ||
(params.extraEngineOptions &&
Object.keys(params.extraEngineOptions).length > 0) ||
params.directResourceMetadataProfile !== DIRECT_RESOURCE_METADATA_PROFILE ||
@@ -1180,11 +1185,12 @@ function resolveDirectResourceMetadataProfile(
}
function canApplyDirectResourceMetadataProfile(
- params: Pick<CreateDownloadParams, 'uris' | 'extraEngineOptions'>,
+ params: Pick<CreateDownloadParams, 'uris' | 'cookies' | 'extraEngineOptions'>,
profile: DirectResourceMetadataProfile | null
): DirectResourceMetadataProfile | null {
if (
profile === null ||
+ params.cookies !== undefined ||
(params.extraEngineOptions &&
Object.keys(params.extraEngineOptions).length > 0) ||
!params.uris.every(isCredentialFreeHttpUri)
diff --git a/src/core/task/direct-replay-recipe.test.ts b/src/core/task/direct-replay-recipe.test.ts
index 75839fbd..58ccce95 100644
--- a/src/core/task/direct-replay-recipe.test.ts
+++ b/src/core/task/direct-replay-recipe.test.ts
@@ -3,6 +3,41 @@ import { describe, expect, it } from 'vitest'
import { buildDirectReplayRecipe } from './direct-replay-recipe'
describe('direct replay recipe', () => {
+ it.each([
+ { cookies: [] },
+ {
+ cookies: [
+ { name: 'sid', value: 'COOKIE_ONLY_IN_MEMORY', domain: 'example.com' },
+ ],
+ },
+ ])(
+ 'requires fresh context for task cookies, including an empty isolated store',
+ ({ cookies }) => {
+ const recipe = buildDirectReplayRecipe({ cookies })
+ expect(recipe).toEqual({
+ version: 1,
+ requestModifiers: ['cookies'],
+ replayability: 'requires-credentials',
+ })
+ expect(parseDirectReplayRecipe({ directReplay: recipe })).toEqual(recipe)
+ expect(JSON.stringify(recipe)).not.toContain('COOKIE_ONLY_IN_MEMORY')
+ }
+ )
+
+ it('accepts all five non-secret request modifiers together', () => {
+ const recipe = buildDirectReplayRecipe(
+ {
+ headers: { X: 'value' },
+ cookies: [],
+ proxy: 'http://example.com',
+ extraEngineOptions: { referer: 'https://example.com' },
+ },
+ true
+ )
+ expect(recipe.requestModifiers).toHaveLength(5)
+ expect(parseDirectReplayRecipe({ directReplay: recipe })).toEqual(recipe)
+ })
+
it('builds a uri-only v1 recipe for a public direct download', () => {
const recipe = buildDirectReplayRecipe({ connections: 8 })
diff --git a/src/core/task/direct-replay-recipe.ts b/src/core/task/direct-replay-recipe.ts
index 9dd5b92b..1f367116 100644
--- a/src/core/task/direct-replay-recipe.ts
+++ b/src/core/task/direct-replay-recipe.ts
@@ -14,13 +14,14 @@ export type { DirectReplayRecipe } from '@shared/schemas/direct-replay-recipe'
export function buildDirectReplayRecipe(
params: Pick<
CreateDownloadParams,
- 'connections' | 'headers' | 'proxy' | 'extraEngineOptions'
+ 'connections' | 'headers' | 'cookies' | 'proxy' | 'extraEngineOptions'
>,
ambientEngineRequestOptions = false
): DirectReplayRecipe {
const requestModifiers: DirectReplayRequestModifier[] = []
if (hasEntries(params.headers)) requestModifiers.push('headers')
+ if (params.cookies !== undefined) requestModifiers.push('cookies')
if (hasText(params.proxy)) requestModifiers.push('proxy')
if (hasEntries(params.extraEngineOptions)) {
requestModifiers.push('extraEngineOptions')
diff --git a/src/main/bridge/index.ts b/src/main/bridge/index.ts
index aaecb7e3..05a9e20b 100644
--- a/src/main/bridge/index.ts
+++ b/src/main/bridge/index.ts
@@ -538,7 +538,6 @@ export async function bootstrapBridge(args: {
// Constructed BEFORE WebSocketBridgeServer so that setHandlers() can
// reference receiver before server.start() is called — eliminating the
// race window where the server is listening but handlers aren't registered.
- const receiverDataDir = join(dataDir, 'receiver')
const t = i18n.t.bind(i18n)
const localize = (code: string) =>
t(`bridge.receiver.error.${camelize(code)}`)
@@ -551,7 +550,6 @@ export async function bootstrapBridge(args: {
args.pluginHost
)
const receiver = new BridgeReceiver({
- dataDir: receiverDataDir,
defaultSaveDir: args.defaultSaveDir,
pickName: (saveDir, desired) =>
args.finalNamePicker.pick(saveDir, desired),
diff --git a/src/server/index.ts b/src/server/index.ts
index 4ae02d44..c59f3573 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -1806,9 +1806,8 @@ async function main() {
bridgeDataDirLock: dataDirLock,
remoteExtensionConfig,
trustedExtensionRegistry,
- createExtensionReceiver: ({ dataDir, bridgeBus }) =>
+ createExtensionReceiver: ({ bridgeBus }) =>
new BridgeReceiver({
- dataDir,
defaultSaveDir: settingsManager.getApp().defaultSaveDir,
pickName: (saveDir, desired) =>
finalNamePicker.pick(saveDir, desired),
diff --git a/src/shared/schemas/direct-replay-recipe.ts b/src/shared/schemas/direct-replay-recipe.ts
index 16bb235f..ec4cf09e 100644
--- a/src/shared/schemas/direct-replay-recipe.ts
+++ b/src/shared/schemas/direct-replay-recipe.ts
@@ -7,6 +7,7 @@ import { z } from 'zod'
*/
export const directReplayRequestModifierSchema = z.enum([
'headers',
+ 'cookies',
'proxy',
'extraEngineOptions',
'engineGlobalOptions',
@@ -50,7 +51,7 @@ const directReplayV1Schema = z
.object({
version: z.literal(1),
connections: z.number().int().min(1).max(128).optional(),
- requestModifiers: z.array(directReplayRequestModifierSchema).max(4),
+ requestModifiers: z.array(directReplayRequestModifierSchema).max(5),
replayability: z.enum(['uri-only', 'requires-credentials']),
resourceValidator: directResourceValidatorSchema.optional(),
})
diff --git a/src/test-utils/aria2.ts b/src/test-utils/aria2.ts
index f64488c2..1434c0e6 100644
--- a/src/test-utils/aria2.ts
+++ b/src/test-utils/aria2.ts
@@ -24,6 +24,8 @@ export interface Aria2Handle {
export interface SpawnAria2Options {
baseDir: string
+ /** Optional explicit binary for compatibility tests against older engines. */
+ binaryPath?: string
port?: number
secret?: string
waitForHttpRpc?: boolean
@@ -92,11 +94,13 @@ export async function spawnAria2ForTest(
): Promise<Aria2Handle> {
const port = opts.port ?? 16800 + Math.floor(Math.random() * 2000)
const secret = opts.secret ?? 'test_secret'
- const bin = resolveBundledAria2()
+ const bin = opts.binaryPath ?? resolveBundledAria2()
const proc = spawn(
bin,
[
+ '--no-conf=true',
+ '--no-netrc=true',
'--enable-rpc=true',
`--rpc-listen-port=${port}`,
`--rpc-secret=${secret}`,
diff --git a/tests/check-third-party-notices.test.ts b/tests/check-third-party-notices.test.ts
index 348cb67f..69bba4c7 100644
--- a/tests/check-third-party-notices.test.ts
+++ b/tests/check-third-party-notices.test.ts
@@ -412,9 +412,9 @@ describe('third-party graph dependency notices', () => {
expect(notice).toContain('SFNS-Regular.ttf')
expect(notice).toContain('https://developer.apple.com/fonts/')
- expect(notice).toContain('1.37.0-motrix.12')
+ expect(notice).toContain('1.37.0-motrix.13')
expect(notice).toContain(
- 'https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.12'
+ 'https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.13'
)
expect(notice).toContain('GPL-2.0-or-later')
expect(notice).toContain('THIRD_PARTY_LICENSES/aria2-COPYING')
diff --git a/tests/generate-third-party-notices.test.ts b/tests/generate-third-party-notices.test.ts
index a2131deb..8cbe1fd0 100644
--- a/tests/generate-third-party-notices.test.ts
+++ b/tests/generate-third-party-notices.test.ts
@@ -164,7 +164,7 @@ describe('third-party notice generator', () => {
expect(bundle.packageCount).toBeGreaterThan(100)
expect(inventory).toContain('| @xyflow/react | 12.11.6 |')
- expect(inventory).toContain('| aria2 | 1.37.0-motrix.12 |')
+ expect(inventory).toContain('| aria2 | 1.37.0-motrix.13 |')
expect(inventory).toContain('| motrix.filename-template | 1.1.1 |')
expect(inventory).toContain('Apple San Francisco tray font')
expect(licenses).toContain('GNU GENERAL PUBLIC LICENSE')