mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Modify: change raw object ID to Hash ID in file service
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user