mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Feat: cancel aria2 download task
This commit is contained in:
@@ -70,3 +70,14 @@ func AddAria2Torrent(c *gin.Context) {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// CancelAria2Download 取消aria2离线下载任务
|
||||
func CancelAria2Download(c *gin.Context) {
|
||||
var selectService aria2.DownloadTaskService
|
||||
if err := c.ShouldBindUri(&selectService); err == nil {
|
||||
res := selectService.Delete(c)
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,6 +282,8 @@ func InitMasterRouter() *gin.Engine {
|
||||
aria2.POST("torrent/*path", controllers.AddAria2Torrent)
|
||||
// 重新选择要下载的文件
|
||||
aria2.PUT("select/:gid", controllers.SelectAria2File)
|
||||
// 取消下载任务
|
||||
aria2.DELETE("task/:gid", controllers.CancelAria2Download)
|
||||
}
|
||||
|
||||
// 目录
|
||||
|
||||
Reference in New Issue
Block a user