feat(torbox): Implement Payload Slicing and Auto-Cacher Toggle #2

Open
Leadernelson wants to merge 2 commits from main into main
Leadernelson commented 2026-05-14 17:55:24 +00:00 (Migrated from gitlab.com)

This PR introduces two major optimizations for the TorBox debrid service to significantly reduce API latency and eliminate friction for uncached content.

TorBox Payload Slicing (Zero-Latency API Checks)

Problem: Previously, all scraped Wawacity/Darki links were hashed and sent to TorBox's /checkcached endpoint. Sending 100+ hashes caused high latency and risked rate limits. 8 Solution: Links are now pre-sorted using WAStream's quality_sort_key. We slice the array and only send the Top 15 best links to the TorBox API. The remaining links default to uncached, dropping API response times to milliseconds.

TorBox Auto-Cacher (Zero-Click Downloads)

Problem: Users had to manually guess which (uncached) link was best and click it to trigger the background download.

Solution: Introduced a new trigger_auto_download method in torbox.py. If a user queries a movie/series and 0 cached TorBox streams are returned, WAStream automatically selects the absolute best uncached link and silently triggers a /createwebdownload (or usenet equivalent) in the background.

Configuration Toggle

The Auto-Cacher is entirely optional. Added an auto_cache property to the Pydantic data model and a sleek toggle in the Web UI (index.html) that only appears when TorBox is selected. 16 * Added English and French localization for the new toggle in translations.js.

This PR introduces two major optimizations for the TorBox debrid service to significantly reduce API latency and eliminate friction for uncached content. **TorBox Payload Slicing (Zero-Latency API Checks)** **Problem:** Previously, all scraped Wawacity/Darki links were hashed and sent to TorBox's `/checkcached` endpoint. Sending 100+ hashes caused high latency and risked rate limits. 8 **Solution:** Links are now pre-sorted using WAStream's `quality_sort_key`. We slice the array and only send the **Top 15** best links to the TorBox API. The remaining links default to `uncached`, dropping API response times to milliseconds. **TorBox Auto-Cacher (Zero-Click Downloads)** **Problem:** Users had to manually guess which `⏳` (uncached) link was best and click it to trigger the background download. **Solution:** Introduced a new `trigger_auto_download` method in `torbox.py`. If a user queries a movie/series and `0` cached TorBox streams are returned, WAStream automatically selects the absolute best uncached link and silently triggers a `/createwebdownload` (or usenet equivalent) in the background. **Configuration Toggle** The Auto-Cacher is entirely optional. Added an `auto_cache` property to the Pydantic data model and a sleek toggle in the Web UI (`index.html`) that only appears when TorBox is selected. 16 \* Added English and French localization for the new toggle in `translations.js`.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin main:main
git checkout main

Merge

Merge the changes and update on Forgejo.
git checkout main
git merge --no-ff main
git checkout main
git merge --ff-only main
git checkout main
git rebase main
git checkout main
git merge --no-ff main
git checkout main
git merge --squash main
git checkout main
git merge --ff-only main
git checkout main
git merge main
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Creepso/wastream#2
No description provided.