Changeset 7d01696 in Klonkt for src/routes/activitypub.js
- Timestamp:
- 07/30/2026 07:56:33 AM (6 weeks ago)
- Branches:
- main
- Children:
- 9ed940e
- Parents:
- 97bcf7e
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r97bcf7e r7d01696 312 312 return res.status(400).json({ error: 'Media must be an image, audio or video file' }); 313 313 } 314 // A video gets a poster frame next to it (shaer-zowq), best-effort and 315 // out of band: ffmpeg pulls one frame at 1s into <name>.poster.jpg. On a 316 // machine without ffmpeg nothing happens and nothing breaks; the clients 317 // fall back to extracting a frame natively. 318 if (mime.startsWith('video/')) { 319 import('child_process').then(({ execFile }) => { 320 const poster = req.file.path + '.poster.jpg'; 321 execFile('ffmpeg', ['-y', '-ss', '1', '-i', req.file.path, '-frames:v', '1', '-vf', "scale='min(640,iw)':-2", poster], 322 { timeout: 30000 }, (e) => { if (e && e.code !== 'ENOENT') console.warn('[media] poster failed:', e.message); }); 323 }).catch(() => { /* never blocks the upload */ }); 324 } 314 325 res.status(201).json({ 315 326 url: '/media/reply-media/' + req.file.filename,
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)