fix(release): 正式版本 - 修复 SSRF 与 Quality checks,发布 v1.6.6.1
This commit is contained in:
1 parent
ede6cc1e70
commit
ea6676f449
21 files changed
+1303
-338
No files matched your search
@@ -10,14 +10,27 @@ type TaskPage struct {
|
||||
}
|
||||
|
||||
func (r *Repository) WorkbenchTasks(userID, kind string, activeOnly bool, cursor string, limit int) (TaskPage, error) {
|
||||
if limit < 1 || limit > 100 { limit = 30 }
|
||||
if kind != model.WorkbenchKindImage && kind != model.WorkbenchKindVideo { return TaskPage{}, nil }
|
||||
if limit < 1 || limit > 100 {
|
||||
limit = 30
|
||||
}
|
||||
if kind != model.WorkbenchKindImage && kind != model.WorkbenchKindVideo {
|
||||
return TaskPage{}, nil
|
||||
}
|
||||
query := r.db.Model(&model.Task{}).Where("user_id = ? AND workbench_kind = ?", userID, kind)
|
||||
if activeOnly { query = query.Where("status IN ?", []model.TaskStatus{model.TaskStatusQueued, model.TaskStatusRunning}) }
|
||||
if cursor != "" { query = query.Where("id < ?", cursor) }
|
||||
if activeOnly {
|
||||
query = query.Where("status IN ?", []model.TaskStatus{model.TaskStatusQueued, model.TaskStatusRunning})
|
||||
}
|
||||
if cursor != "" {
|
||||
query = query.Where("id < ?", cursor)
|
||||
}
|
||||
var tasks []model.Task
|
||||
if err := query.Order("created_at desc, id desc").Limit(limit + 1).Find(&tasks).Error; err != nil { return TaskPage{}, err }
|
||||
if err := query.Order("created_at desc, id desc").Limit(limit + 1).Find(&tasks).Error; err != nil {
|
||||
return TaskPage{}, err
|
||||
}
|
||||
page := TaskPage{Tasks: tasks}
|
||||
if len(tasks) > limit { page.Tasks = tasks[:limit]; page.NextCursor = page.Tasks[len(page.Tasks)-1].ID }
|
||||
if len(tasks) > limit {
|
||||
page.Tasks = tasks[:limit]
|
||||
page.NextCursor = page.Tasks[len(page.Tasks)-1].ID
|
||||
}
|
||||
return page, nil
|
||||
}
|
||||
Reference in new issue
Block a user