feat(thumb): generator settings and test button

This commit is contained in:
Aaron Liu
2023-04-07 19:33:02 +08:00
parent ac536408c6
commit cf03206283
5 changed files with 114 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ import (
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
"github.com/cloudreve/Cloudreve/v3/pkg/email"
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
"github.com/cloudreve/Cloudreve/v3/pkg/thumb"
"github.com/gin-gonic/gin"
)
func init() {
@@ -143,3 +145,21 @@ func (service *NoParamService) Summary() serializer.Response {
Data: resp,
}
}
// ThumbGeneratorTestService 缩略图生成测试服务
type ThumbGeneratorTestService struct {
Name string `json:"name" binding:"required"`
Executable string `json:"executable" binding:"required"`
}
// Test 通过获取生成器版本来测试
func (s *ThumbGeneratorTestService) Test(c *gin.Context) serializer.Response {
version, err := thumb.TestGenerator(c, s.Name, s.Executable)
if err != nil {
return serializer.Err(serializer.CodeParamErr, err.Error(), err)
}
return serializer.Response{
Data: version,
}
}