Commit graph

105 commits

Author SHA1 Message Date
LimeDrive
e8b0976332 refactor(logging): switch info/debug logs to trace across modules
convert info/debug logs to trace across modules for deeper diagnostics
without changing behavior
2026-04-03 12:09:26 +02:00
LimeDrive
acef8f2516 feat(torrent-group): add initial grouping framework for torrents
introduce initial torrent grouping: add torrent_groups table and
group_id on torrent_items. include migrations, ORM models, and DAOs.
expose admin/web endpoints to group by info_hash and by title/size.
propagate tmdb_id across grouped items. non-destructive and backwards
compatible with existing data
2026-04-02 16:13:09 +02:00
HyPnoTiiK
cc37768749 Corrected var name icon -> logo for Stremio addon logo 2026-04-01 23:04:18 -04:00
LimeDrive
76bb5ab8aa feat: améliorer la gestion des filtres et ajuster le délai de rafraîchissement en arrière-plan 2026-04-01 18:10:22 +02:00
LimeDrive
9fae550343 feat: Ajouter la gestion du TTL pour le verrou Redis par indexeur lors du rafraîchissement en arrière-plan 2026-04-01 15:54:58 +02:00
LimeDrive
d65366cce2 feat: Ajouter la gestion du cache local Postgres avec des paramètres de résultats minimum et de durée de validité 2026-04-01 15:37:54 +02:00
LimeDrive
15f3d1facb feat: Refactor torrent filtering and TMDB ID assignment logic for improved accuracy 2026-04-01 13:25:37 +02:00
LimeDrive
6ba93612d4 feat: améliorer le traitement des résultats pour gérer les données de manière plus flexible 2026-03-31 03:28:01 +02:00
LimeDrive
c635719789 feat: refactor search logic to use phase-based indexer fetching and improve error handling 2026-03-31 02:22:30 +02:00
LimeDrive
fb019a85bf feat(search): add configurable indexer search phases and RealDebrid optimization
Introduce a 4-phase search system where private indexers are grouped by priority:
- Phase 1 (priority_private): always queried first
- Phase 2 (intermediary_private): queried only if private results < minCachedResults
- Phase 3 (fallback_private): queried only if still insufficient
- Phase 4 (public): Yggflix relay position controlled by yggflixPriority toggle

Add rdMinCachedBeforeCheck setting to skip RealDebrid if prior services already found enough cached results, since RD API is slow (~3s) and rate-limited. Default to 3.

Non-blocking magnet cleanup in AllDebrid availability checks via background task. G3MINI now computes info_hash from .torrent files when API omits it. Public indexer results are excluded from final matches unless already cached by a debrid service.
2026-03-30 17:49:18 +02:00
LimeDrive
0d0c238383 feat(trackers): add support for ABN, G3MINI, and TheOldSchool UNIT3D indexers
Remove deprecated Sharewood tracker integration and add three new private trackers:
- ABN (Abnormal): keyword-based search with name filtering
- G3MINI (Gemini Tracker): TMDB/IMDB ID-based filtering
- TheOldSchool: TMDB/IMDB ID-based filtering

Includes new API clients, result parsers, and service layers. Updates frontend UI, settings configuration, and credential handling to support the new indexers with proper passkey management.
2026-03-30 14:23:20 +02:00
LimeDrive
7755a78842 feat(security): add Fernet encryption for config tokens and CSRF protection
- Implement Fernet encryption for configuration URLs to protect sensitive user settings
- Add CONFIG_SECRET_KEY environment variable for key derivation
- Add server-side /api/config/encode endpoint for secure config token generation
- Add CSRF token generation and validation for all admin POST routes
- Auto-inject CSRF tokens into admin forms and AJAX requests via JavaScript
- Update frontend to use async server encoding instead of client-side Base64
- Add localStorage fallback for config restoration on /configure pages
- Maintain backward compatibility with existing Base64-encoded URLs
- Log warning at startup if CONFIG_SECRET_KEY is not configured
- Convert debug logs to trace level in TorrentSmartContainer for reduced noise
2026-03-30 01:18:08 +02:00
LimeDrive
bdc09d69f7 fix: apply compatibility fixes for new admin architecture 2026-03-29 17:54:55 +02:00
LimeDrive
8468bae024 feat(admin): add metadata mappings table and complete admin UI redesign
Introduce a metadata_mappings table with DAO/model layers for admin-managed
IMDB→TMDB/title overrides, and overhaul the admin panel with a modern
Bootstrap 5 sidebar UI.

