Files
AeroFetch/test/aria2cBundled.test.ts
debont80 eb53de2ea5 feat(setup): fetch ffmpeg on first run instead of bundling it
Ship a smaller installer that no longer carries ffmpeg.exe/ffprobe.exe
(the bulk of its size). On first run they are downloaded from a pinned
upstream archive (gyan 8.1.2), verified against a pinned SHA-256, and
unpacked with the OS tar.exe into the managed userData/bin dir -- the
same place as the self-updating yt-dlp, so they survive app updates and
portable re-extraction. A hard onboarding gate blocks the app until they
are present, with a "locate existing ffmpeg" folder-picker fallback for
offline machines and a Repair action in Settings > About.

The updater's streaming/checksum/redirect/idle-timeout download loop is
extracted to lib/verifiedDownload.streamVerifiedFile and shared by both
the app-installer download and the ffmpeg fetch; the updater's public
behaviour and error strings are unchanged (its boundary tests still pass).
No new npm dependency: extraction uses the System32 bsdtar resolved by
absolute path (audit F3).

Note: this commit also carries pre-existing, in-progress aria2c/network
and updater-token work that was already uncommitted in the working tree
and is entangled with the above in shared files (updater.ts, ipc.ts,
preload/index.ts, mockApi.ts, shared/ipc.ts, plus the settings/network
files and aria2c.exe). It was not cleanly separable by path, so it is
included here rather than split out.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 11:02:13 -04:00

26 lines
1.2 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { existsSync, statSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'
// Regression guard: the `useAria2c` setting was a silent no-op because aria2c.exe
// was never bundled — download.ts gates the --downloader flag on the file existing
// (existsSync(getAria2cPath())), so with no binary the toggle did nothing. This
// asserts the binary ships in resources/bin (where getBinDir/getAria2cPath resolve
// it, and where electron-builder's extraResources copies it into packaged builds).
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..')
const aria2cPath = join(repoRoot, 'resources', 'bin', 'aria2c.exe')
describe('bundled aria2c', () => {
it('ships aria2c.exe in resources/bin', () => {
expect(existsSync(aria2cPath)).toBe(true)
})
it('is a real executable, not an empty or git-lfs pointer placeholder', () => {
// The real binary is ~5.6 MB; a pointer/placeholder would be a few hundred
// bytes. 1 MB is a comfortable floor that catches either failure mode.
expect(statSync(aria2cPath).size).toBeGreaterThan(1_000_000)
})
})