diff --git a/web/public/js/components.js b/web/public/js/components.js index a35b327e..44f00d77 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -2525,6 +2525,44 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
[选择已有策略]     [创建新策略]
+`}),Vue.component("http-optimization-config-box",{props:["v-optimization-config","v-is-location","v-is-group"],data:function(){return{config:this.vOptimizationConfig,moreOptionsVisible:!1}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.config.isPrior)&&this.config.isOn}},template:`
+ + + + + + + + + + + + + + + + + +
HTML优化 +
+ + +
+

可以自动优化HTML中包含的空白、注释、空标签等。只有文件可以缓存时才会被优化。

+
Javascript优化 +
+ + +
+

可以自动缩短Javascript中变量、函数名称等。只有文件可以缓存时才会被优化。

+
CSS优化 +
+ + +
+

可以自动去除CSS中包含的空白。只有文件可以缓存时才会被优化。

+
+
`}),Vue.component("http-websocket-box",{props:["v-websocket-ref","v-websocket-config","v-is-location","v-is-group"],data:function(){let e=this.vWebsocketRef,t=(null==e&&(e={isPrior:!1,isOn:!1,websocketId:0}),this.vWebsocketConfig);return null==t?t={id:0,isOn:!1,handshakeTimeout:{count:30,unit:"second"},allowAllOrigins:!0,allowedOrigins:[],requestSameOrigin:!0,requestOrigin:""}:(null==t.handshakeTimeout&&(t.handshakeTimeout={count:30,unit:"second"}),null==t.allowedOrigins&&(t.allowedOrigins=[])),{websocketRef:e,websocketConfig:t,handshakeTimeoutCountString:t.handshakeTimeout.count.toString(),advancedVisible:!1}},watch:{handshakeTimeoutCountString:function(e){e=parseInt(e);!isNaN(e)&&0<=e?this.websocketConfig.handshakeTimeout.count=e:this.websocketConfig.handshakeTimeout.count=0}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.websocketRef.isPrior)&&this.websocketRef.isOn},changeAdvancedVisible:function(e){this.advancedVisible=e},createOrigin:function(){let t=this;teaweb.popup("/servers/server/settings/websocket/createOrigin",{height:"12.5em",callback:function(e){t.websocketConfig.allowedOrigins.push(e.data.origin)}})},removeOrigin:function(e){this.websocketConfig.allowedOrigins.$remove(e)}},template:`
@@ -2671,7 +2709,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
-`}),Vue.component("uam-config-box",{props:["v-uam-config","v-is-location","v-is-group"],data:function(){let e=this.vUamConfig;return null==(e=null==e?{isPrior:!1,isOn:!1,addToWhiteList:!0,onlyURLPatterns:[],exceptURLPatterns:[]}:e).onlyURLPatterns&&(e.onlyURLPatterns=[]),null==e.exceptURLPatterns&&(e.exceptURLPatterns=[]),{config:e,moreOptionsVisible:!1}},methods:{showMoreOptions:function(){this.moreOptionsVisible=!this.moreOptionsVisible}},template:`
+
`}),Vue.component("uam-config-box",{props:["v-uam-config","v-is-location","v-is-group"],data:function(){let e=this.vUamConfig;return null==(e=null==e?{isPrior:!1,isOn:!1,addToWhiteList:!0,onlyURLPatterns:[],exceptURLPatterns:[],minQPSPerIP:0}:e).onlyURLPatterns&&(e.onlyURLPatterns=[]),null==e.exceptURLPatterns&&(e.exceptURLPatterns=[]),{config:e,moreOptionsVisible:!1,minQPSPerIP:e.minQPSPerIP}},watch:{minQPSPerIP:function(e){let t=parseInt(e.toString());(isNaN(t)||t<0)&&(t=0),this.config.minQPSPerIP=t}},methods:{showMoreOptions:function(){this.moreOptionsVisible=!this.moreOptionsVisible}},template:`
@@ -2684,12 +2722,22 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio - + - + + + + + @@ -3720,7 +3768,7 @@ example2.com
单IP最低QPS +
+ + 请求数/秒 +
+

当某个IP在1分钟内平均QPS达到此值时,才会触发5秒盾;如果设置为0,表示任何访问都会触发。

+
加入IP白名单 @@ -2947,14 +2995,14 @@ example2.com
允许的域名 - +

如果填写了允许的域名,那么只有这些域名可以自动跳转。

排除的域名 - +

如果填写了排除的域名,那么这些域名将不跳转。

