mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 03:56:38 +08:00
@@ -26,9 +26,9 @@ export const downloadsAPI = {
|
||||
.post<DownloadTask>('/downloads', { url, save_path: savePath, ...meta })
|
||||
.then((r) => r.data),
|
||||
|
||||
remove: (hash: string, deleteFiles = false) =>
|
||||
remove: (hash: string, clientID: string, deleteFiles = false) =>
|
||||
api
|
||||
.delete(`/downloads/${hash}?delete_files=${deleteFiles ? 'true' : 'false'}`)
|
||||
.delete(`/downloads/${hash}`, { params: { client_id: clientID, delete_files: deleteFiles } })
|
||||
.then((r) => r.data),
|
||||
|
||||
reload: () => api.post('/downloads/reload').then((r) => r.data),
|
||||
|
||||
@@ -102,12 +102,12 @@ export function DownloadsPage() {
|
||||
<div className="grid gap-5 lg:grid-cols-2 2xl:grid-cols-3">
|
||||
{torrents.map((torrent) => (
|
||||
<DownloadTaskCard
|
||||
key={torrent.hash}
|
||||
key={`${torrent.client_id}:${torrent.hash}`}
|
||||
item={toLiveCard(torrent)}
|
||||
removable={role === 'admin'}
|
||||
onRemove={async () => {
|
||||
if (!(await confirmAction({ title: '删除下载任务', message: `删除「${torrent.title || torrent.name}」?`, confirmText: '删除' }))) return
|
||||
await downloadsAPI.remove(torrent.hash, false)
|
||||
await downloadsAPI.remove(torrent.hash, torrent.client_id, false)
|
||||
toast.success('已删除任务')
|
||||
await refresh()
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export interface DownloadTask {
|
||||
id: string
|
||||
source: string
|
||||
download_client_id?: string
|
||||
external_id?: string
|
||||
title: string
|
||||
poster_url?: string
|
||||
backdrop_url?: string
|
||||
@@ -21,6 +23,8 @@ export interface DownloadTask {
|
||||
|
||||
export interface QBitTorrent {
|
||||
hash: string
|
||||
client_id: string
|
||||
source: 'qbittorrent' | 'transmission' | 'aria2'
|
||||
name: string
|
||||
title: string
|
||||
poster_url?: string
|
||||
|
||||
Reference in New Issue
Block a user