mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
WebP转换质量转移到WebP策略配置
This commit is contained in:
@@ -45,6 +45,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
func (this *IndexAction) RunPost(params struct {
|
||||
ClusterId int64
|
||||
IsOn bool
|
||||
Quality int
|
||||
RequireCache bool
|
||||
MinLengthJSON []byte
|
||||
MaxLengthJSON []byte
|
||||
@@ -59,6 +60,13 @@ func (this *IndexAction) RunPost(params struct {
|
||||
RequireCache: params.RequireCache,
|
||||
}
|
||||
|
||||
if params.Quality < 0 {
|
||||
params.Quality = 0
|
||||
} else if params.Quality > 100 {
|
||||
params.Quality = 100
|
||||
}
|
||||
config.Quality = params.Quality
|
||||
|
||||
if len(params.MinLengthJSON) > 0 {
|
||||
var minLength = &shared.SizeCapacity{}
|
||||
err := json.Unmarshal(params.MinLengthJSON, minLength)
|
||||
@@ -79,6 +87,11 @@ func (this *IndexAction) RunPost(params struct {
|
||||
config.MaxLength = maxLength
|
||||
}
|
||||
|
||||
err := config.Init()
|
||||
if err != nil {
|
||||
this.Fail("配置校验失败:" + err.Error())
|
||||
}
|
||||
|
||||
configJSON, err := json.Marshal(config)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
Reference in New Issue
Block a user