mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Feat: list downloading file
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
// 目录
|
||||
|
||||
Reference in New Issue
Block a user