From eef3cef1d4076923c0d0c9e3b359bb164531fc45 Mon Sep 17 00:00:00 2001 From: "Timothy Z." Date: Wed, 4 Mar 2026 21:14:03 +0200 Subject: [PATCH 1/2] add copy magnet link option to stream --- .../MetaDetails/StreamsList/Stream/Stream.js | 38 +++++++++++++ src/routes/Player/OptionsMenu/OptionsMenu.js | 53 ++++++++++++++++--- 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/src/routes/MetaDetails/StreamsList/Stream/Stream.js b/src/routes/MetaDetails/StreamsList/Stream/Stream.js index e5a8717cb..c556fa1e2 100644 --- a/src/routes/MetaDetails/StreamsList/Stream/Stream.js +++ b/src/routes/MetaDetails/StreamsList/Stream/Stream.js @@ -93,6 +93,10 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio return deepLinks?.externalPlayer?.download; }, [deepLinks]); + const magnetLink = React.useMemo(() => { + return deepLinks?.externalPlayer?.magnet; + }, [deepLinks]); + const markVideoAsWatched = React.useCallback(() => { if (typeof videoId === 'string') { core.transport.dispatch({ @@ -106,6 +110,10 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio }, [videoId, videoReleased]); const onClick = React.useCallback((event) => { + if (event.nativeEvent.togglePopupPrevented) { + return; + } + if (profile.settings.playerType !== null) { markVideoAsWatched(); toast.show({ @@ -120,6 +128,28 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio } }, [props.onClick, profile.settings, markVideoAsWatched]); + const copyMagnetLink = React.useCallback((event) => { + event.preventDefault(); + closeMenu(); + if (magnetLink) { + navigator.clipboard.writeText(magnetLink) + .then(() => { + toast.show({ + type: 'success', + title: t('PLAYER_COPY_MAGNET_LINK_SUCCESS'), + timeout: 4000 + }); + }) + .catch(() => { + toast.show({ + type: 'error', + title: t('PLAYER_COPY_MAGNET_LINK_ERROR'), + timeout: 4000, + }); + }); + } + }, [magnetLink]); + const copyDownloadLink = React.useCallback((event) => { event.preventDefault(); closeMenu(); @@ -221,6 +251,13 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio
{t('CTX_COPY_STREAM_LINK')}
} + { + magnetLink && + + } { downloadLink &&