-
`}),Vue.component("http-cc-config-box",{props:["v-cc-config","v-is-location","v-is-group"],data:function(){let e=this.vCcConfig;return"boolean"!=typeof(e=null==e?{isPrior:!1,isOn:!1,enableFingerprint:!0,enableGET302:!0,onlyURLPatterns:[],exceptURLPatterns:[]}:e).enableFingerprint&&(e.enableFingerprint=!0),"boolean"!=typeof e.enableGET302&&(e.enableGET302=!0),null==e.onlyURLPatterns&&(e.onlyURLPatterns=[]),null==e.exceptURLPatterns&&(e.exceptURLPatterns=[]),{config:e,moreOptionsVisible:!1}},methods:{showMoreOptions:function(){this.moreOptionsVisible=!this.moreOptionsVisible}},template:`
+
`}),Vue.component("http-cc-config-box",{props:["v-cc-config","v-is-location","v-is-group"],data:function(){let e=this.vCcConfig;return"boolean"!=typeof(e=null==e?{isPrior:!1,isOn:!1,enableFingerprint:!0,enableGET302:!0,onlyURLPatterns:[],exceptURLPatterns:[]}:e).enableFingerprint&&(e.enableFingerprint=!0),"boolean"!=typeof e.enableGET302&&(e.enableGET302=!0),null==e.onlyURLPatterns&&(e.onlyURLPatterns=[]),null==e.exceptURLPatterns&&(e.exceptURLPatterns=[]),{config:e,moreOptionsVisible:!1,minQPSPerIP:e.minQPSPerIP}},watch:{minQPSPerIP:function(e){let t=parseInt(e.toString());(isNaN(t)||t<0)&&(t=0),this.config.minQPSPerIP=t}},methods:{showMoreOptions:function(){this.moreOptionsVisible=!this.moreOptionsVisible}},template:`
@@ -3733,12 +3781,22 @@ example2.com - + - + + + + + - - - - - + + - - - - - + + + + + + - + - + + + + + @@ -10412,7 +10490,17 @@ Vue.component("http-cc-config-box", { } return { config: config, - moreOptionsVisible: false + moreOptionsVisible: false, + minQPSPerIP: config.minQPSPerIP + } + }, + watch: { + minQPSPerIP: function (v) { + let qps = parseInt(v.toString()) + if (isNaN(qps) || qps < 0) { + qps = 0 + } + this.config.minQPSPerIP = qps } }, methods: { @@ -10433,12 +10521,22 @@ Vue.component("http-cc-config-box", { - + - + + + + + - - - - - + + - - - - - + + + + + +
单IP最低QPS +
+ + 请求数/秒 +
+

当某个IP在1分钟内平均QPS达到此值时,才会触发CC防护;如果设置为0,表示任何访问都会触发。

+
例外URL @@ -4419,7 +4477,7 @@ example2.com
域名 - +
@@ -4444,7 +4502,7 @@ example2.com -`}),Vue.component("server-config-copy-link",{props:["v-server-id","v-config-code"],data:function(){return{serverId:this.vServerId,configCode:this.vConfigCode}},methods:{copy:function(){teaweb.popup("/servers/server/settings/copy?serverId="+this.serverId+"&configCode="+this.configCode,{height:"25em",callback:function(){teaweb.success("复制成功")}})}},template:'复制 '}),Vue.component("metric-key-label",{props:["v-key"],data:function(){return{keyDefs:window.METRIC_HTTP_KEYS}},methods:{keyName:function(i){let n=this,s="";var e=this.keyDefs.$find(function(e,t){return t.code==i||(i.startsWith("${arg.")&&t.code.startsWith("${arg.")?(s=n.getSubKey("arg.",i),!0):i.startsWith("${header.")&&t.code.startsWith("${header.")?(s=n.getSubKey("header.",i),!0):!(!i.startsWith("${cookie.")||!t.code.startsWith("${cookie."))&&(s=n.getSubKey("cookie.",i),!0))});return null!=e?0 +`}),Vue.component("server-config-copy-link",{props:["v-server-id","v-config-code"],data:function(){return{serverId:this.vServerId,configCode:this.vConfigCode}},methods:{copy:function(){teaweb.popup("/servers/server/settings/copy?serverId="+this.serverId+"&configCode="+this.configCode,{height:"25em",callback:function(){teaweb.success("批量复制成功")}})}},template:'批量 '}),Vue.component("metric-key-label",{props:["v-key"],data:function(){return{keyDefs:window.METRIC_HTTP_KEYS}},methods:{keyName:function(i){let n=this,s="";var e=this.keyDefs.$find(function(e,t){return t.code==i||(i.startsWith("${arg.")&&t.code.startsWith("${arg.")?(s=n.getSubKey("arg.",i),!0):i.startsWith("${header.")&&t.code.startsWith("${header.")?(s=n.getSubKey("header.",i),!0):!(!i.startsWith("${cookie.")||!t.code.startsWith("${cookie."))&&(s=n.getSubKey("cookie.",i),!0))});return null!=e?0 {{keyName(this.vKey)}} `}),Vue.component("metric-keys-config-box",{props:["v-keys"],data:function(){let e=this.vKeys;return{keys:e=null==e?[]:e,isAdding:!1,key:"",subKey:"",keyDescription:"",keyDefs:window.METRIC_HTTP_KEYS}},watch:{keys:function(){this.$emit("change",this.keys)}},methods:{cancel:function(){this.key="",this.subKey="",this.keyDescription="",this.isAdding=!1},confirm:function(){if(0!=this.key.length){if(0 @@ -4567,17 +4625,8 @@ example2.com
图片质量 -
- - % -
-

取值在0到100之间,数值越大生成的图像越清晰,同时文件尺寸也会越大。

-
支持的扩展名 @@ -4592,11 +4641,18 @@ example2.com

响应的Content-Type里包含这些MimeType的内容将会被转成WebP。

内容最小长度
图片质量 +
+ + % +
+

取值在0到100之间,数值越大生成的图像越清晰,同时文件尺寸也会越大。

+
内容最小长度

0表示不限制,内容长度从文件尺寸或Content-Length中获取。

@@ -4792,15 +4848,15 @@ example2.com
-`}),Vue.component("http-cond-url-extension",{props:["v-cond"],data:function(){let e={isRequest:!0,param:"${requestPathLowerExtension}",operator:"in",value:"[]"},t=(null!=this.vCond&&this.vCond.param==e.param&&(e.value=this.vCond.value),[]);try{t=JSON.parse(e.value)}catch(e){}return{cond:e,extensions:t,isAdding:!1,addingExt:""}},watch:{extensions:function(){this.cond.value=JSON.stringify(this.extensions)}},methods:{addExt:function(){if(this.isAdding=!this.isAdding,this.isAdding){let e=this;setTimeout(function(){e.$refs.addingExt.focus()},100)}},cancelAdding:function(){this.isAdding=!1,this.addingExt=""},confirmAdding:function(){0!=this.addingExt.length&&("."!=this.addingExt[0]&&(this.addingExt="."+this.addingExt),this.addingExt=this.addingExt.replace(/\s+/g,"").toLowerCase(),this.extensions.push(this.addingExt),this.cancelAdding())},removeExt:function(e){this.extensions.$remove(e)}},template:`
+
`}),Vue.component("http-cond-url-extension",{props:["v-cond"],data:function(){let e={isRequest:!0,param:"${requestPathLowerExtension}",operator:"in",value:"[]"},t=(null!=this.vCond&&this.vCond.param==e.param&&(e.value=this.vCond.value),[]);try{t=JSON.parse(e.value)}catch(e){}return{cond:e,extensions:t,isAdding:!1,addingExt:""}},watch:{extensions:function(){this.cond.value=JSON.stringify(this.extensions)}},methods:{addExt:function(){if(this.isAdding=!this.isAdding,this.isAdding){let e=this;setTimeout(function(){e.$refs.addingExt.focus()},100)}},cancelAdding:function(){this.isAdding=!1,this.addingExt=""},confirmAdding:function(){if(0!=this.addingExt.length){let t=this;this.addingExt.split(/[,;,;|]/).forEach(function(e){0<(e=e.trim()).length&&(e=(e="."!=e[0]?"."+e:e).replace(/\s+/g,"").toLowerCase(),t.extensions.push(e))}),this.cancelAdding()}},removeExt:function(e){this.extensions.$remove(e)}},template:`
-
{{ext}}
+
{{ext}}
- +
@@ -4810,7 +4866,7 @@ example2.com
-

扩展名需要包含点(.)符号,例如.jpg.png之类。

+

扩展名需要包含点(.)符号,例如.jpg.png之类;多个扩展名用逗号分割。

`}),Vue.component("http-cond-url-not-extension",{props:["v-cond"],data:function(){let e={isRequest:!0,param:"${requestPathLowerExtension}",operator:"not in",value:"[]"},t=(null!=this.vCond&&this.vCond.param==e.param&&(e.value=this.vCond.value),[]);try{t=JSON.parse(e.value)}catch(e){}return{cond:e,extensions:t,isAdding:!1,addingExt:""}},watch:{extensions:function(){this.cond.value=JSON.stringify(this.extensions)}},methods:{addExt:function(){if(this.isAdding=!this.isAdding,this.isAdding){let e=this;setTimeout(function(){e.$refs.addingExt.focus()},100)}},cancelAdding:function(){this.isAdding=!1,this.addingExt=""},confirmAdding:function(){0!=this.addingExt.length&&("."!=this.addingExt[0]&&(this.addingExt="."+this.addingExt),this.addingExt=this.addingExt.replace(/\s+/g,"").toLowerCase(),this.extensions.push(this.addingExt),this.cancelAdding())},removeExt:function(e){this.extensions.$remove(e)}},template:`
diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index 764f7249..d4864cfa 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -7296,6 +7296,63 @@ Vue.component("http-firewall-policy-selector", {
` }) +// 压缩配置 +Vue.component("http-optimization-config-box", { + props: ["v-optimization-config", "v-is-location", "v-is-group"], + data: function () { + let config = this.vOptimizationConfig + + return { + config: config, + moreOptionsVisible: false + } + }, + methods: { + isOn: function () { + return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior) && this.config.isOn + } + }, + template: `
+ + + + + + + + + + + + + + + + + +
HTML优化 +
+ + +
+

可以自动优化HTML中包含的空白、注释、空标签等。只有文件可以缓存时才会被优化。

+
Javascript优化 +
+ + +
+

可以自动缩短Javascript中变量、函数名称等。只有文件可以缓存时才会被优化。

+
CSS优化 +
+ + +
+

可以自动去除CSS中包含的空白。只有文件可以缓存时才会被优化。

+
+
+
` +}) + Vue.component("http-websocket-box", { props: ["v-websocket-ref", "v-websocket-config", "v-is-location", "v-is-group"], data: function () { @@ -7692,7 +7749,8 @@ Vue.component("uam-config-box", { isOn: false, addToWhiteList: true, onlyURLPatterns: [], - exceptURLPatterns: [] + exceptURLPatterns: [], + minQPSPerIP: 0 } } if (config.onlyURLPatterns == null) { @@ -7703,7 +7761,17 @@ Vue.component("uam-config-box", { } return { config: config, - moreOptionsVisible: false + moreOptionsVisible: false, + minQPSPerIP: config.minQPSPerIP + } + }, + watch: { + minQPSPerIP: function (v) { + let qps = parseInt(v.toString()) + if (isNaN(qps) || qps < 0) { + qps = 0 + } + this.config.minQPSPerIP = qps } }, methods: { @@ -7724,12 +7792,22 @@ Vue.component("uam-config-box", {
单IP最低QPS +
+ + 请求数/秒 +
+

当某个IP在1分钟内平均QPS达到此值时,才会触发5秒盾;如果设置为0,表示任何访问都会触发。

+
加入IP白名单 @@ -8383,14 +8461,14 @@ Vue.component("http-redirect-to-https-box", {
允许的域名 - +

如果填写了允许的域名,那么只有这些域名可以自动跳转。

排除的域名 - +

如果填写了排除的域名,那么这些域名将不跳转。

单IP最低QPS +
+ + 请求数/秒 +
+

当某个IP在1分钟内平均QPS达到此值时,才会触发CC防护;如果设置为0,表示任何访问都会触发。

+
例外URL @@ -12322,7 +12420,7 @@ Vue.component("http-access-log-search-box", {
域名 - +
@@ -12363,12 +12461,12 @@ Vue.component("server-config-copy-link", { teaweb.popup("/servers/server/settings/copy?serverId=" + this.serverId + "&configCode=" + this.configCode, { height: "25em", callback: function () { - teaweb.success("复制成功") + teaweb.success("批量复制成功") } }) } }, - template: `复制 ` + template: `批量 ` }) // 显示指标对象名 @@ -12769,17 +12867,8 @@ Vue.component("http-webp-config-box", {
图片质量 -
- - % -
-

取值在0到100之间,数值越大生成的图像越清晰,同时文件尺寸也会越大。

-
支持的扩展名 @@ -12794,11 +12883,18 @@ Vue.component("http-webp-config-box", {

响应的Content-Type里包含这些MimeType的内容将会被转成WebP。

内容最小长度
图片质量 +
+ + % +
+

取值在0到100之间,数值越大生成的图像越清晰,同时文件尺寸也会越大。

+
内容最小长度

0表示不限制,内容长度从文件尺寸或Content-Length中获取。

@@ -13403,11 +13499,18 @@ Vue.component("http-cond-url-extension", { if (this.addingExt.length == 0) { return } - if (this.addingExt[0] != ".") { - this.addingExt = "." + this.addingExt - } - this.addingExt = this.addingExt.replace(/\s+/g, "").toLowerCase() - this.extensions.push(this.addingExt) + + let that = this + this.addingExt.split(/[,;,;|]/).forEach(function (ext) { + ext = ext.trim() + if (ext.length > 0) { + if (ext[0] != ".") { + ext = "." + ext + } + ext = ext.replace(/\s+/g, "").toLowerCase() + that.extensions.push(ext) + } + }) // 清除状态 this.cancelAdding() @@ -13419,12 +13522,12 @@ Vue.component("http-cond-url-extension", { template: `
-
{{ext}}
+
{{ext}}
- +
@@ -13434,7 +13537,7 @@ Vue.component("http-cond-url-extension", {
-

扩展名需要包含点(.)符号,例如.jpg.png之类。

+

扩展名需要包含点(.)符号,例如.jpg.png之类;多个扩展名用逗号分割。

` })