diff --git a/.claude/settings.local.json b/.claude/settings.local.json index a86b1c6..a329582 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -6,7 +6,8 @@ "Bash(npm run build:*)", "Bash(nginx -t:*)", "Bash(sudo nginx:*)", - "Bash(ln -s:*)" + "Bash(ln -s:*)", + "Bash(curl:*)" ] } } diff --git a/server/convert-webm.js b/server/convert-webm.js index 33cc2df..7facbaa 100644 --- a/server/convert-webm.js +++ b/server/convert-webm.js @@ -5,6 +5,9 @@ import sqlite3 from 'sqlite3'; import { open } from 'sqlite'; import { spawn } from 'child_process'; +// Find ffmpeg binary +const FFMPEG = ['/opt/homebrew/bin/ffmpeg', '/usr/bin/ffmpeg'].find(p => fs.existsSync(p)) || 'ffmpeg'; + const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const mediaDir = path.join(__dirname, '..', 'public', 'media'); @@ -24,7 +27,7 @@ const transcodeToMp4 = (inputPath, outputPath) => new Promise((resolve, reject) outputPath ]; - const ffmpeg = spawn('ffmpeg', args, { stdio: 'ignore' }); + const ffmpeg = spawn(FFMPEG, args, { stdio: 'ignore' }); ffmpeg.on('error', reject); ffmpeg.on('close', (code) => { if (code === 0) { diff --git a/server/index.js b/server/index.js index 5c9c5ee..380caa9 100644 --- a/server/index.js +++ b/server/index.js @@ -9,6 +9,9 @@ import { fileURLToPath } from 'url'; import fs from 'fs'; import { spawn } from 'child_process'; +// Find ffmpeg binary +const FFMPEG = ['/opt/homebrew/bin/ffmpeg', '/usr/bin/ffmpeg'].find(p => fs.existsSync(p)) || 'ffmpeg'; + // Generate a unique link ID const generateUniqueId = () => { return crypto.randomBytes(8).toString('hex'); @@ -25,7 +28,7 @@ app.use(cors()); app.use(express.json()); // Ensure media directory exists -const mediaDir = path.join(__dirname, '..', 'public', 'media'); +const mediaDir = '/opt/homebrew/var/www/signsync/media'; if (!fs.existsSync(mediaDir)) { fs.mkdirSync(mediaDir, { recursive: true }); } @@ -81,7 +84,7 @@ const transcodeToMp4 = (inputPath, outputPath) => new Promise((resolve, reject) outputPath ]; - const ffmpeg = spawn('ffmpeg', args, { stdio: 'ignore' }); + const ffmpeg = spawn(FFMPEG, args, { stdio: 'ignore' }); ffmpeg.on('error', reject); ffmpeg.on('close', (code) => { if (code === 0) { diff --git a/server/signsync.db b/server/signsync.db index f8bcf43..71181ef 100644 Binary files a/server/signsync.db and b/server/signsync.db differ