535005b3d5b9657d6e3b7e75a6bde8e926cc86f9
8 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
96b12b66e2 |
fix: disable legacy JS interference and secure HTML delivery
- Neutralized downloads.js, watchlist-ui.js, and anime.js to prevent conflicts with HTMX - Guaranteed HTML responses in router_downloads.py via strict header detection - Unified frontend logic to follow the new server-driven architecture |
||
|
|
da5403a307 |
feat: Complete watchlist & auto-download system with UI
Implement comprehensive watchlist system with automatic episode detection
and downloading. Features include per-user watchlists, scheduler-based
periodic checks, and a modern web UI.
**Backend Components:**
- WatchlistManager: JSON-based storage with multi-tenant support
- EpisodeChecker: Detects and downloads new episodes automatically
- AutoDownloadScheduler: APScheduler-based periodic task execution
- Complete REST API for CRUD operations and scheduler control
**Frontend Components:**
- Modern watchlist page with dark theme and animations
- Real-time status updates and progress tracking
- Scheduler controls with next-run display
- Add anime directly from search results
**Models & Configuration:**
- WatchlistItem with status, quality, and auto-download settings
- WatchlistSettings for global configuration
- Per-user statistics and provider tracking
**API Endpoints:**
- GET/POST /api/watchlist - List and add items
- PUT/DELETE /api/watchlist/{id} - Update and delete
- POST /api/watchlist/{id}/check - Manual check trigger
- POST /api/watchlist/check-all - Check all due items
- GET/PUT /api/watchlist/settings - Global settings
- GET /api/watchlist/stats - Statistics
- GET/POST /api/watchlist/scheduler/* - Scheduler control
**Configuration Files:**
- config/watchlist.json - User watchlist data
- config/watchlist_settings.json - Global settings
Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
|
||
|
|
c6be191699 |
feat: Complete watchlist & auto-download system with UI
## Backend Implementation (100% Complete)
### Core Components
- **WatchlistManager**: JSON-based storage with full CRUD operations
- User-scoped data access for multi-tenant support
- Statistics and query functions
- Settings management with persistence
- **EpisodeChecker**: Automatic new episode detection
- Checks for new episodes using existing downloaders
- Automatic download with error handling
- Manual and scheduled check support
- Lazy initialization to avoid circular imports
- **AutoDownloadScheduler**: APScheduler-based periodic checking
- Configurable intervals (1-168 hours)
- Start/stop/restart controls
- Next run time tracking
### API Endpoints (15 endpoints)
- POST /api/watchlist - Add anime to watchlist
- GET /api/watchlist - Get user's watchlist (with status filter)
- GET /api/watchlist/{id} - Get specific item
- PUT /api/watchlist/{id} - Update item
- DELETE /api/watchlist/{id} - Delete item
- POST /api/watchlist/{id}/check - Check for new episodes
- POST /api/watchlist/{id}/pause - Pause tracking
- POST /api/watchlist/{id}/resume - Resume tracking
- GET /api/watchlist/settings - Get settings
- PUT /api/watchlist/settings - Update settings
- GET /api/watchlist/stats - Get statistics
- POST /api/watchlist/check-all - Check all items
- GET /api/watchlist/scheduler/status - Scheduler status
- POST /api/watchlist/scheduler/start - Start scheduler
- POST /api/watchlist/scheduler/stop - Stop scheduler
### Bug Fixes
- Fixed WatchlistManager.update() to accept both dict and WatchlistItemUpdate
- Added asyncio import to AutoDownloadScheduler for event loop detection
- Improved scheduler start() with better error handling
## Frontend Implementation (100% Complete)
### UI Components
- **Watchlist Page** (/watchlist)
- Scheduler status panel with start/stop/check all buttons
- Filter tabs (all/active/paused/completed)
- Statistics display with color-coded cards
- Watchlist items with pause/resume/delete controls
- Auto-refresh every 30 seconds
- Authentication check
- **Settings Modal**
- Check interval configuration (1-168h)
- Auto-download toggle
- Max concurrent downloads slider
- Notifications toggle
- Live settings update with scheduler restart
- **"Suivre" Button**
- Added to anime search result cards
- Purple gradient with heart icon
- Quick-add to watchlist functionality
- State tracking (disabled when already in watchlist)
### JavaScript Files
- **static/js/watchlist.js**: API client functions
- All watchlist API calls with token auth
- Error handling and response parsing
- **static/js/watchlist-ui.js**: UI functions
- Display watchlist with stats
- Handle add/pause/resume/delete
- Filter by status
- Settings modal management
- **static/js/tabs.js**: Watchlist tab handler
- Redirects to /watchlist page
## Testing
### Test Suite (test_watchlist_simple.py)
All tests passing (3/3):
1. **Watchlist Manager Tests** ✅
- Create/read/update/delete operations
- User-scoped queries
- Statistics generation
- Check time updates
2. **Settings Tests** ✅
- Get current settings
- Update settings with validation
- Reset to defaults
3. **Scheduler Tests** ✅
- Start/stop/restart controls
- Running status verification
- Next run time tracking
### Dependencies
- APScheduler 3.11.0 installed in virtual environment
- tzlocal 5.3.1 (APScheduler dependency)
## Documentation
- docs/WATCHLIST_AUTO_DOWNLOAD.md: Complete system documentation
- API endpoints with examples
- Architecture overview
- Usage examples
- Troubleshooting guide
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>
|
||
|
|
7dabce1c3c |
refactor: Apply code quality improvements from PR review
This commit implements the optional improvements identified during code review: **Backend (animesama.py):** - Replace all print() statements with logger calls for consistency - Use logger.debug() for detailed debugging information - Use logger.info() for general operational messages - Use logger.warning() for non-critical issues - Use logger.error() for error conditions - Add comprehensive docstring to get_seasons() method: - Document two-phase parallel loading strategy - Explain performance characteristics (200x faster) - Document timeout behavior and error handling - Include usage examples and return value format - Import logging module and initialize logger **Frontend (anime.js & api.js):** - Create providerSupportsSeasons() helper function in api.js: - Uses provider configuration as single source of truth - Eliminates hardcoded 'animesama' and 'anime-sama' checks - Supports explicit supports_seasons flag in provider config - Fallback to domain detection for unknown URLs - Update renderAnimeCard() to use async helper function - Update loadSeasonsForAnime() to use provider configuration - Update displaySearchResults() to handle async card rendering - Export helper function globally for use across modules **Tests (test_anime_sama_seasons.py):** - Fix import paths for new animesama.py location - Update from app.downloaders.animesama to app.downloaders.anime_sites.animesama - All tests passing with new structure **Benefits:** - Consistent logging throughout the codebase - Better maintainability with configuration-driven behavior - Improved documentation for complex async logic - Easier to add new season-supporting providers in future - No hardcoded provider checks in frontend code All tests passing: 5/5 ✅ Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> |
||
|
|
764b4e2edd |
fix: Address critical issues from PR review
Fix 4 critical issues identified in code review:
**Error Handling Improvements:**
- Replace bare except blocks with specific exception handlers
- Add logging for TimeoutException and ConnectError
- Prevent silent failures in season loading
- Remove misleading "0 episodes" on error
**Robustness Fixes:**
- Add safe None handling in title comparison (main.py)
Prevents crash when title is None
- Add URL validation before encodeURIComponent (anime.js)
Prevents crash when anime.url is undefined
- Fix unreachable code in retry logic (recommendations.py)
Preserve retry context in exception messages
**Changes:**
- animesama.py: Specific exception handling with print statements
- main.py: Safe None handling with (x.get('title') or '')
- anime.js: URL validation before encoding
- recommendations.py: Better exception messages with retry context
All fixes tested and working correctly.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>
|
||
|
|
d82bec92b4 |
fix: Optimize Anime-Sama season loading and fix display issues
Major performance improvements and bug fixes for Anime-Sama integration: **Backend Optimizations:** - Parallel season loading with asyncio.gather() (200x faster: 50s → 0.25s) - Filter out empty seasons to avoid unnecessary HTML parsing - Reduced timeout from 5s to 3s for quick season checks - Optimized fallback method to detect empty seasons instantly **Frontend Fixes:** - Fixed infinite "Chargement des saisons..." by ensuring DOM exists before loading - Added 15-second timeout with retry functionality for season loading - Staggered requests (500ms delay) to prevent overwhelming the server - Duplicate request prevention with dataset.loading flag **Search Improvements:** - Separated anime and series provider searches - Intelligent query variations (original, normalized, first word) - Better error handling with user-friendly messages **UI Fixes:** - Added missing id="mainTabs" to navigation header - Fixed tabs visibility for authenticated users **Performance:** 10 seasons loaded in 0.25s instead of 50+ seconds Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> |
||
|
|
c1c31d7685 |
feat: Add series TV support with Vidzy HLS downloads and duplicate prevention
Major improvements: - Series TV support via FS7 provider with dedicated search endpoint - Vidzy downloader now uses Playwright for JS obfuscation and ffmpeg for HLS streams - Episode filenames properly named (Series Title - Episode X) instead of master.m3u8.mp4 - Duplicate download prevention: checks existing tasks before creating new ones - Removed host preference system in favor of intelligent URL-based detection Technical changes: - Vidzy: Added Playwright extraction and M3U8→MP4 conversion with ffmpeg - FS7: Episodes now use pipe format (video_url|series_url|episode_title) - DownloadManager: Extract target_filename from pipe URL and prevent duplicates - UI: New Series tab with search, recommendations, and releases sections - Anime-Sama: Removed hardcoded host preferences, uses site's URL order Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> |
||
|
|
1fe7392063 |
feat: Complete Sonarr integration with security enhancements
This commit adds comprehensive Sonarr webhook integration and implements critical security improvements identified in code review. ## Sonarr Integration - Full webhook support for Grab, Download, Rename, Delete, and Test events - HMAC SHA256 signature verification for webhook authentication - Series mapping system (Sonarr TVDB ID → Anime Provider URL) - 11 new API endpoints for configuration, mappings, search, and downloads - Comprehensive test suite (31 tests, all passing) - Complete documentation in docs/SONARR_INTEGRATION.md ## Security Enhancements - CORS restricted to specific origins (user's IP: 192.168.1.204:3000) - Path traversal prevention via sanitize_filename() and is_safe_filename() - Structured logging infrastructure (replaced all print() statements) - Environment-based configuration with .env support - Filename sanitization prevents malicious path attacks ## New Features - Lpayer and Sibnet downloader support - Kitsu API integration for anime metadata - Recommendation engine based on download history - Latest releases endpoint for new anime - Modular web interface with component-based templates ## Configuration - Centralized settings via app/config.py with pydantic-settings - Sonarr config auto-created in config/ directory - Example configurations provided for easy setup ## Tests - 31 Sonarr integration tests (23 functionality + 9 security) - 100+ tests passing in core test files - Security utilities fully tested ## Documentation - Updated CLAUDE.md with Sonarr and testing info - Added IMPROVEMENTS_2024-01-24.md analysis - Added SONARR_IMPLEMENTATION.md technical summary Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]> |