feat: add task cancellation support

- Add CancelTask function to cancel running/waiting tasks
- Add /api/cancelTask endpoint
- Add cancel button in task list for running/waiting tasks
- Check cancellation status during download and merge operations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 16:40:27 +08:00
parent 1b23d813a8
commit 81df437b2c
5 changed files with 106 additions and 10 deletions
+5
View File
@@ -71,4 +71,9 @@ type ActiveTask = {
export const deleteTask = async (id: number) => {
const res = await fetch(`/api/deleteTask?id=${id}`).then(res => res.json()) as ResJSON
if (!res.success) throw new Error(res.message)
}
export const cancelTask = async (id: number) => {
const res = await fetch(`/api/cancelTask?id=${id}`).then(res => res.json()) as ResJSON
if (!res.success) throw new Error(res.message)
}