diff --git a/internal/web/actions/default/servers/server/settings/gzip/index.go b/internal/web/actions/default/servers/server/settings/gzip/index.go index 936fb6f0..4ceb8c81 100644 --- a/internal/web/actions/default/servers/server/settings/gzip/index.go +++ b/internal/web/actions/default/servers/server/settings/gzip/index.go @@ -66,12 +66,12 @@ func (this *IndexAction) RunGet(params struct { } func (this *IndexAction) RunPost(params struct { - WebId int64 - GzipId int64 - Level int - MinLength string - MaxLength string - CondGroupsJSON []byte + WebId int64 + GzipId int64 + Level int + MinLength string + MaxLength string + CondsJSON []byte Must *actions.Must }) { @@ -99,11 +99,11 @@ func (this *IndexAction) RunPost(params struct { if params.GzipId > 0 { _, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{ - GzipId: params.GzipId, - Level: types.Int32(params.Level), - MinLength: minLength, - MaxLength: maxLength, - CondGroupsJSON: params.CondGroupsJSON, + GzipId: params.GzipId, + Level: types.Int32(params.Level), + MinLength: minLength, + MaxLength: maxLength, + CondsJSON: params.CondsJSON, }) if err != nil { this.ErrorPage(err) @@ -111,10 +111,10 @@ func (this *IndexAction) RunPost(params struct { } } else { resp, err := this.RPC().HTTPGzipRPC().CreateHTTPGzip(this.AdminContext(), &pb.CreateHTTPGzipRequest{ - Level: types.Int32(params.Level), - MinLength: minLength, - MaxLength: maxLength, - CondGroupsJSON: params.CondGroupsJSON, + Level: types.Int32(params.Level), + MinLength: minLength, + MaxLength: maxLength, + CondsJSON: params.CondsJSON, }) if err != nil { this.ErrorPage(err) diff --git a/web/public/js/components/server/http-cond-definitions.js b/web/public/js/components/server/http-cond-definitions.js index f381d35d..b16290d0 100644 --- a/web/public/js/components/server/http-cond-definitions.js +++ b/web/public/js/components/server/http-cond-definitions.js @@ -5,6 +5,7 @@ Vue.component("http-cond-url-extension", { let cond = this.vCond if (cond == null) { cond = { + isRequest: true, param: "${requestPathExtension}", operator: "in", value: "[]" @@ -85,7 +86,7 @@ Vue.component("http-cond-mime-type", { let cond = this.vCond if (cond == null) { cond = { - type: "mime-type", + isRequest: false, param: "${response.contentType}", operator: "mime type", value: "[]" @@ -144,7 +145,7 @@ Vue.component("http-cond-mime-type", {
- +
diff --git a/web/public/js/components/server/http-gzip-box.js b/web/public/js/components/server/http-gzip-box.js index 3f3a1d84..2bfd6891 100644 --- a/web/public/js/components/server/http-gzip-box.js +++ b/web/public/js/components/server/http-gzip-box.js @@ -8,7 +8,7 @@ Vue.component("http-gzip-box", { level: 0, minLength: null, maxLength: null, - condGroups: [] + conds: null } } @@ -69,7 +69,7 @@ Vue.component("http-gzip-box", { - +
` }) \ No newline at end of file diff --git a/web/public/js/components/server/http-request-conds-tbody.js b/web/public/js/components/server/http-request-conds-tbody.js index cebd70e1..beb03a09 100644 --- a/web/public/js/components/server/http-request-conds-tbody.js +++ b/web/public/js/components/server/http-request-conds-tbody.js @@ -1,12 +1,16 @@ Vue.component("http-request-conds-tbody", { - props: ["v-cond-groups"], + props: ["v-conds"], data: function () { - let groups = this.vCondGroups - if (groups == null) { - groups = [] + let conds = this.vConds + if (conds == null) { + conds = { + isOn: true, + connector: "or", + groups: [] + } } return { - groups: groups, + conds: conds, components: window.REQUEST_COND_COMPONENTS } }, @@ -16,7 +20,7 @@ Vue.component("http-request-conds-tbody", { teaweb.popup("/servers/server/settings/conds/addGroupPopup", { height: "30em", callback: function (resp) { - that.groups.push(resp.data.group) + that.conds.groups.push(resp.data.group) } }) }, @@ -26,14 +30,14 @@ Vue.component("http-request-conds-tbody", { teaweb.popup("/servers/server/settings/conds/addGroupPopup", { height: "30em", callback: function (resp) { - Vue.set(that.groups, groupIndex, resp.data.group) + Vue.set(that.conds.groups, groupIndex, resp.data.group) } }) }, removeGroup: function (groupIndex) { let that = this teaweb.confirm("确定要删除这一组条件吗?", function () { - that.groups.$remove(groupIndex) + that.conds.groups.$remove(groupIndex) }) }, typeName: function (cond) { @@ -50,11 +54,11 @@ Vue.component("http-request-conds-tbody", { 匹配条件 - +
-
+
- +