feat(tlk): refresh endpoint to re-pull a thread's current magnet

Add /api/refresh?tid=<id> that re-downloads a Toloka thread's .torrent
server-side and returns a fresh magnet + m3u. Pass the thread id (tlk)
into the m3u params for series. Drop the per-magnet cache so refreshes
always reflect the thread's current state (new episodes while airing).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nerandClaude Opus 4.8 committed 2026-08-07 20:24:44 +03:00
1 parent 284458f783
commit 3ddba5e6a2
3 files changed
+39 -33

No files matched your search

@@ -90,6 +90,14 @@ const Actions: FC<Props> = ({ torrent, title, provider, show }) => {
if (show.type === 'tv') {
const season = seasonFromEpisodes(torrent.episodes) ?? show.airing?.season;
if (season != null) params.set('season', season.toString());
// Toloka thread id (download.php?id=<id>): the TV stores it and later
// asks movie-advisor's /api/refresh to re-pull the thread's current
// magnet, so a still-airing season picks up new episodes on its own.
if (provider === providers.tlk.key && torrent.download) {
const tid = new URLSearchParams(torrent.download.split('?')[1] || '').get('id');
if (tid) params.set('tlk', tid);
}
}
if (isSafari) {