redlib icon indicating copy to clipboard operation
redlib copied to clipboard

feat(video): add RedGifs video support with proxy

Open mtsz-pl opened this issue 2 months ago • 0 comments

Add support for RedGifs videos embedded in Reddit posts. Videos are proxied through redlib for privacy, similar to v.redd.it handling.

Features:

  • Detect RedGifs posts and proxy videos through /redgifs/ endpoint
  • Two-step flow: video ID lookup via API, then proxy video file
  • Token caching with 24h expiry for RedGifs API authentication
  • Prefer HD quality, fallback to SD automatically
  • Lazy loading with preload="metadata" to save bandwidth

Security:

  • Strict domain validation (only legitimate redgifs.com domains)
  • File extension validation (only .mp4 files)
  • Query parameter stripping from video IDs
  • Pattern matching for all versioned CDN subdomains (v1, v2, etc.)

Implementation:

  • New redgifs module with API integration
  • Reuses existing proxy infrastructure
  • Domain validation helper for consistent security checks

Fixes #20

mtsz-pl avatar Nov 19 '25 21:11 mtsz-pl