Feat: cancel aria2 download task

This commit is contained in:
HFO4
2020-02-06 10:07:46 +08:00
parent 1a93c9a2b9
commit c29695a40d
5 changed files with 62 additions and 15 deletions

View File

@@ -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))
}
}

View File

@@ -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)
}
// 目录