diff --git a/assets b/assets index e4ccca3..1d11ce8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e4ccca3e28f2df52646385ef3957e79f4d203f94 +Subproject commit 1d11ce88ad85cceda1273da9ed8643f1ce3b6ee4 diff --git a/pkg/conf/version.go b/pkg/conf/version.go index 432d592..d92c524 100644 --- a/pkg/conf/version.go +++ b/pkg/conf/version.go @@ -1,13 +1,13 @@ package conf // BackendVersion 当前后端版本号 -var BackendVersion = "3.5.2" +var BackendVersion = "3.5.3" // RequiredDBVersion 与当前版本匹配的数据库版本 var RequiredDBVersion = "3.5.2" // RequiredStaticVersion 与当前版本匹配的静态资源版本 -var RequiredStaticVersion = "3.5.2" +var RequiredStaticVersion = "3.5.3" // IsPro 是否为Pro版本 var IsPro = "false" diff --git a/routers/controllers/file.go b/routers/controllers/file.go index c77d2b0..fddc857 100644 --- a/routers/controllers/file.go +++ b/routers/controllers/file.go @@ -3,10 +3,10 @@ package controllers import ( "context" "fmt" + "github.com/cloudreve/Cloudreve/v3/pkg/filesystem" "net/http" model "github.com/cloudreve/Cloudreve/v3/models" - "github.com/cloudreve/Cloudreve/v3/pkg/filesystem" "github.com/cloudreve/Cloudreve/v3/pkg/request" "github.com/cloudreve/Cloudreve/v3/pkg/serializer" "github.com/cloudreve/Cloudreve/v3/service/explorer" @@ -102,12 +102,26 @@ func AnonymousPermLink(c *gin.Context) { } } -// GetSource 获取文件的外链地址 func GetSource(c *gin.Context) { // 创建上下文 ctx, cancel := context.WithCancel(context.Background()) defer cancel() + var service explorer.ItemIDService + if err := c.ShouldBindJSON(&service); err == nil { + res := service.Sources(ctx, c) + c.JSON(200, res) + } else { + c.JSON(200, ErrorResponse(err)) + } +} + +// Thumb 获取文件缩略图 +func Thumb(c *gin.Context) { + // 创建上下文 + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + fs, err := filesystem.NewFileSystemFromContext(c) if err != nil { c.JSON(200, serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err)) @@ -121,21 +135,6 @@ func GetSource(c *gin.Context) { c.JSON(200, serializer.ParamErr("文件不存在", err)) return } -} - -// Thumb 获取文件缩略图 -func Thumb(c *gin.Context) { - // 创建上下文 - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - var service explorer.ItemIDService - if err := c.ShouldBindJSON(&service); err == nil { - res := service.Sources(ctx, c) - c.JSON(200, res) - } else { - c.JSON(200, ErrorResponse(err)) - } // 获取缩略图 resp, err := fs.GetThumb(ctx, fileID.(uint))