diff --git a/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe b/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe index ca0431a..b25309f 100644 --- a/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe +++ b/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:33cfe0a3542db64f7a2a7dfe46eb82716ff4bfad042f95ca530349b87c151d8e -size 18143557 +oid sha256:f26019446a303dfa16f5a4b60e03e853a5d1e0d44a682b31e5cfd2622c0ce2fd +size 18152568 diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index ce59bb2..9674244 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -2,7 +2,7 @@ "identifier": "com.neosubhamoy.neodlp", "build": { "beforeDevCommand": "cargo build --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && npm run dev", - "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && npm run build", + "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && node updateYtDlpBinary.js x86_64-unknown-linux-gnu && npm run build", "devUrl": "http://localhost:1420", "frontendDist": "../dist" }, diff --git a/src-tauri/tauri.macos-aarch64.conf.json b/src-tauri/tauri.macos-aarch64.conf.json index 8478ca6..52a814e 100644 --- a/src-tauri/tauri.macos-aarch64.conf.json +++ b/src-tauri/tauri.macos-aarch64.conf.json @@ -2,7 +2,7 @@ "identifier": "com.neosubhamoy.neodlp", "build": { "beforeDevCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && npm run dev", - "beforeBuildCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --release --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && npm run build", + "beforeBuildCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --release --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && node updateYtDlpBinary.js aarch64-apple-darwin && npm run build", "devUrl": "http://localhost:1420", "frontendDist": "../dist" }, diff --git a/src-tauri/tauri.macos-x86_64.conf.json b/src-tauri/tauri.macos-x86_64.conf.json index d0cbac1..18f499a 100644 --- a/src-tauri/tauri.macos-x86_64.conf.json +++ b/src-tauri/tauri.macos-x86_64.conf.json @@ -2,7 +2,7 @@ "identifier": "com.neosubhamoy.neodlp", "build": { "beforeDevCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && npm run dev", - "beforeBuildCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --release --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && npm run build", + "beforeBuildCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --release --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && node makeFilesExecutable.js && node updateYtDlpBinary.js x86_64-apple-darwin && npm run build", "devUrl": "http://localhost:1420", "frontendDist": "../dist" }, diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index 80c0f80..4f21469 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -2,7 +2,7 @@ "identifier": "com.neosubhamoy.neodlp", "build": { "beforeDevCommand": "cargo build --manifest-path=./src-tauri/msghost/Cargo.toml && npm run dev", - "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && npm run build", + "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && node updateYtDlpBinary.js x86_64-pc-windows-msvc && npm run build", "devUrl": "http://localhost:1420", "frontendDist": "../dist" }, diff --git a/updateYtDlpBinary.js b/updateYtDlpBinary.js new file mode 100644 index 0000000..609798f --- /dev/null +++ b/updateYtDlpBinary.js @@ -0,0 +1,56 @@ +import fs from 'fs'; +import path from 'path'; +import { execFile } from 'child_process'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +console.log(`RUNNING: 🛠️ Build Script updateYtDlpBinary.js`); + +// Get the platform triple from command line arguments +const platformTriple = process.argv[2]; + +if (!platformTriple) { + console.error('Error: Please provide a platform triple'); + process.exit(1); +} + +// Define the binaries directory +const binariesDir = path.join(__dirname, 'src-tauri', 'binaries'); + +// Construct the binary filename based on platform triple +let binaryName = `yt-dlp-${platformTriple}`; +if (platformTriple === 'x86_64-pc-windows-msvc') { + binaryName += '.exe'; +} + +// Full path to the binary +const binaryPath = path.join(binariesDir, binaryName); + +// Check if binary exists +if (!fs.existsSync(binaryPath)) { + console.error(`Error: Binary not found at: ${binaryPath}`); + process.exit(1); +} + +console.log(`Found binary at: ${binaryPath}`); + +// Make binary executable if not on Windows +if (platformTriple !== 'x86_64-pc-windows-msvc') { + console.log('Making binary executable...'); + fs.chmodSync(binaryPath, 0o755); +} + +// Execute the update command +console.log(`Updating ${platformTriple} binary to latest nightly version...`); +execFile(binaryPath, ['--update-to', 'nightly'], (error, stdout, stderr) => { + if (error) { + console.error(`Error updating binary: ${error.message}`); + if (stderr) console.error(stderr); + process.exit(1); + } + + console.log(`Update successful for ${platformTriple}:`); + console.log(stdout); +}); \ No newline at end of file