client: add "Reannounce" action

This commit is contained in:
Jesse Chan
2021-02-21 23:47:45 +08:00
parent 1e217295d9
commit d84c8aacb8
5 changed files with 27 additions and 0 deletions
@@ -8,6 +8,7 @@ import UIStore from '@client/stores/UIStore';
import type {
AddTorrentByFileOptions,
AddTorrentByURLOptions,
ReannounceTorrentsOptions,
SetTorrentsTagsOptions,
} from '@shared/schema/api/torrents';
import type {
@@ -194,6 +195,19 @@ const TorrentActions = {
},
),
reannounce: (options: ReannounceTorrentsOptions) =>
axios
.post(`${baseURI}api/torrents/reannounce`, options)
.then((json) => json.data)
.then(
() => {
// do nothing.
},
() => {
// do nothing.
},
),
startTorrents: async (options: StartTorrentsOptions): Promise<void> => {
if (options.hashes.length > 0) {
return axios
@@ -74,6 +74,16 @@ const getContextMenuItems = (torrent: TorrentProperties): Array<ContextMenuItem>
});
},
},
{
type: 'action',
action: 'reannounce',
label: TorrentContextMenuActions.reannounce,
clickHandler: () => {
TorrentActions.reannounce({
hashes: TorrentStore.selectedTorrents as [string, ...string[]],
});
},
},
{
type: 'separator',
},
@@ -3,6 +3,7 @@ const TorrentContextMenuActions = {
stop: 'torrents.list.context.stop',
remove: 'torrents.list.context.remove',
checkHash: 'torrents.list.context.check.hash',
reannounce: 'torrents.list.context.reannounce',
setTaxonomy: 'torrents.list.context.set.tags',
move: 'torrents.list.context.move',
setTrackers: 'torrents.list.context.set.trackers',
@@ -324,6 +324,7 @@
"torrents.list.context.move": "Set Torrent Location",
"torrents.list.context.pause": "Pause",
"torrents.list.context.priority": "Priority",
"torrents.list.context.reannounce": "Reannounce",
"torrents.list.context.remove": "Remove",
"torrents.list.context.sequential": "Sequential",
"torrents.list.context.set.tags": "Set Tags",
+1
View File
@@ -53,6 +53,7 @@ const defaultFloodSettings: Readonly<FloodSettings> = {
{id: 'stop', visible: true},
{id: 'remove', visible: true},
{id: 'checkHash', visible: true},
{id: 'reannounce', visible: false},
{id: 'setTaxonomy', visible: true},
{id: 'move', visible: true},
{id: 'setTrackers', visible: false},