- Add metadata_mappings table with migrations (search_titles, year_override)
- Add MetadataMappingDAO with standalone session helpers for use outside FastAPI
- Add new admin pages: dashboard, mappings CRUD, maintenance, config, hash/TMDB search
- Integrate DB mapping lookups into Cinemeta and TMDB metadata providers
- Update catalog views to use DB mappings before hitting external APIs
- Rewrite all admin templates with Bootstrap 5, sidebar navigation, French labels
- Add session-based auth for admin routes with Redis session store
2026-03-29 04:46:51 +02:00
LimeDrive
0c1d305784 feat(debrid): add PostgreSQL L2 cache for persistent debrid availability
Add a two-level caching architecture for debrid service availability lookups:
- L1: Redis (existing) with 10-day TTL for fast in-memory access
- L2: PostgreSQL with 30-day TTL for persistent caching across Redis restarts

Changes:
- Add `debrid_cache` table with unique constraint on (info_hash, service) and indexes for efficient queries
- Create `DebridCacheDAO` with batch get/upsert and invalidation methods
- Add pgCron job to periodically clean up expired cache entries
- Extend `get_availability_bulk_cached` to check PG on Redis miss, warm Redis from PG hits, and write confirmed-cached results to PG
- Add `invalidate_availability_cache` method to remove false positives from both caches when NO_CACHE_VIDEO_URL is returned during playback
- Integrate `db_session` dependency into playback and search views
- Add retry handling to Yggflix API (3 retries, ignore Retry-After headers) and rate-limiting delay (0.3s) between consecutive queries
2026-03-26 15:47:37 +01:00
LimeDrive
9203464680 refactor(logging): downgrade verbose log levels from info to debug/trace
Lower log verbosity across the codebase by converting info-level logs to debug
and debug-level logs to trace. This reduces noise in production while keeping
detailed information available for debugging when needed.

Affected modules: API key DAO, Real Debrid token manager, C411/Torr9/YGG
indexers, debrid services, torrent container, playback/stream handlers,
search views, and utility modules.
2026-03-26 13:49:57 +01:00
LimeDrive
62fb267622 refactor(logging): optimize log levels and enhance secret redaction
Convert verbose debug messages to trace level for cleaner production logs, improve secret redaction patterns to handle JWT tokens and API key parameters while preserving parameter names, and standardize log messages to English for consistency across the codebase.
2026-03-25 16:56:32 +01:00
LimeCat on the Hub's
1be159afb3
Merge pull request #86 from LimeHubs/limedrive/develop
Refactor filtering logic and improve performance with caching
2026-03-25 05:13:32 +01:00
LimeDrive
25388fa87c refactor: Use asyncio.to_thread for filter_items to improve performance in search results processing 2026-03-25 04:39:06 +01:00
LimeDrive
ce2e88a24d refactor: Supprimer le cache public et les références associées 2026-03-25 03:36:36 +01:00
LimeDrive
3a5e3ce962 refactor: extract next episode logic into a separate function and optimize cache handling 2026-03-24 20:55:47 +01:00
LimeDrive
310b20de6e perf: async cleanup and small parallelization improvements
- torrent_smart_container: remove redundant threading.Thread from
  cache_container_items() — already runs via asyncio.to_thread() at
  call sites, internal thread was a no-op double-wrap
