Load newest albums and complete song pages, add a Songs view, bundle FFmpeg, persist credentials securely, and serve the managed library on the LAN
Hop-State: A_06FNEJ4B52YWW6V4DQKVHXR Hop-Proposal: R_06FNEJ37KHGP1VCKVNTV95R Hop-Task: T_06FNEEBRXR47KT7H71N5H68 Hop-Attempt: AT_06FNEEBRXS5YEZ0KZ4MTDZG
This commit is contained in:
@@ -4,6 +4,7 @@ import { chmod, copyFile, mkdir, mkdtemp, readFile, rm, writeFile } from "node:f
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import ffmpegPath from "ffmpeg-static";
|
||||
|
||||
const VERSION = "0.61.2";
|
||||
const RELEASE_API = `https://api.github.com/repos/navidrome/navidrome/releases/tags/v${VERSION}`;
|
||||
@@ -26,13 +27,17 @@ if (!archiveName) {
|
||||
const extension = targetTriple.includes("windows") ? ".exe" : "";
|
||||
const outputDirectory = join(projectRoot, "src-tauri/binaries");
|
||||
const outputPath = join(outputDirectory, `navidrome-${targetTriple}${extension}`);
|
||||
const ffmpegOutputPath = join(outputDirectory, `ffmpeg-${targetTriple}${extension}`);
|
||||
const resourceDirectory = join(projectRoot, "src-tauri/resources");
|
||||
const licensePath = join(resourceDirectory, "navidrome-LICENSE");
|
||||
const ffmpegLicensePath = join(resourceDirectory, "ffmpeg-LICENSE");
|
||||
const ffmpegReadmePath = join(resourceDirectory, "ffmpeg-README");
|
||||
|
||||
await mkdir(outputDirectory, { recursive: true });
|
||||
await mkdir(resourceDirectory, { recursive: true });
|
||||
let binaryReady = false;
|
||||
let licenseReady = false;
|
||||
let ffmpegReady = false;
|
||||
try {
|
||||
await readFile(outputPath);
|
||||
binaryReady = true;
|
||||
@@ -45,6 +50,20 @@ try {
|
||||
} catch {
|
||||
// Include Navidrome's GPL license in the packaged app when missing.
|
||||
}
|
||||
try {
|
||||
await readFile(ffmpegOutputPath);
|
||||
ffmpegReady = true;
|
||||
} catch {
|
||||
// Copy the pinned npm-provided binary below when missing.
|
||||
}
|
||||
|
||||
if (!ffmpegPath) throw new Error(`ffmpeg-static does not provide a binary for ${process.platform}-${process.arch}.`);
|
||||
if (!ffmpegReady) {
|
||||
await copyFile(ffmpegPath, ffmpegOutputPath);
|
||||
if (!extension) await chmod(ffmpegOutputPath, 0o755);
|
||||
}
|
||||
await copyFile(join(dirname(ffmpegPath), "ffmpeg.LICENSE"), ffmpegLicensePath);
|
||||
await copyFile(join(dirname(ffmpegPath), "ffmpeg.README"), ffmpegReadmePath);
|
||||
|
||||
const headers = { Accept: "application/vnd.github+json", "User-Agent": "Resonant-sidecar-preparer" };
|
||||
if (!licenseReady) {
|
||||
@@ -53,7 +72,7 @@ if (!licenseReady) {
|
||||
await writeFile(licensePath, await licenseResponse.text());
|
||||
}
|
||||
if (binaryReady) {
|
||||
process.stdout.write(`Navidrome ${VERSION} sidecar is ready for ${targetTriple}.\n`);
|
||||
process.stdout.write(`Navidrome ${VERSION} and FFmpeg sidecars are ready for ${targetTriple}.\n`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -84,4 +103,4 @@ try {
|
||||
await rm(workingDirectory, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
process.stdout.write(`Downloaded and verified Navidrome ${VERSION} for ${targetTriple}.\n`);
|
||||
process.stdout.write(`Downloaded and verified Navidrome ${VERSION}; FFmpeg is ready for ${targetTriple}.\n`);
|
||||
|
||||
Reference in New Issue
Block a user