Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/YT-DLP-NOTICES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ obligation:

The authoritative, version-specific list of bundled components and their
licenses is published by the yt-dlp project at:
https://github.com/yt-dlp/yt-dlp/blob/2026.10.21/THIRD_PARTY_LICENSES.txt
The exact notice for the bundled 2026.10.21 binaries is included at
assets/yt-dlp-2026.10.21-THIRD_PARTY_LICENSES.txt
https://github.com/yt-dlp/yt-dlp/blob/2026.10.26/THIRD_PARTY_LICENSES.txt
The exact notice for the bundled 2026.10.26 binaries is included at
assets/yt-dlp-2026.10.26-THIRD_PARTY_LICENSES.txt
and copied into the app's bundled licenses view and resource directory.

Written Source Offer (GPLv2 Section 3(b))
Expand Down
18 changes: 9 additions & 9 deletions assets/ytdlp-checksums.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"_comment": "Pinned yt-dlp release. Hashes are copied from the GPG-verified upstream SHA2-256SUMS; scripts/fetch-ytdlp.cjs refuses any download that disagrees. Bump with: node scripts/fetch-ytdlp.cjs --update <version>",
"version": "2026.10.21",
"source": "https://github.com/yt-dlp/yt-dlp/releases/tag/2026.10.21",
"_comment": "Pinned yt-dlp release. Hashes are copied from the GPG-verified upstream SHA2-256SUMS; scripts/fetch-ytdlp.cjs refuses any download that disagrees. Bump with: npm run ytdlp:update or node scripts/fetch-ytdlp.cjs --update <version>",
"version": "2026.10.26",
"source": "https://github.com/yt-dlp/yt-dlp/releases/tag/2026.10.26",
"files": {
"yt-dlp.exe": "33121d192d706e62f684a06f80918e3f3a8ba52ac3a65213b6951c39c7d9f555",
"yt-dlp_arm64.exe": "1380a9f105302764e6a5d383c2f07238ae242f0f4fbf3414aea00e56619a79b3",
"yt-dlp_macos": "7a6fe71d7d680f1fb0ac18d4949873d77db2859e90017c0f44bd94b23be4ee40",
"yt-dlp_linux": "d8bd33fca9d5b23bd5b9952b3fca36db5c46331933fda9f598a3da14ce2c243f",
"yt-dlp_linux_aarch64": "e137c2171b0b8ef648e6136e86aa70c65923e93e434f01c93901d64744b190aa"
"yt-dlp.exe": "f5389d3698ecde4ef06f4e6b1ce0294fe9ac1396228c8990b8d3416d6d177a7d",
"yt-dlp_arm64.exe": "0066dbac3c124028e2dcae2a197fccee33cd91f456313d24f7af89fd54590e98",
"yt-dlp_macos": "0f922c15ccc0b83eefa1c8bc9104e434318c4bf16e408e1ee93b7745a6efe0aa",
"yt-dlp_linux": "767ba9dce7052aa196f8b12652f433d76de128ba168966fa84b6394d5e6c6795",
"yt-dlp_linux_aarch64": "e87e9533e89fe5889abaa21f5114dfe7756d6aa6219b83551add04d48b18e483"
},
"license": {
"file": "yt-dlp-2026.10.21-THIRD_PARTY_LICENSES.txt",
"file": "yt-dlp-2026.10.26-THIRD_PARTY_LICENSES.txt",
"sha256": "472aefe951c7db35e1657c1d13fd337140511ed6f2b329205105ad441c5a02b7"
}
}
6 changes: 4 additions & 2 deletions build-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ the bundled license file, the Tauri resource path, and the notices.

A yt-dlp bump needs a patch release because the binaries ship inside the
installers. Target turnaround: merge the watch PR and ship the patch release
within five business days of it opening. Manual bump: run the `--update` command
above, then `npm run ytdlp:fetch:all` and `npm run ytdlp:check`.
within five business days of it opening. To bump manually to the latest
release, run `npm run ytdlp:update`; for a specific tag, run
`node scripts/fetch-ytdlp.cjs --update <version>`, then
`npm run ytdlp:fetch:all` and `npm run ytdlp:check`.