- catalog/views.py: parallelize get_tv_details() + Redis IMDB cache
  lookup in process_one() with asyncio.gather() (independent calls)
- torr9_service.py: replace hardcoded "fr-FR" with settings.tmdb_language

Note: alldebrid delete_magnets and realdebrid _get_cached_torrent_info
kept sequential intentionally — API rate limits make parallelization risky.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 19:34:20 +01:00
LimeDrive
5e183c48a0 refactor: async fixes, security hardening, and code deduplication
Async correctness:
- Wrap blocking time.sleep/requests.get calls with asyncio.to_thread()
  in torrent_service.py and torr9_service.py
- Run cache_container_items() as fire-and-forget background task via
  asyncio.create_task(asyncio.to_thread(...)) in search/views.py
- Make RDTokenManager.get_access_token() and new_access_token() async,
  replace requests.post with aiohttp (token_manager.py)
- Make RealDebrid.get_headers() async, await all callers (realdebrid.py)

Security:
- Remove API key, device code, and PIN values from log output
  (auth/views.py, admin/views.py)
- Add WARNING on startup when SESSION_KEY uses the insecure default
  value (settings.py)
- Make admin template dir configurable via settings.admin_template_dir

Performance:
- Parallelize TMDB metadata fetches with asyncio.gather() (catalog/views.py)
- Add tmdb_language setting instead of hardcoded "fr-FR"

Deduplication:
- Extract ensure_uuid() to stream_fusion/web/api/utils.py
- Extract get_client_ip() to stream_fusion/web/utils.py
- Replace 8-way if/elif debrid factory with _SERVICE_MAP dict +
  _build_service() helper (get_debrid_service.py)
- Extract _model_to_schema() in APIKeyDAO to remove 6 repeated blocks
- Simplify ProxyStreamer: remove manual BytesIO buffer, stream directly
  via iter_any() (stream/views.py)

Inspired by commits 823bc77 and e306eb5 from limedrive/develop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 19:05:33 +01:00
LimeDrive
93ec64eb4a fix: update StremThru handling and improve torrent file processing in cache pre-fetch 2026-03-24 17:16:30 +01:00
LimeDrive
68a71dd886 revert: remove allow_anonymous_access flag and fix broken indexer enable flags
The allow_anonymous_access setting introduced in a previous branch was
partially implemented and breaking: it was only checked in the
/{config}/manifest.json route but ignored entirely in the stream search
route, which always returned 401 anyway. This created an inconsistent
and misleading security posture. The flag has been removed from settings
and the manifest route now unconditionally returns 401 when no API key
is present, consistent with the rest of the API.

Additionally, the SERVER-SIDE INDEXER ENABLE FLAGS (sharewood_enable,
c411_enable, torr9_enable, lacale_enable) were incorrectly tied to the
presence of server-side credentials via check_env_variable(). This was
a breaking regression: users with their own tracker credentials in their
Stremio config were silently blocked from using those indexers whenever
no server-level key was configured. These flags are now True by default
and can be explicitly set to False via environment variable to disable
an indexer server-wide.

