Feature: Add video download support (#202)#497
Merged
filthyrake merged 2 commits intodevfrom Jan 4, 2026
Merged
Conversation
Add configuration and API endpoints for video download functionality.
Downloads are disabled by default for security, requiring explicit
opt-in via environment variables or admin settings.
Configuration options:
- VLOG_DOWNLOADS_ENABLED: Master switch (default: false)
- VLOG_DOWNLOADS_REQUIRE_AUTH: Auth requirement (default: true)
- VLOG_DOWNLOADS_ALLOW_ORIGINAL: Original file downloads (default: false)
- VLOG_DOWNLOADS_ALLOW_TRANSCODED: Transcoded quality downloads (default: true)
- VLOG_DOWNLOADS_RATE_LIMIT_PER_HOUR: Rate limiting (default: 10/hour)
- VLOG_DOWNLOADS_MAX_CONCURRENT: Concurrency limit (default: 2)
Changes:
- Add download configuration to config.py with secure defaults
- Add download settings to settings_service.py for database-backed config
- Add /api/config/downloads endpoint for UI configuration
- Add /api/videos/{slug}/download/original endpoint for original files
- Add download button to watch.html (conditionally shown when enabled)
- Update .env.example with documentation for all new settings
Note: Transcoded quality downloads (MP4 from HLS/DASH segments) are
planned for a future release. Currently only original file downloads
are supported.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Critical fixes from security, reliability, and performance reviews: Security (Bruce): - Remove unimplemented require_auth setting to avoid false security - Add RFC 5987 filename encoding to prevent header injection - Validate file extension is in allowed list before serving - Add proper media type detection based on file extension Reliability (Margo): - Add asyncio.Lock to prevent cache thundering herd on expiry - Implement concurrent download tracking with proper slot management - Add comprehensive filesystem error handling (OSError, permissions) - Add file validation (empty files, size limits, readable check) - Add storage availability dependency check - Reduce TOCTOU window with final validation before serving - Change logging from DEBUG to WARNING for operational issues Performance (Brendan): - Implement max_concurrent enforcement (was configured but not used) - Add 100GB file size sanity check - Document that rate limit requires restart to change Code Quality: - Add comprehensive test suite (18 tests covering all scenarios) - Improve filename sanitization (length limit, space handling) - Add proper docstrings with raised exceptions documented 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
Author
Code Review Fixes AppliedAll issues identified by the specialized review agents have been addressed: Critical Fixes
Security Fixes
Reliability Fixes
Performance Fixes
Tests Added
All 18 tests pass. Ready for re-review! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements video download functionality for the VLog platform (Issue #202).
Configuration Options
VLOG_DOWNLOADS_ENABLEDfalseVLOG_DOWNLOADS_REQUIRE_AUTHtrueVLOG_DOWNLOADS_ALLOW_ORIGINALfalseVLOG_DOWNLOADS_ALLOW_TRANSCODEDtrueVLOG_DOWNLOADS_RATE_LIMIT_PER_HOUR10VLOG_DOWNLOADS_MAX_CONCURRENT2Changes
/api/config/downloadsand/api/videos/{slug}/download/originalendpointsTest Plan
VLOG_DOWNLOADS_ENABLED=trueand verify config endpoint returns enabledVLOG_DOWNLOADS_ALLOW_ORIGINAL=trueand verify download button appearsFuture Work
require_authsettingCloses #202
🤖 Generated with Claude Code