Commit Graph

1 Commits

Author SHA1 Message Date
8614161f91 Add bulk GIF regeneration endpoint for production deployment
Problem: Production server has different video UUIDs than development,
so GIF files generated locally don't match production video filenames.

Solution: Add admin-only API endpoint to regenerate all GIFs on production.

Backend changes:
- Add POST /api/terms/regenerate-all-gifs endpoint (admin only)
- Processes all videos in database and generates GIF previews
- Returns detailed results: total, success, failed counts and error messages
- Automatically creates /uploads/gifs/ directory if missing
- Deletes old GIF files and database records before regenerating
- Uses same GIF generation settings as upload (300px, 10fps, 3sec)

Docker changes:
- Add REGENERATE_GIFS environment variable to docker-entrypoint.sh
- If set to 'true', runs regenerate-all-gifs.ts script on container startup
- Useful for initial deployment or after restoring from backup

Usage:
  # Via API (recommended):
  POST /api/terms/regenerate-all-gifs
  (requires admin authentication)

  # Via Docker env var:
  docker run -e REGENERATE_GIFS=true ...

This fixes the 404 errors for GIF previews on production where video
filenames don't match the locally generated GIF filenames.

Co-Authored-By: Auggie
2026-01-18 18:30:31 +01:00