A new generationfree_enable flag (True by default) has been added for
consistency. The config page (index.html) now conditionally renders
indexer checkboxes and credential fields based on these enable flags,
mirroring the existing jackett_enable pattern.
2026-03-24 01:04:42 +01:00
LimeDrive
3d05fa01ed fix: remove anonymous access handling from settings and update manifest API key check 2026-03-24 00:21:49 +01:00
LimeDrive
dfc8182960 feat: shared Redis availability cache for all debrid providers (issue #77)
Implements a generic caching layer in BaseDebrid that wraps every provider's
get_availability_bulk() with a shared Redis cache, reducing API calls and
cross-user redundancy.

Key changes:
- base_debrid.py: add get_availability_bulk_cached(), _sanitize_for_cache(),
  _index_results_by_hash(), _reconstruct_response(), service_name property.
  Cache keys: debrid_avail:{service}:{hash}. TTL: 3d (cached), 10min (not cached).
  Security: _sanitize_for_cache() strips private links/tokens before shared storage.
- alldebrid.py: remove fragile cache helpers (_cache_get_json, _cache_set_json,
  _lookup_local_cache, _write_local_cache); add provider overrides for #77;
  fix rate limiter attribute names (global_limit/period, was silently ignored);
  remove statusCode==4 fallback (field absent from /magnet/upload response);
  re-comment in English; StremThru results no longer cached locally.
- realdebrid.py, torbox.py, premiumize.py, stremthru.py: add provider overrides.
- views.py: replace get_availability_bulk() → get_availability_bulk_cached()
  at both call sites (prefetch + stream_processing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 23:03:47 +01:00
laster13
7ed11a1fea fix: stabilize StremThru/AllDebrid cache checks, playback, and stream caching 2026-03-23 16:54:59 +00:00
laster13
acb6738b1c
Merge branch 'master' into fix/credential-leak-shared-cache 2026-03-19 18:05:38 +01:00
laster13
3066565735 Ajout Generation Free 2026-03-19 16:42:48 +00:00
Elfbot
b4a1728793
fix: strip private indexer credentials from shared cache
Prevents Sharewood passkeys, C411 API keys and Torr9 API keys from
leaking between users via the shared Redis (media: key) and PostgreSQL
(torrent_items table).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 10:45:54 +13:00
laster13
eecceadc9f La-Cale et YggLeak 2026-03-16 15:12:27 +00:00
Telkaoss
4fc4a5cacc update 2026-03-02 11:32:28 +01:00
Telkaoss
15029df552
Add infoHash to playback URL generation 2026-01-07 11:43:23 +01:00
Telkaoss
2a0eba1eff
Update views.py 2025-06-27 10:24:32 +02:00
Telkaoss
de2654a345
Update views.py 2025-06-17 13:43:01 +02:00
Telkaoss
250dead391
Update stremio_parser.py 2025-06-17 13:40:22 +02:00
Telkaoss
f3667a68d0
Update views.py 2025-06-17 13:40:11 +02:00
Telkaoss
82e12bf6d8
Update stremio_parser.py 2025-06-16 13:30:21 +02:00
Telkaoss
8bf9ce6545
Update stremio_parser.py 2025-06-16 13:16:08 +02:00
Telkaoss
5772a7441c
Update stremio_parser.py 2025-06-16 12:52:40 +02:00
Telkaoss
714b683c0b
Update views.py 2025-06-11 13:37:56 +02:00
Telkaoss
0955bf80aa
Update views.py 2025-06-11 12:12:36 +02:00
Telkaoss
a171a9784a
Update views.py 2025-05-07 02:48:55 +02:00
Telkaoss
c76df27bca Stremthru 2025-05-05 05:45:09 +02:00
Telkaoss
35d35993a3 bug fix 2025-05-04 12:41:57 +02:00
Telkaoss
e3ed8b57f4 update 2025-05-04 09:31:01 +02:00
Telkaoss
1530d0557c Stremthru, async ++
Async Streaming: Converted key methods (fill_buffer, stream_content, close, get_stream_link, head_playback) to async for non-blocking streaming and improved scalability.

🔄 Unified Stremthru: Full refactor with dynamic STORE_CODE_TO_NAME / STORE_NAME_TO_TOKEN_KEY mappings and propagation of store_name in all requests (add_magnet, unrestrict_link, etc.). Updated RealDebrid to delegate via Stremthru.

💾 Cache Persistence: Store valid Stremthru links in Redis (stremthru:working:{store_code}:{info_hash}, TTL 7 days) and leverage this cache to mark links as "working" even on cached results.
2025-05-04 05:34:36 +02:00
Telkaoss
cd06a62fe8
Update views.py 2025-04-28 00:32:15 +02:00
Telkaoss
5d6fc1ebc7
Update views.py 2025-04-22 21:19:51 +02:00