Modify: change raw object ID to Hash ID in file service

This commit is contained in:
HFO4
2020-02-10 13:10:59 +08:00
parent f235ad1def
commit 9be1b4366f
16 changed files with 287 additions and 121 deletions

View File

@@ -3,11 +3,9 @@ package controllers
import (
"context"
ariaCall "github.com/HFO4/cloudreve/pkg/aria2"
"github.com/HFO4/cloudreve/pkg/serializer"
"github.com/HFO4/cloudreve/service/aria2"
"github.com/HFO4/cloudreve/service/explorer"
"github.com/gin-gonic/gin"
"strings"
)
// AddAria2URL 添加离线下载URL
@@ -38,15 +36,8 @@ func AddAria2Torrent(c *gin.Context) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var service explorer.SingleFileService
var service explorer.FileIDService
if err := c.ShouldBindUri(&service); err == nil {
// 验证必须是种子文件
filePath := c.Param("path")
if !strings.HasSuffix(filePath, ".torrent") {
c.JSON(200, serializer.ParamErr("只能下载 .torrent 文件", nil))
return
}
// 获取种子内容的下载地址
res := service.CreateDownloadSession(ctx, c)
if res.Code != 0 {