Feat: list downloading file

This commit is contained in:
HFO4
2020-02-08 15:37:51 +08:00
parent 356ac8d608
commit d30159579f
6 changed files with 95 additions and 1 deletions

View File

@@ -81,3 +81,14 @@ func CancelAria2Download(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// ListDownloading 获取正在下载中的任务
func ListDownloading(c *gin.Context) {
var service aria2.DownloadListService
if err := c.ShouldBindQuery(&service); err == nil {
res := service.Downloading(c, CurrentUser(c))
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}

View File

@@ -284,6 +284,8 @@ func InitMasterRouter() *gin.Engine {
aria2.PUT("select/:gid", controllers.SelectAria2File)
// 取消下载任务
aria2.DELETE("task/:gid", controllers.CancelAria2Download)
// 获取正在下载中的任务
aria2.GET("downloading", controllers.ListDownloading)
}
// 目录