feat(torrents): support remote torrent metadata

This commit is contained in:
NimBold
2026-08-02 00:29:49 +03:30
parent 0f1f4e8003
commit d0541308c7
6 changed files with 281 additions and 4 deletions
+14
View File
@@ -12,6 +12,7 @@ import {
mediaTypeForFormat,
metadataSummaryMessage,
isYouTubePlaylistUrl,
isRemoteTorrentUrl,
playlistFilePrefix,
reconcileDownloadRows,
refreshFailedMetadataRows,
@@ -106,6 +107,19 @@ describe('add download metadata workflow', () => {
expect(rows[1].torrentCacheId).toBe(`${rows[1].id}-1`);
});
it('admits remote .torrent URLs through the Torrent metadata path', () => {
expect(isRemoteTorrentUrl('https://example.com/files/sample.torrent?download=1')).toBe(true);
expect(isRemoteTorrentUrl('https://example.com/files/sample.zip')).toBe(false);
const rows = reconcileDownloadRows('https://example.com/files/sample.torrent?download=1', []);
expect(rows[0]).toMatchObject({
isTorrent: true,
isMedia: false,
status: 'loading'
});
});
it('gives refreshed torrent metadata a new cache identity', () => {
const existing = row({
id: 'torrent-row',