mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-04-17 16:45:28 +08:00
多处增加是否独立配置选项
This commit is contained in:
@@ -53,15 +53,25 @@ func (this *IndexAction) RunGet(params struct {
|
||||
|
||||
this.Data["gzipConfig"] = gzipConfig
|
||||
|
||||
if webConfig.GzipRef == nil {
|
||||
webConfig.GzipRef = &serverconfigs.HTTPGzipRef{
|
||||
IsPrior: false,
|
||||
IsOn: false,
|
||||
GzipId: 0,
|
||||
}
|
||||
}
|
||||
this.Data["gzipRef"] = webConfig.GzipRef
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunPost(params struct {
|
||||
WebId int64
|
||||
GzipId int64
|
||||
Level int
|
||||
MinLength string
|
||||
MaxLength string
|
||||
WebId int64
|
||||
GzipRefJSON []byte
|
||||
GzipId int64
|
||||
Level int
|
||||
MinLength string
|
||||
MaxLength string
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
@@ -87,6 +97,14 @@ func (this *IndexAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
gzipRef := &serverconfigs.HTTPGzipRef{}
|
||||
err := json.Unmarshal(params.GzipRefJSON, gzipRef)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
gzipRef.GzipId = params.GzipId
|
||||
|
||||
if params.GzipId > 0 {
|
||||
_, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{
|
||||
GzipId: params.GzipId,
|
||||
@@ -109,24 +127,21 @@ func (this *IndexAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
gzipId := resp.GzipId
|
||||
gzipRef.GzipId = gzipId
|
||||
}
|
||||
|
||||
gzipRef := &serverconfigs.HTTPGzipRef{
|
||||
IsOn: true,
|
||||
GzipId: gzipId,
|
||||
}
|
||||
gzipRefJSON, err := json.Marshal(gzipRef)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
gzipRefJSON, err := json.Marshal(gzipRef)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebGzip(this.AdminContext(), &pb.UpdateHTTPWebGzipRequest{
|
||||
WebId: params.WebId,
|
||||
GzipJSON: gzipRefJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
}
|
||||
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebGzip(this.AdminContext(), &pb.UpdateHTTPWebGzipRequest{
|
||||
WebId: params.WebId,
|
||||
GzipJSON: gzipRefJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
}
|
||||
|
||||
this.Success()
|
||||
|
||||
Reference in New Issue
Block a user