diff --git a/pkg/aria2/caller.go b/pkg/aria2/caller.go index be13dcc..f5bec63 100644 --- a/pkg/aria2/caller.go +++ b/pkg/aria2/caller.go @@ -5,7 +5,6 @@ import ( model "github.com/HFO4/cloudreve/models" "github.com/HFO4/cloudreve/pkg/util" "github.com/zyxar/argo/rpc" - "os" "path/filepath" "strconv" "strings" @@ -51,17 +50,17 @@ func (client *RPCService) Cancel(task *model.Download) error { util.Log().Warning("无法取消离线下载任务[%s], %s", task.GID, err) } - // 删除临时文件 - util.Log().Debug("离线下载任务[%s]已取消,1 分钟后删除临时文件", task.GID) - go func(task *model.Download) { - select { - case <-time.After(time.Duration(60) * time.Second): - err := os.RemoveAll(task.Parent) - if err != nil { - util.Log().Warning("无法删除离线下载临时目录[%s], %s", task.Parent, err) - } - } - }(task) + //// 删除临时文件 + //util.Log().Debug("离线下载任务[%s]已取消,1 分钟后删除临时文件", task.GID) + //go func(task *model.Download) { + // select { + // case <-time.After(time.Duration(60) * time.Second): + // err := os.RemoveAll(task.Parent) + // if err != nil { + // util.Log().Warning("无法删除离线下载临时目录[%s], %s", task.Parent, err) + // } + // } + //}(task) return err } diff --git a/pkg/aria2/monitor.go b/pkg/aria2/monitor.go index 253c71c..fe6a409 100644 --- a/pkg/aria2/monitor.go +++ b/pkg/aria2/monitor.go @@ -101,6 +101,7 @@ func (monitor *Monitor) Update() bool { case "removed": monitor.Task.Status = Canceled monitor.Task.Save() + monitor.RemoveTempFolder() return true default: util.Log().Warning("下载任务[%s]返回未知状态信息[%s],", monitor.Task.GID, status.Status) diff --git a/pkg/serializer/user.go b/pkg/serializer/user.go index 193cd4b..8c1dee4 100644 --- a/pkg/serializer/user.go +++ b/pkg/serializer/user.go @@ -40,7 +40,6 @@ type group struct { Name string `json:"name"` AllowShare bool `json:"allowShare"` AllowRemoteDownload bool `json:"allowRemoteDownload"` - AllowTorrentDownload bool `json:"allowTorrentDownload"` AllowArchiveDownload bool `json:"allowArchiveDownload"` ShareFreeEnabled bool `json:"shareFree"` ShareDownload bool `json:"shareDownload"`