mirror of https://github.com/Xhofe/alist
parent
a1e88cfa05
commit
8c0defce09
|
@ -122,6 +122,10 @@ func (tm *Manager[K]) ClearDone() {
|
|||
tm.RemoveByStates(SUCCEEDED, CANCELED, ERRORED)
|
||||
}
|
||||
|
||||
func (tm *Manager[K]) ClearSucceeded() {
|
||||
tm.RemoveByStates(SUCCEEDED)
|
||||
}
|
||||
|
||||
func (tm *Manager[K]) RawTasks() *generic_sync.MapOf[K, *Task[K]] {
|
||||
return &tm.tasks
|
||||
}
|
||||
|
|
|
@ -92,10 +92,27 @@ func taskRoute[K comparable](g *gin.RouterGroup, manager *task.Manager[K], k2Str
|
|||
common.SuccessResp(c)
|
||||
}
|
||||
})
|
||||
g.POST("/retry", func(c *gin.Context) {
|
||||
tid := c.Query("tid")
|
||||
id, err := str2K(tid)
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 400)
|
||||
return
|
||||
}
|
||||
if err := manager.Retry(id); err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
} else {
|
||||
common.SuccessResp(c)
|
||||
}
|
||||
})
|
||||
g.POST("/clear_done", func(c *gin.Context) {
|
||||
manager.ClearDone()
|
||||
common.SuccessResp(c)
|
||||
})
|
||||
g.POST("/clear_succeeded", func(c *gin.Context) {
|
||||
manager.ClearSucceeded()
|
||||
common.SuccessResp(c)
|
||||
})
|
||||
}
|
||||
|
||||
func SetupTaskRoute(g *gin.RouterGroup) {
|
||||
|
|
Loading…
Reference in New Issue