From 184ee26e5b14fa9a3b30348c9f0cb254e29c05a3 Mon Sep 17 00:00:00 2001 From: ner Date: Fri, 11 Oct 2024 18:42:18 +0300 Subject: [PATCH] fix: stream restrictions --- components/Show/components/Torrents/index.tsx | 106 ++++++++++-------- 1 file changed, 57 insertions(+), 49 deletions(-) diff --git a/components/Show/components/Torrents/index.tsx b/components/Show/components/Torrents/index.tsx index d598f44..abb4ba6 100644 --- a/components/Show/components/Torrents/index.tsx +++ b/components/Show/components/Torrents/index.tsx @@ -84,57 +84,65 @@ const showTorrentsModal = create(({ title, year, imdbID, backdrop, onResolve }: - {torrents?.map((torrent) => ( - - {isMobile && ( - - - {torrent.title} + {torrents?.map((torrent) => { + const supportedForStream = Boolean( + key === providers.yts.key && + torrent.seeders && + ['720p', '1080p'].some((resolution) => torrent.title.includes(resolution)) + ); + + return ( + + {isMobile && ( + + + {torrent.title} + + + )} + + {!isMobile && ( + + {torrent.title} {torrent.type && `[${torrent.type?.toUpperCase()}]`} + + )} + +
{torrent.size}
+
+ {torrent.seeders} + +
+ {supportedForStream && ( +
showPlayer({ magnet: torrent.magnet, backdrop })} + > + +
+ )} + + + +
navigator.clipboard.writeText(torrent.magnet)} + > + +
+ {prefix && !prefix.includes('{host}') && ( +
cast(torrent.magnet!)} + className='flex size-8 cursor-pointer items-center justify-center rounded-lg border' + > + +
+ )} +
- )} - - {!isMobile && ( - - {torrent.title} {torrent.type && `[${torrent.type?.toUpperCase()}]`} - - )} - -
{torrent.size}
-
- {torrent.seeders} - -
- {Boolean(key === providers.yts.key && torrent.seeders) && ( -
showPlayer({ magnet: torrent.magnet, backdrop })} - > - -
- )} - - - -
navigator.clipboard.writeText(torrent.magnet)} - > - -
- {prefix && !prefix.includes('{host}') && ( -
cast(torrent.magnet!)} - className='flex size-8 cursor-pointer items-center justify-center rounded-lg border' - > - -
- )} -
-
-
-
- ))} +
+ ); + })} {isLoading && (