diff --git a/client/src/javascript/components/torrent-list/TorrentListContextMenu.tsx b/client/src/javascript/components/torrent-list/TorrentListContextMenu.tsx index efa46c73..5dd13e73 100644 --- a/client/src/javascript/components/torrent-list/TorrentListContextMenu.tsx +++ b/client/src/javascript/components/torrent-list/TorrentListContextMenu.tsx @@ -31,19 +31,6 @@ const InlineTorrentPropertyCheckbox: FC<{property: keyof TorrentProperties}> = o ), ); -const handleTorrentDownload = (hash: TorrentProperties['hash']): void => { - const {baseURI} = ConfigStore; - const link = document.createElement('a'); - - link.download = ''; - link.href = `${baseURI}api/torrents/${hash}/contents/all/data`; - link.style.display = 'none'; - - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); -}; - const getContextMenuItems = (torrent: TorrentProperties): Array => { const changePriorityFuncRef = createRef<() => number>(); @@ -129,11 +116,38 @@ const getContextMenuItems = (torrent: TorrentProperties): Array }, { type: 'action', - action: 'torrentDownload', - label: TorrentContextMenuActions.torrentDownload.id, + action: 'downloadContents', + label: TorrentContextMenuActions.downloadContents.id, clickHandler: (e) => { e.preventDefault(); - handleTorrentDownload(getLastSelectedTorrent()); + + const link = document.createElement('a'); + + link.download = ''; + link.href = `${ConfigStore.baseURI}api/torrents/${getLastSelectedTorrent()}/contents/all/data`; + link.style.display = 'none'; + + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }, + }, + { + type: 'action', + action: 'downloadMetainfo', + label: TorrentContextMenuActions.downloadMetainfo.id, + clickHandler: (e) => { + e.preventDefault(); + + const link = document.createElement('a'); + + link.download = ''; + link.href = `${ConfigStore.baseURI}api/torrents/${TorrentStore.selectedTorrents.join(',')}/metainfo`; + link.style.display = 'none'; + + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); }, }, { diff --git a/client/src/javascript/constants/TorrentContextMenuActions.ts b/client/src/javascript/constants/TorrentContextMenuActions.ts index 394c8917..ef9090c0 100644 --- a/client/src/javascript/constants/TorrentContextMenuActions.ts +++ b/client/src/javascript/constants/TorrentContextMenuActions.ts @@ -23,8 +23,11 @@ const TorrentContextMenuActions = { torrentDetails: { id: 'torrents.list.context.details', }, - torrentDownload: { - id: 'torrents.list.context.download', + downloadContents: { + id: 'torrents.list.context.download.contents', + }, + downloadMetainfo: { + id: 'torrents.list.context.download.metainfo', }, generateMagnet: { id: 'torrents.list.context.generate.magnet', diff --git a/client/src/javascript/i18n/strings.compiled.json b/client/src/javascript/i18n/strings.compiled.json index 6b049448..543bcbc7 100644 --- a/client/src/javascript/i18n/strings.compiled.json +++ b/client/src/javascript/i18n/strings.compiled.json @@ -2209,10 +2209,16 @@ "value": "Torrent Details" } ], - "torrents.list.context.download": [ + "torrents.list.context.download.contents": [ { "type": 0, - "value": "Download" + "value": "Download Contents" + } + ], + "torrents.list.context.download.metainfo": [ + { + "type": 0, + "value": "Download .torrent" } ], "torrents.list.context.generate.magnet": [ diff --git a/client/src/javascript/i18n/strings.json b/client/src/javascript/i18n/strings.json index 7b34107e..50086646 100644 --- a/client/src/javascript/i18n/strings.json +++ b/client/src/javascript/i18n/strings.json @@ -316,7 +316,8 @@ "torrents.list.context.generate.magnet": "Generate Magnet Link", "torrents.list.context.move": "Set Torrent Location", "torrents.list.context.pause": "Pause", - "torrents.list.context.download": "Download", + "torrents.list.context.download.contents": "Download Contents", + "torrents.list.context.download.metainfo": "Download .torrent", "torrents.list.context.initial.seeding": "Initial Seeding", "torrents.list.context.priority": "Priority", "torrents.list.context.remove": "Remove", diff --git a/shared/constants/defaultFloodSettings.ts b/shared/constants/defaultFloodSettings.ts index a330161e..736b0c55 100644 --- a/shared/constants/defaultFloodSettings.ts +++ b/shared/constants/defaultFloodSettings.ts @@ -57,7 +57,8 @@ const defaultFloodSettings: Readonly = { {id: 'move', visible: true}, {id: 'setTrackers', visible: false}, {id: 'torrentDetails', visible: true}, - {id: 'torrentDownload', visible: true}, + {id: 'downloadContents', visible: true}, + {id: 'downloadMetainfo', visible: false}, {id: 'generateMagnet', visible: false}, {id: 'setInitialSeeding', visible: false}, {id: 'setSequential', visible: false},