diff --git a/web/public/js/components.js b/web/public/js/components.js index 96891076..3e63f240 100755 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -2829,6 +2829,84 @@ Vue.component("http-request-limit-config-box", { ` }) +Vue.component("http-header-replace-values", { + props: ["v-replace-values"], + data: function () { + let values = this.vReplaceValues + if (values == null) { + values = [] + } + return { + values: values, + isAdding: false, + addingValue: {"pattern": "", "replacement": "", "isCaseInsensitive": false, "isRegexp": false} + } + }, + methods: { + add: function () { + this.isAdding = true + let that = this + setTimeout(function () { + that.$refs.pattern.focus() + }) + }, + remove: function (index) { + this.values.$remove(index) + }, + confirm: function () { + let that = this + if (this.addingValue.pattern.length == 0) { + teaweb.warn("替换前内容不能为空", function () { + that.$refs.pattern.focus() + }) + return + } + + this.values.push(this.addingValue) + this.cancel() + }, + cancel: function () { + this.isAdding = false + this.addingValue = {"pattern": "", "replacement": "", "isCaseInsensitive": false, "isRegexp": false} + } + }, + template: `
+ +
+
+ {{value.pattern}} => {{value.replacement}}[空] + +
+
+
+ + + + + + + + + + + + + +
替换前内容 *
替换后内容
是否忽略大小写 + +
+ +
+   + +
+
+
+ +
+
` +}) + // 浏览条件列表 Vue.component("http-request-conds-view", { props: ["v-conds"], @@ -5622,10 +5700,10 @@ Vue.component("user-selector", { Vue.component("http-header-policy-box", { props: ["v-request-header-policy", "v-request-header-ref", "v-response-header-policy", "v-response-header-ref", "v-params", "v-is-location", "v-is-group", "v-has-group-request-config", "v-has-group-response-config", "v-group-setting-url"], data: function () { - let type = "request" + let type = "response" let hash = window.location.hash - if (hash == "#response") { - type = "response" + if (hash == "#request") { + type = "request" } // ref @@ -5693,7 +5771,7 @@ Vue.component("http-header-policy-box", { window.location.reload() }, addSettingHeader: function (policyId) { - teaweb.popup("/servers/server/settings/headers/createSetPopup?" + this.vParams + "&headerPolicyId=" + policyId, { + teaweb.popup("/servers/server/settings/headers/createSetPopup?" + this.vParams + "&headerPolicyId=" + policyId + "&type=" + this.type, { callback: function () { teaweb.successRefresh("保存成功") } @@ -5707,7 +5785,7 @@ Vue.component("http-header-policy-box", { }) }, updateSettingPopup: function (policyId, headerId) { - teaweb.popup("/servers/server/settings/headers/updateSetPopup?" + this.vParams + "&headerPolicyId=" + policyId + "&headerId=" + headerId, { + teaweb.popup("/servers/server/settings/headers/updateSetPopup?" + this.vParams + "&headerPolicyId=" + policyId + "&headerId=" + headerId+ "&type=" + this.type, { callback: function () { teaweb.successRefresh("保存成功") } @@ -5739,8 +5817,8 @@ Vue.component("http-header-policy-box", { }, template: `
@@ -5773,7 +5851,17 @@ Vue.component("http-header-policy-box", { - {{header.name}} + + {{header.name}} +
+ {{code}} + {{method}} + {{domain}} + 附加 + 跳转禁用 + 替换 +
+ {{header.value}} 修改   删除 @@ -5822,7 +5910,17 @@ Vue.component("http-header-policy-box", { - {{header.name}} + + {{header.name}} +
+ {{code}} + {{method}} + {{domain}} + 附加 + 跳转禁用 + 替换 +
+ {{header.value}} 修改   删除 @@ -8338,6 +8436,88 @@ Vue.component("http-fastcgi-box", {
` }) +// 请求方法列表 +Vue.component("http-methods-box", { + props: ["v-methods"], + data: function () { + let methods = this.vMethods + if (methods == null) { + methods = [] + } + return { + methods: methods, + isAdding: false, + addingMethod: "" + } + }, + methods: { + add: function () { + this.isAdding = true + let that = this + setTimeout(function () { + that.$refs.addingMethod.focus() + }, 100) + }, + confirm: function () { + let that = this + + // 删除其中的空格 + this.addingMethod = this.addingMethod.replace(/\s/g, "").toUpperCase() + + if (this.addingMethod.length == 0) { + teaweb.warn("请输入要添加的请求方法", function () { + that.$refs.addingMethod.focus() + }) + return + } + + // 是否已经存在 + if (this.methods.$contains(this.addingMethod)) { + teaweb.warn("此请求方法已经存在,无需重复添加", function () { + that.$refs.addingMethod.focus() + }) + return + } + + this.methods.push(this.addingMethod) + this.cancel() + }, + remove: function (index) { + this.methods.$remove(index) + }, + cancel: function () { + this.isAdding = false + this.addingMethod = "" + } + }, + template: `
+ +
+ + {{method}} +   + +
+
+
+
+
+ +
+
+ +   +
+
+

格式为大写,比如GETPOST等。

+
+
+
+ +
+
` +}) + // URL扩展名条件 Vue.component("http-cond-url-extension", { props: ["v-cond"], @@ -9124,6 +9304,96 @@ Vue.component("http-cond-params", { ` }) +// 请求方法列表 +Vue.component("http-status-box", { + props: ["v-status-list"], + data: function () { + let statusList = this.vStatusList + if (statusList == null) { + statusList = [] + } + return { + statusList: statusList, + isAdding: false, + addingStatus: "" + } + }, + methods: { + add: function () { + this.isAdding = true + let that = this + setTimeout(function () { + that.$refs.addingStatus.focus() + }, 100) + }, + confirm: function () { + let that = this + + // 删除其中的空格 + this.addingStatus = this.addingStatus.replace(/\s/g, "").toUpperCase() + + if (this.addingStatus.length == 0) { + teaweb.warn("请输入要添加的状态码", function () { + that.$refs.addingStatus.focus() + }) + return + } + + // 是否已经存在 + if (this.statusList.$contains(this.addingStatus)) { + teaweb.warn("此状态码已经存在,无需重复添加", function () { + that.$refs.addingStatus.focus() + }) + return + } + + // 格式 + if (!this.addingStatus.match(/^\d{3}$/)) { + teaweb.warn("请输入正确的状态码", function () { + that.$refs.addingStatus.focus() + }) + return + } + + this.statusList.push(parseInt(this.addingStatus, 10)) + this.cancel() + }, + remove: function (index) { + this.statusList.$remove(index) + }, + cancel: function () { + this.isAdding = false + this.addingStatus = "" + } + }, + template: `
+ +
+ + {{status}} +   + +
+
+
+
+
+ +
+
+ +   +
+
+

格式为三位数字,比如200404等。

+
+
+
+ +
+
` +}) + Vue.component("server-group-selector", { props: ["v-groups"], data: function () {