`scripts/copy-bundled-licenses.js` reads the yt-dlp version and license file
from `assets/ytdlp-checksums.json`, so a bump needs no script edit.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"ytdlp:check": "node scripts/check-ytdlp.cjs",
"ytdlp:fetch": "node scripts/fetch-ytdlp.cjs --missing-only",
"ytdlp:fetch:all": "node scripts/fetch-ytdlp.cjs --all --missing-only",
"ytdlp:update": "node scripts/fetch-ytdlp.cjs --update latest && npm run ytdlp:fetch:all && npm run ytdlp:check",
"get:ffmpeg": "dotenv -e .env -- node scripts/get-ffmpeg.cjs",
"get:ffmpeg:all": "dotenv -e .env -- node scripts/get-ffmpeg.cjs --all && node scripts/check-ffmpeg.cjs --all --generate-checksums",
"ffmpeg:ensure": "dotenv -e .env -- node scripts/get-ffmpeg.cjs --missing-only",
Expand Down
43 changes: 37 additions & 6 deletions scripts/fetch-ytdlp.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
* node scripts/fetch-ytdlp.cjs --missing-only skip files already valid
* node scripts/fetch-ytdlp.cjs --all every tracked binary
* node scripts/fetch-ytdlp.cjs --target <triple> explicit Rust triple(s)
* node scripts/fetch-ytdlp.cjs --update <version> bump the manifest from
* the signed upstream sums and fetch the matching license file
* node scripts/fetch-ytdlp.cjs --update <version|latest>
* bump the manifest from the signed upstream sums and fetch the matching
* license file; `latest` is GitHub's newest release (npm run ytdlp:update)
* node scripts/fetch-ytdlp.cjs --allow-unsigned-sums
* Only when gpg is unavailable outside CI. Refused when CI or
* ROSI_RELEASE is set, and refused with --update.
Expand Down Expand Up @@ -427,9 +428,9 @@ function parseArgs(argv, env = process.env) {
index += 1;
} else if (arg === "--update") {
const value = argv[index + 1];
if (!value || !VERSION_PATTERN.test(value)) {
if (!value || (value !== "latest" && !VERSION_PATTERN.test(value))) {
fail(
"--update requires a yt-dlp version such as 2026.08.19 (invalid version)",
"--update requires a yt-dlp version such as 2026.08.19 or 'latest'",
);
}
options.update = value;
Expand Down Expand Up @@ -468,6 +469,32 @@ function releaseBase(version) {
return `https://github.com/${REPO}/releases/download/${version}/`;
}

/** Resolves GitHub's latest non-prerelease release to its validated tag. */
async function resolveLatestVersion() {
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ytdlp-latest-"));
const releasePath = path.join(tempDir, "latest-release.json");
try {
await downloadFile(
`https://api.github.com/repos/${REPO}/releases/latest`,
releasePath,
);
let release;
try {
release = JSON.parse(fs.readFileSync(releasePath, "utf8"));
} catch {
fail("GitHub returned invalid JSON for the latest yt-dlp release");
}
const version = release?.tag_name;
if (typeof version !== "string" || !VERSION_PATTERN.test(version)) {
fail(`Unexpected latest yt-dlp release tag: ${String(version)}`);
}
log(`Latest yt-dlp GitHub release: ${version}`);
return version;
} finally {
fs.rmSync(tempDir, { recursive: true, force: true });
}
}

function localMatches(name, manifest) {
const file = path.join(ASSETS_DIR, name);
return fs.existsSync(file) && sha256File(file) === manifest.files[name];
Expand Down Expand Up @@ -612,7 +639,7 @@ async function updateManifest(version) {
_comment:
"Pinned yt-dlp release. Hashes are copied from the GPG-verified upstream " +
"SHA2-256SUMS; scripts/fetch-ytdlp.cjs refuses any download that disagrees. " +
"Bump with: node scripts/fetch-ytdlp.cjs --update <version>",
"Bump with: npm run ytdlp:update or node scripts/fetch-ytdlp.cjs --update <version>",
version,
source: `https://github.com/${REPO}/releases/tag/${version}`,
files,
Expand Down Expand Up @@ -653,7 +680,11 @@ function replaceOnce(filePath, from, to) {
async function main(argv) {
const options = parseArgs(argv);
if (options.update) {
await updateManifest(options.update);
const version =
options.update === "latest"
? await resolveLatestVersion()
: options.update;
await updateManifest(version);
return;
}
await fetchBinaries(options);
Expand Down
63 changes: 35 additions & 28 deletions scripts/update-metainfo.failure-modes.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# AppStream date refresh failure modes
# AppStream release date failure modes

Written before the code (AGENTS.md). Covers the date refresh in
`scripts/update-metainfo.js`: when `package.json` still has the version of an
existing `<release>` entry, the entry's date is set to today (UTC). `npm run
sync-version` runs the script, so `tauri:dev`, `tauri:build`, `npm run u` and
`workspace:bootstrap` all refresh the date.
Written before the code (AGENTS.md). Covers `scripts/update-metainfo.js`, which
`npm run sync-version` runs on every build (`tauri:dev`, `tauri:build`, every
`build:*`, `npm run u`, `workspace:bootstrap`).

1. The entry already has today's date. Rewriting the file anyway changes
nothing but can still touch it. Expected: no write, reports up to date.
2. The entry has an older date. Expected: only that entry's `date` value
changes; every other byte and every other release entry stays the same.
3. The entry carries other attributes (`type`, `urgency`), puts `date` before
`version`, or has child elements (`<description>`). Expected: only the
`date` value changes; the attributes, their order and the children stay.
Rule since 5.1.0-beta.1: a build never changes the date of a release entry that
already exists. The date is written once, when the entry for a new
`package.json` version is added, and changed only on request with `--redate`
(release preparation, committed with the release). Before this rule every build
re-dated the current entry to today (UTC), so a release machine running on a
later day than the release commit left `run.rosie.rosi.metainfo.xml` modified
and `test:all` refused the quality-gate proof.

1. The current version's entry exists, with any date. Expected: a plain run
writes nothing and reports up to date, on any day. This is the build path.
2. `--redate` and the entry has an older date. Expected: only that entry's
`date` value changes to today (UTC); every other byte and every other
release entry stays the same.
3. `--redate` and the entry carries other attributes (`type`, `urgency`), puts
`date` before `version`, or has child elements (`<description>`). Expected:
only the `date` value changes; the attributes, their order and the children
stay.
4. Another entry's version starts with the current one (`5.0.2` and `5.0.20`,
or `5.0.2` and `5.0.2-beta.1`). Expected: only the exact version is
re-dated.
5. The entry has no `date`. Expected: today's date is added, as before.
6. A stable version with stale prereleases of the same base version and a
stale date. Expected: one write that removes the prereleases and refreshes
the date.
7. `--check`. Expected: never writes. A date that differs from today is not an
error, otherwise the check fails every day after the release commit.
8. A release VM runs on a later UTC day than the release commit. The refresh
dirties the tree and `test:all` refuses the proof. Accepted: release VMs
must run on the same UTC day as the commit, or the entry must be
recommitted with that day's date.
9. Only the entry for the current `package.json` version is refreshed. Older
entries keep their dates, so a later version bump never re-dates shipped
releases.
or `5.0.2` and `5.0.2-beta.1`). Expected: only the exact version is ever
touched.
5. The entry has no `date`. Expected: today's date is added, since an entry
without a date is invalid AppStream.
6. A stable version with stale prereleases of the same base version. Expected:
one write that removes the prereleases; the stable entry's date changes only
with `--redate`.
7. `--check`. Expected: never writes, and a date that differs from today is not
an error.
8. A release machine runs on a later UTC day than the release commit. Expected:
the build leaves the file unchanged, so `test:all` can record its proof.
9. A new version is not listed yet. Expected: an entry with today's date is
added at the top, and older entries keep their dates, so a version bump
never re-dates shipped releases.
23 changes: 14 additions & 9 deletions scripts/update-metainfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function run({
packagePath = pkgPath,
metadataPath = xmlPath,
check = false,
redate = false,
} = {}) {
if (!fs.existsSync(packagePath)) {
throw new Error(`package.json not found at ${packagePath}`);
Expand Down Expand Up @@ -101,8 +102,8 @@ function run({

let updatedSection = releasesSectionMatch[0];
if (existingReleaseMatch) {
// The current version's date follows the day the script last ran, so it
// ends up as the release day. Older entries are never re-dated.
// Builds never re-date an existing entry; only --redate does, so a
// release machine on a later day leaves the file unchanged.
// See update-metainfo.failure-modes.md.
const currentDateMatch = existingReleaseMatch[0].match(/\bdate="([^"]+)"/);
if (currentDateMatch) {
Expand All @@ -115,17 +116,17 @@ function run({
}
return { updated: false, version, date: currentDateMatch[1] };
}
const redated = existingReleaseMatch[0].replace(
/\bdate="[^"]+"/,
`date="${dateStr}"`,
);
const redated = redate
? existingReleaseMatch[0].replace(/\bdate="[^"]+"/, `date="${dateStr}"`)
: existingReleaseMatch[0];
updatedSection = pruned.replace(existingReleaseMatch[0], redated);
const date = redate ? dateStr : currentDateMatch[1];
if (updatedSection === releasesSectionMatch[0]) {
return { updated: false, version, date: dateStr };
return { updated: false, version, date };
}
const updatedXml = xml.replace(releasesSectionRegex, updatedSection);
fs.writeFileSync(metadataPath, updatedXml, "utf8");
return { updated: true, version, date: dateStr };
return { updated: true, version, date };
}
if (check) {
throw new Error(
Expand Down Expand Up @@ -178,7 +179,11 @@ function isDirectExecution(

if (isDirectExecution()) {
try {
const result = run({ check: process.argv.slice(2).includes("--check") });
const args = process.argv.slice(2);
const result = run({
check: args.includes("--check"),
redate: args.includes("--redate"),
});
if (result.updated) {
console.log(
`Updated AppStream release to ${result.version} (${result.date})`,
Expand Down
Loading
Loading