diff --git a/web/public/js/components.js b/web/public/js/components.js index 98bd6ab3..7160e0c5 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -3971,6 +3971,53 @@ example2.com +`}),Vue.component("http-firewall-js-cookie-options",{props:["v-js-cookie-options"],mounted:function(){this.updateSummary()},data:function(){let e=this.vJsCookieOptions;return{options:e=null==e?{life:0,maxFails:0,failBlockTimeout:0,failBlockScopeAll:!1,scope:"service"}:e,isEditing:!1,summary:""}},watch:{"options.life":function(e){let t=parseInt(e,10);isNaN(t)&&(t=0),this.options.life=t,this.updateSummary()},"options.maxFails":function(e){let t=parseInt(e,10);isNaN(t)&&(t=0),this.options.maxFails=t,this.updateSummary()},"options.failBlockTimeout":function(e){let t=parseInt(e,10);isNaN(t)&&(t=0),this.options.failBlockTimeout=t,this.updateSummary()},"options.failBlockScopeAll":function(e){this.updateSummary()}},methods:{edit:function(){this.isEditing=!this.isEditing},updateSummary:function(){let e=[];0 + + {{summary}} +
+ + + + + + + + + + + + + + + + + + + +
有效时间 +
+ + +
+

验证通过后在这个时间内不再验证,默认3600秒。

+
最多失败次数 +
+ + +
+

建议填入一个不小于5的数字,以减少误判几率。允许用户失败尝试的最多次数,超过这个次数将被自动加入黑名单。如果为空或者为0,表示不限制。

+
失败拦截时间 +
+ + +
+

在达到最多失败次数(大于0)时,自动拦截的时长;如果为0表示不自动拦截。

+
失败全局封禁 + +

选中后,表示允许系统尝试全局封禁某个IP,以提升封禁性能。

+
+
+ `}),Vue.component("http-compression-config-box",{props:["v-compression-config","v-is-location","v-is-group"],mounted:function(){let e=this;sortLoad(function(){e.initSortableTypes()})},data:function(){let t=this.vCompressionConfig,e=(null==(t=null==t?{isPrior:!1,isOn:!1,useDefaultTypes:!0,types:["brotli","gzip","zstd","deflate"],level:5,decompressData:!1,gzipRef:null,deflateRef:null,brotliRef:null,minLength:{count:1,unit:"kb"},maxLength:{count:32,unit:"mb"},mimeTypes:["text/*","application/javascript","application/json","application/atom+xml","application/rss+xml","application/xhtml+xml","font/*","image/svg+xml"],extensions:[".js",".json",".html",".htm",".xml",".css",".woff2",".txt"],exceptExtensions:[".apk",".ipa"],conds:null,enablePartialContent:!1}:t).types&&(t.types=[]),null==t.mimeTypes&&(t.mimeTypes=[]),null==t.extensions&&(t.extensions=[]),[{name:"Gzip",code:"gzip",isOn:!0},{name:"Deflate",code:"deflate",isOn:!0},{name:"Brotli",code:"brotli",isOn:!0},{name:"ZSTD",code:"zstd",isOn:!0}]),i=[];return t.types.forEach(function(t){e.forEach(function(e){t==e.code&&(e.isOn=!0,i.push(e))})}),e.forEach(function(e){t.types.$contains(e.code)||(e.isOn=!1,i.push(e))}),{config:t,moreOptionsVisible:!1,allTypes:i}},watch:{"config.level":function(e){let t=parseInt(e);isNaN(t)||t<1?t=1:10 @@ -4310,6 +4357,7 @@ example2.com 默认设置
状态码:{{options.statusCode}} / 提示内容:[{{options.body.length}}字符][无] / 超时时间:{{options.timeout}}秒 / 最大封禁时长:{{options.timeoutMax}}秒 + / 尝试全局封禁
`}),Vue.component("http-access-log-config-box",{props:["v-access-log-config","v-fields","v-default-field-codes","v-is-location","v-is-group"],data:function(){let t=this,i=(setTimeout(function(){t.changeFields()},100),{isPrior:!1,isOn:!1,fields:[1,2,6,7],status1:!0,status2:!0,status3:!0,status4:!0,status5:!0,firewallOnly:!1,enableClientClosed:!1});return null!=this.vAccessLogConfig&&(i=this.vAccessLogConfig),this.vFields.forEach(function(e){null==t.vAccessLogConfig?e.isChecked=t.vDefaultFieldCodes.$contains(e.code):e.isChecked=i.fields.$contains(e.code)}),{accessLog:i,hasRequestBodyField:this.vFields.$contains(8),showAdvancedOptions:!1}},methods:{changeFields:function(){this.accessLog.fields=this.vFields.filter(function(e){return e.isChecked}).map(function(e){return e.code}),this.hasRequestBodyField=this.accessLog.fields.$contains(8)},changeAdvanced:function(e){this.showAdvancedOptions=e}},template:`
@@ -4576,7 +4624,8 @@ example2.com
-`}),Vue.component("ssl-certs-view",{props:["v-certs"],data:function(){let e=this.vCerts;return{certs:e=null==e?[]:e}},methods:{formatTime:function(e){return new Date(1e3*e).format("Y-m-d")},viewCert:function(e){teaweb.popup("/servers/certs/certPopup?certId="+e,{height:"28em",width:"48em"})}},template:`
+
`}),Vue.component("http-firewall-js-cookie-options-viewer",{props:["v-js-cookie-options"],mounted:function(){this.updateSummary()},data:function(){let e=this.vJsCookieOptions;return{options:e=null==e?{life:0,maxFails:0,failBlockTimeout:0,failBlockScopeAll:!1,scope:""}:e,summary:""}},methods:{updateSummary:function(){let e=[];0{{summary}} +`}),Vue.component("ssl-certs-view",{props:["v-certs"],data:function(){let e=this.vCerts;return{certs:e=null==e?[]:e}},methods:{formatTime:function(e){return new Date(1e3*e).format("Y-m-d")},viewCert:function(e){teaweb.popup("/servers/certs/certPopup?certId="+e,{height:"28em",width:"48em"})}},template:`
{{cert.name}} / {{cert.dnsNames}} / 有效至{{formatTime(cert.timeEndAt)}}   @@ -5070,10 +5119,11 @@ example2.com -
`}),Vue.component("http-firewall-block-options",{props:["v-block-options"],data:function(){return{blockOptions:this.vBlockOptions,statusCode:this.vBlockOptions.statusCode,timeout:this.vBlockOptions.timeout,timeoutMax:this.vBlockOptions.timeoutMax,isEditing:!1}},watch:{statusCode:function(e){e=parseInt(e);isNaN(e)?this.blockOptions.statusCode=403:this.blockOptions.statusCode=e},timeout:function(e){e=parseInt(e);isNaN(e)?this.blockOptions.timeout=0:this.blockOptions.timeout=e},timeoutMax:function(e){e=parseInt(e);isNaN(e)?this.blockOptions.timeoutMax=0:this.blockOptions.timeoutMax=e}},methods:{edit:function(){this.isEditing=!this.isEditing}},template:``}),Vue.component("http-firewall-block-options",{props:["v-block-options"],data:function(){return{options:this.vBlockOptions,statusCode:this.vBlockOptions.statusCode,timeout:this.vBlockOptions.timeout,timeoutMax:this.vBlockOptions.timeoutMax,isEditing:!1}},watch:{statusCode:function(e){e=parseInt(e);isNaN(e)?this.options.statusCode=403:this.options.statusCode=e},timeout:function(e){e=parseInt(e);isNaN(e)?this.options.timeout=0:this.options.timeout=e},timeoutMax:function(e){e=parseInt(e);isNaN(e)?this.options.timeoutMax=0:this.options.timeoutMax=e}},methods:{edit:function(){this.isEditing=!this.isEditing}},template:`
+ + 状态码:{{statusCode}} / 提示内容:[{{options.body.length}}字符][无] / 封禁时长:{{timeout}}秒 / 最大封禁时长:{{timeoutMax}}秒 + / 尝试全局封禁 @@ -5085,7 +5135,7 @@ example2.com @@ -5108,6 +5158,13 @@ example2.com

如果最大封禁时长大于封禁时长({{timeout}}秒),那么表示每次封禁的时候,将会在这两个时长数字之间随机选取一个数字作为最终的封禁时长。

+ + + +
提示内容 - +
失败全局封禁 + +

选中后,表示允许系统尝试全局封禁某个IP,以提升封禁性能。

+
`}),Vue.component("http-hls-config-box",{props:["value","v-is-location","v-is-group"],data:function(){let e=this.value,t=(e=null==e?{isPrior:!1}:e).encrypting;return null==t&&(t={isOn:!1,onlyURLPatterns:[],exceptURLPatterns:[]},e.encrypting=t),{config:e,encryptingConfig:t,encryptingMoreOptionsVisible:!1}},methods:{isOn:function(){return!this.vIsLocation&&!this.vIsGroup||this.config.isPrior},showEncryptingMoreOptions:function(){this.encryptingMoreOptionsVisible=!this.encryptingMoreOptionsVisible}},template:`
@@ -5618,7 +5675,7 @@ example2.com
-
`}),Vue.component("http-firewall-captcha-options",{props:["v-captcha-options"],mounted:function(){this.updateSummary()},data:function(){let e=this.vCaptchaOptions;return(e=null==e?{captchaType:"default",countLetters:0,life:0,maxFails:0,failBlockTimeout:0,failBlockScopeAll:!1,uiIsOn:!1,uiTitle:"",uiPrompt:"",uiButtonTitle:"",uiShowRequestId:!0,uiCss:"",uiFooter:"",uiBody:"",cookieId:"",lang:"",geeTestConfig:{isOn:!1,captchaId:"",captchaKey:""}}:e).countLetters<=0&&(e.countLetters=6),null!=e.captchaType&&0!=e.captchaType.length||(e.captchaType="default"),{options:e,isEditing:!1,summary:"",uiBodyWarning:"",captchaTypes:window.WAF_CAPTCHA_TYPES}},watch:{"options.countLetters":function(e){let t=parseInt(e,10);isNaN(t)||t<0?t=0:10|\s).+\$\{body}.*<\/form>/s.test(e)?this.uiBodyWarning="页面模板中不能使用
标签包裹${body}变量,否则将导致验证码表单无法提交。":this.uiBodyWarning=""},"options.geeTestConfig.isOn":function(e){this.updateSummary()}},methods:{edit:function(){this.isEditing=!this.isEditing},updateSummary:function(){let e=[],i=(0 +
`}),Vue.component("http-firewall-captcha-options",{props:["v-captcha-options"],mounted:function(){this.updateSummary()},data:function(){let e=this.vCaptchaOptions;return(e=null==e?{captchaType:"default",countLetters:0,life:0,maxFails:0,failBlockTimeout:0,failBlockScopeAll:!1,uiIsOn:!1,uiTitle:"",uiPrompt:"",uiButtonTitle:"",uiShowRequestId:!0,uiCss:"",uiFooter:"",uiBody:"",cookieId:"",lang:"",geeTestConfig:{isOn:!1,captchaId:"",captchaKey:""}}:e).countLetters<=0&&(e.countLetters=6),null!=e.captchaType&&0!=e.captchaType.length||(e.captchaType="default"),{options:e,isEditing:!1,summary:"",uiBodyWarning:"",captchaTypes:window.WAF_CAPTCHA_TYPES}},watch:{"options.countLetters":function(e){let t=parseInt(e,10);isNaN(t)||t<0?t=0:10|\s).+\$\{body}.*<\/form>/s.test(e)?this.uiBodyWarning="页面模板中不能使用
标签包裹${body}变量,否则将导致验证码表单无法提交。":this.uiBodyWarning=""},"options.geeTestConfig.isOn":function(e){this.updateSummary()}},methods:{edit:function(){this.isEditing=!this.isEditing},updateSummary:function(){let e=[],i=(0 {{summary}}
@@ -5667,7 +5724,7 @@ example2.com 失败全局封禁 -

是否在失败时全局封禁,默认为只封禁对单个网站的访问。

+

选中后,表示允许系统尝试全局封禁某个IP,以提升封禁性能。

@@ -5976,7 +6033,7 @@ example2.com
    - +     @@ -6028,8 +6085,8 @@ example2.com - [服务:{{item.policy.server.name}}] - [服务:{{item.policy.server.name}}] + [网站:{{item.policy.server.name}}] + [网站:{{item.policy.server.name}}] [策略:{{item.policy.name}}] @@ -6052,11 +6109,12 @@ example2.com
{{item.expiredTime}} -
+
已过期
-
- {{formatSeconds(item.lifeSeconds)}} +
+ {{formatSeconds(item.lifeSeconds)}} + 已过期
不过期 @@ -6090,7 +6148,9 @@ example2.com {{vItem.ipFrom}} - {{vItem.ipTo}} - {{vItem.ipFrom}} + {{vItem.ipFrom}} + - {{vItem.ipTo}} +   级别:{{vItem.eventLevelName}} `}),Vue.component("ip-box",{props:["v-ip"],methods:{popup:function(){let e=this.vIp;var t;null!=e&&0!=e.length||(t=this.$refs.container,null==(e=t.innerText)&&(e=t.textContent)),teaweb.popup("/servers/ipbox?ip="+e,{width:"50em",height:"30em"})}},template:''}),Vue.component("sms-sender",{props:["value","name"],mounted:function(){this.initType(this.config.type)},data:function(){let e=this.value;return{config:e=null==e?{isOn:!1,type:"webHook",webHookParams:{url:"",method:"POST"}}:e}},watch:{"config.type":function(e){this.initType(e)}},methods:{initType:function(e){"webHook"===e&&null==this.config.webHookParams&&(this.config.webHookParams={url:"",method:"POST"})},test:function(){window.TESTING_SMS_CONFIG=this.config,teaweb.popup("/users/setting/smsTest",{height:"22em"})}},template:`
diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index 00143efa..61b15ed9 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -10872,6 +10872,137 @@ Vue.component("http-firewall-page-options", { ` }) +Vue.component("http-firewall-js-cookie-options", { + props: ["v-js-cookie-options"], + mounted: function () { + this.updateSummary() + }, + data: function () { + let options = this.vJsCookieOptions + if (options == null) { + options = { + life: 0, + maxFails: 0, + failBlockTimeout: 0, + failBlockScopeAll: false, + scope: "service" + } + } + + return { + options: options, + isEditing: false, + summary: "" + } + }, + watch: { + "options.life": function (v) { + let i = parseInt(v, 10) + if (isNaN(i)) { + i = 0 + } + this.options.life = i + this.updateSummary() + }, + "options.maxFails": function (v) { + let i = parseInt(v, 10) + if (isNaN(i)) { + i = 0 + } + this.options.maxFails = i + this.updateSummary() + }, + "options.failBlockTimeout": function (v) { + let i = parseInt(v, 10) + if (isNaN(i)) { + i = 0 + } + this.options.failBlockTimeout = i + this.updateSummary() + }, + "options.failBlockScopeAll": function (v) { + this.updateSummary() + } + }, + methods: { + edit: function () { + this.isEditing = !this.isEditing + }, + updateSummary: function () { + let summaryList = [] + if (this.options.life > 0) { + summaryList.push("有效时间" + this.options.life + "秒") + } + if (this.options.maxFails > 0) { + summaryList.push("最多失败" + this.options.maxFails + "次") + } + if (this.options.failBlockTimeout > 0) { + summaryList.push("失败拦截" + this.options.failBlockTimeout + "秒") + } + if (this.options.failBlockScopeAll) { + summaryList.push("尝试全局封禁") + } + + if (summaryList.length == 0) { + this.summary = "默认配置" + } else { + this.summary = summaryList.join(" / ") + } + }, + confirm: function () { + this.isEditing = false + } + }, + template: `
+ + {{summary}} +
+ + + + + + + + + + + + + + + + + + + +
有效时间 +
+ + +
+

验证通过后在这个时间内不再验证,默认3600秒。

+
最多失败次数 +
+ + +
+

建议填入一个不小于5的数字,以减少误判几率。允许用户失败尝试的最多次数,超过这个次数将被自动加入黑名单。如果为空或者为0,表示不限制。

+
失败拦截时间 +
+ + +
+

在达到最多失败次数(大于0)时,自动拦截的时长;如果为0表示不自动拦截。

+
失败全局封禁 + +

选中后,表示允许系统尝试全局封禁某个IP,以提升封禁性能。

+
+
+
+` +}) + // 压缩配置 Vue.component("http-compression-config-box", { props: ["v-compression-config", "v-is-location", "v-is-group"], @@ -12020,6 +12151,7 @@ Vue.component("http-firewall-block-options-viewer", { 默认设置
状态码:{{options.statusCode}} / 提示内容:[{{options.body.length}}字符][无] / 超时时间:{{options.timeout}}秒 / 最大封禁时长:{{options.timeoutMax}}秒 + / 尝试全局封禁
` @@ -12550,6 +12682,54 @@ Vue.component("script-config-box", {
` }) +Vue.component("http-firewall-js-cookie-options-viewer", { + props: ["v-js-cookie-options"], + mounted: function () { + this.updateSummary() + }, + data: function () { + let options = this.vJsCookieOptions + if (options == null) { + options = { + life: 0, + maxFails: 0, + failBlockTimeout: 0, + failBlockScopeAll: false, + scope: "" + } + } + return { + options: options, + summary: "" + } + }, + methods: { + updateSummary: function () { + let summaryList = [] + if (this.options.life > 0) { + summaryList.push("有效时间" + this.options.life + "秒") + } + if (this.options.maxFails > 0) { + summaryList.push("最多失败" + this.options.maxFails + "次") + } + if (this.options.failBlockTimeout > 0) { + summaryList.push("失败拦截" + this.options.failBlockTimeout + "秒") + } + if (this.options.failBlockScopeAll) { + summaryList.push("尝试全局封禁") + } + + if (summaryList.length == 0) { + this.summary = "默认配置" + } else { + this.summary = summaryList.join(" / ") + } + } + }, + template: `
{{summary}}
+` +}) + Vue.component("ssl-certs-view", { props: ["v-certs"], data: function () { @@ -13861,7 +14041,7 @@ Vue.component("http-firewall-block-options", { props: ["v-block-options"], data: function () { return { - blockOptions: this.vBlockOptions, + options: this.vBlockOptions, statusCode: this.vBlockOptions.statusCode, timeout: this.vBlockOptions.timeout, timeoutMax: this.vBlockOptions.timeoutMax, @@ -13872,25 +14052,25 @@ Vue.component("http-firewall-block-options", { statusCode: function (v) { let statusCode = parseInt(v) if (isNaN(statusCode)) { - this.blockOptions.statusCode = 403 + this.options.statusCode = 403 } else { - this.blockOptions.statusCode = statusCode + this.options.statusCode = statusCode } }, timeout: function (v) { let timeout = parseInt(v) if (isNaN(timeout)) { - this.blockOptions.timeout = 0 + this.options.timeout = 0 } else { - this.blockOptions.timeout = timeout + this.options.timeout = timeout } }, timeoutMax: function (v) { let timeoutMax = parseInt(v) if (isNaN(timeoutMax)) { - this.blockOptions.timeoutMax = 0 + this.options.timeoutMax = 0 } else { - this.blockOptions.timeoutMax = timeoutMax + this.options.timeoutMax = timeoutMax } } }, @@ -13900,9 +14080,10 @@ Vue.component("http-firewall-block-options", { } }, template: `
- - 状态码:{{statusCode}} / 提示内容:[{{blockOptions.body.length}}字符][无] / 封禁时长:{{timeout}}秒 + + 状态码:{{statusCode}} / 提示内容:[{{options.body.length}}字符][无] / 封禁时长:{{timeout}}秒 / 最大封禁时长:{{timeoutMax}}秒 + / 尝试全局封禁 @@ -13914,7 +14095,7 @@ Vue.component("http-firewall-block-options", { @@ -13937,6 +14118,13 @@ Vue.component("http-firewall-block-options", {

如果最大封禁时长大于封禁时长({{timeout}}秒),那么表示每次封禁的时候,将会在这两个时长数字之间随机选取一个数字作为最终的封禁时长。

+ + + +
提示内容 - +
失败全局封禁 + +

选中后,表示允许系统尝试全局封禁某个IP,以提升封禁性能。

+
` @@ -15883,7 +16071,7 @@ Vue.component("http-firewall-captcha-options", { summaryList.push("失败拦截" + this.options.failBlockTimeout + "秒") } if (this.options.failBlockScopeAll) { - summaryList.push("全局封禁") + summaryList.push("尝试全局封禁") } let that = this @@ -15963,7 +16151,7 @@ Vue.component("http-firewall-captcha-options", { 失败全局封禁 -

是否在失败时全局封禁,默认为只封禁对单个网站的访问。

+

选中后,表示允许系统尝试全局封禁某个IP,以提升封禁性能。

@@ -16703,7 +16891,7 @@ Vue.component("ip-list-table", {
    - +     @@ -16755,8 +16943,8 @@ Vue.component("ip-list-table", { - [服务:{{item.policy.server.name}}] - [服务:{{item.policy.server.name}}] + [网站:{{item.policy.server.name}}] + [网站:{{item.policy.server.name}}] [策略:{{item.policy.name}}] @@ -16779,11 +16967,12 @@ Vue.component("ip-list-table", {
{{item.expiredTime}} -
+
已过期
-
- {{formatSeconds(item.lifeSeconds)}} +
+ {{formatSeconds(item.lifeSeconds)}} + 已过期
不过期 @@ -16822,7 +17011,9 @@ Vue.component("ip-item-text", { {{vItem.ipFrom}} - {{vItem.ipTo}} - {{vItem.ipFrom}} + {{vItem.ipFrom}} + - {{vItem.ipTo}} +   级别:{{vItem.eventLevelName}} ` })