diff --git a/internal/web/actions/default/clusters/cluster/settings/index.go b/internal/web/actions/default/clusters/cluster/settings/index.go index a95b36b8..01acf28e 100644 --- a/internal/web/actions/default/clusters/cluster/settings/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/index.go @@ -112,6 +112,7 @@ func (this *IndexAction) RunGet(params struct { "clock": clockConfig, "autoRemoteStart": cluster.AutoRemoteStart, "autoInstallNftables": cluster.AutoInstallNftables, + "autoSystemTuning": cluster.AutoSystemTuning, "sshParams": sshParams, "domainName": fullDomainName, } @@ -139,6 +140,7 @@ func (this *IndexAction) RunPost(params struct { ClockCheckChrony bool AutoRemoteStart bool AutoInstallNftables bool + AutoSystemTuning bool Must *actions.Must }) { @@ -193,6 +195,7 @@ func (this *IndexAction) RunPost(params struct { ClockJSON: clockConfigJSON, AutoRemoteStart: params.AutoRemoteStart, AutoInstallNftables: params.AutoInstallNftables, + AutoSystemTuning: params.AutoSystemTuning, SshParamsJSON: sshParamsJSON, }) if err != nil { diff --git a/internal/web/actions/default/clusters/create.go b/internal/web/actions/default/clusters/create.go index 5e43d8fc..957dea05 100644 --- a/internal/web/actions/default/clusters/create.go +++ b/internal/web/actions/default/clusters/create.go @@ -64,6 +64,7 @@ func (this *CreateAction) RunPost(params struct { InstallDir string SystemdServiceIsOn bool AutoInstallNftables bool + AutoSystemTuning bool // DNS相关 DnsDomainId int64 @@ -132,6 +133,7 @@ func (this *CreateAction) RunPost(params struct { SystemServicesJSON: systemServicesJSON, GlobalServerConfigJSON: globalServerConfigJSON, AutoInstallNftables: params.AutoInstallNftables, + AutoSystemTuning: params.AutoSystemTuning, }) if err != nil { this.ErrorPage(err) diff --git a/web/public/js/components.js b/web/public/js/components.js index 9c909cc3..7d239ad5 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -3803,16 +3803,6 @@ example2.com - - 单IP最低QPS - -
- - 请求数/秒 -
-

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

- - 例外URL @@ -3842,13 +3832,23 @@ example2.com - 使用自定义阈值 + 单IP最低QPS + +
+ + 请求数/秒 +
+

当某个IP在1分钟内平均QPS达到此值时,才会开始检测;如果设置为0,表示任何访问都会检测。(注意这里设置的是检测开启阈值,不是拦截阈值,拦截阈值在当前表单下方可以设置)

+ + + + 使用自定义拦截阈值 - 自定义阈值设置 + 自定义拦截阈值设置
@@ -6026,7 +6026,7 @@ example2.com
{{addr.protocol}}://{{addr.host.quoteIP()}}*:{{addr.portRange}}
-
`}),Vue.component("url-patterns-box",{props:["value"],data:function(){let e=[];return{patterns:e=null!=this.value?this.value:e,isAdding:!1,addingPattern:{type:"wildcard",pattern:""},editingIndex:-1}},methods:{add:function(){this.isAdding=!0;let e=this;setTimeout(function(){e.$refs.patternInput.focus()})},edit:function(e){this.isAdding=!0,this.editingIndex=e,this.addingPattern={type:this.patterns[e].type,pattern:this.patterns[e].pattern}},confirm:function(){if(0==this.addingPattern.pattern.trim().length){let e=this;void teaweb.warn("请输入URL",function(){e.$refs.patternInput.focus()})}else this.editingIndex<0?this.patterns.push({type:this.addingPattern.type,pattern:this.addingPattern.pattern}):(this.patterns[this.editingIndex].type=this.addingPattern.type,this.patterns[this.editingIndex].pattern=this.addingPattern.pattern),this.notifyChange(),this.cancel()},remove:function(e){this.patterns.$remove(e),this.cancel(),this.notifyChange()},cancel:function(){this.isAdding=!1,this.addingPattern={type:"wildcard",pattern:""},this.editingIndex=-1},patternTypeName:function(e){switch(e){case"wildcard":return"通配符";case"regexp":return"正则"}return""},notifyChange:function(){this.$emit("input",this.patterns)}},template:`
+
`}),Vue.component("url-patterns-box",{props:["value"],data:function(){let e=[];return{patterns:e=null!=this.value?this.value:e,isAdding:!1,addingPattern:{type:"wildcard",pattern:""},editingIndex:-1,patternIsInvalid:!1}},methods:{add:function(){this.isAdding=!0;let e=this;setTimeout(function(){e.$refs.patternInput.focus()})},edit:function(e){this.isAdding=!0,this.editingIndex=e,this.addingPattern={type:this.patterns[e].type,pattern:this.patterns[e].pattern}},confirm:function(){if(0==this.addingPattern.pattern.trim().length){let e=this;void teaweb.warn("请输入URL",function(){e.$refs.patternInput.focus()})}else this.editingIndex<0?this.patterns.push({type:this.addingPattern.type,pattern:this.addingPattern.pattern}):(this.patterns[this.editingIndex].type=this.addingPattern.type,this.patterns[this.editingIndex].pattern=this.addingPattern.pattern),this.notifyChange(),this.cancel()},remove:function(e){this.patterns.$remove(e),this.cancel(),this.notifyChange()},cancel:function(){this.isAdding=!1,this.addingPattern={type:"wildcard",pattern:""},this.editingIndex=-1},patternTypeName:function(e){switch(e){case"wildcard":return"通配符";case"regexp":return"正则"}return""},notifyChange:function(){this.$emit("input",this.patterns)},changePattern:function(){this.patternIsInvalid=!1;let e=this.addingPattern.pattern;switch(this.addingPattern.type){case"wildcard":0<=e.indexOf("?")&&(this.patternIsInvalid=!0);break;case"regexp":if(0<=e.indexOf("?")){var t=e.split("?");for(let e=0;e
[{{patternTypeName(pattern.type)}}] {{pattern.pattern}}   @@ -6043,14 +6043,15 @@ example2.com
- + +

通配符正则表达式中不能包含问号(?)及问号以后的内容。

- +
diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index 6e19791b..242657e2 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -10670,16 +10670,6 @@ Vue.component("http-cc-config-box", { - - 单IP最低QPS - -
- - 请求数/秒 -
-

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

- - 例外URL @@ -10709,13 +10699,23 @@ Vue.component("http-cc-config-box", { - 使用自定义阈值 + 单IP最低QPS + +
+ + 请求数/秒 +
+

当某个IP在1分钟内平均QPS达到此值时,才会开始检测;如果设置为0,表示任何访问都会检测。(注意这里设置的是检测开启阈值,不是拦截阈值,拦截阈值在当前表单下方可以设置)

+ + + + 使用自定义拦截阈值 - 自定义阈值设置 + 自定义拦截阈值设置
@@ -18122,7 +18122,9 @@ Vue.component("url-patterns-box", { isAdding: false, addingPattern: {"type": "wildcard", "pattern": ""}, - editingIndex: -1 + editingIndex: -1, + + patternIsInvalid: false } }, methods: { @@ -18183,6 +18185,27 @@ Vue.component("url-patterns-box", { }, notifyChange: function () { this.$emit("input", this.patterns) + }, + changePattern: function () { + this.patternIsInvalid = false + let pattern = this.addingPattern.pattern + switch (this.addingPattern.type) { + case "wildcard": + if (pattern.indexOf("?") >= 0) { + this.patternIsInvalid = true + } + break + case "regexp": + if (pattern.indexOf("?") >= 0) { + let pieces = pattern.split("?") + for (let i = 0; i < pieces.length - 1; i++) { + if (pieces[i].length == 0 || pieces[i][pieces[i].length - 1] != "\\") { + this.patternIsInvalid = true + } + } + } + break + } } }, template: `
@@ -18202,14 +18225,15 @@ Vue.component("url-patterns-box", {
- + +

通配符正则表达式中不能包含问号(?)及问号以后的内容。

- +
diff --git a/web/views/@default/clusters/cluster/settings/index.html b/web/views/@default/clusters/cluster/settings/index.html index 8e35d885..1b2573fc 100644 --- a/web/views/@default/clusters/cluster/settings/index.html +++ b/web/views/@default/clusters/cluster/settings/index.html @@ -109,7 +109,14 @@ 自动安装nftables -

在Linux系统中自动尝试安装nftables用于安全防御;此功能需要联网从Ubuntu、CentOS等软件库中下载安装包。

+

选中后,表示在Linux系统中自动尝试安装nftables用于安全防御;此功能需要联网从Ubuntu、CentOS等软件库中下载安装包。

+ + + + 自动调节系统参数 + + +

选中后,表示自动调整Linux内核等参数,以便提升性能;启用后,以往安装的边缘节点需要重启进程后才能生效。

diff --git a/web/views/@default/clusters/create.html b/web/views/@default/clusters/create.html index b7bae450..c610580f 100644 --- a/web/views/@default/clusters/create.html +++ b/web/views/@default/clusters/create.html @@ -60,7 +60,14 @@ 自动安装nftables -

在Linux系统中自动尝试安装nftables用于安全防御;此功能需要联网从Ubuntu、CentOS等软件库中下载安装包。

+

选中后,表示在Linux系统中自动尝试安装nftables用于安全防御;此功能需要联网从Ubuntu、CentOS等软件库中下载安装包。

+ + + + 自动调节系统参数 + + +

选中后,表示自动调整Linux内核等参数,以便提升性能。