diff --git a/web/public/js/components.js b/web/public/js/components.js index e30d9f22..e5bc10c3 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -417,17 +417,17 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
-`}),Vue.component("ns-route-ranges-box",{props:["v-ranges"],data:function(){let e=this.vRanges;return{ranges:e=null==e?[]:e,isAdding:!1,ipRangeFrom:"",ipRangeTo:""}},methods:{add:function(){this.isAdding=!0;let e=this;setTimeout(function(){e.$refs.ipRangeFrom.focus()},100)},remove:function(e){this.ranges.$remove(e)},cancelIPRange:function(){this.isAdding=!1,this.ipRangeFrom="",this.ipRangeTo=""},confirmIPRange:function(){let e=this;this.ipRangeFrom=this.ipRangeFrom.trim(),this.validateIP(this.ipRangeFrom)?(this.ipRangeTo=this.ipRangeTo.trim(),this.validateIP(this.ipRangeTo)?(this.ranges.push({type:"ipRange",params:{ipFrom:this.ipRangeFrom,ipTo:this.ipRangeTo}}),this.cancelIPRange()):teaweb.warn("结束IP填写错误",function(){e.$refs.ipRangeTo.focus()})):teaweb.warn("开始IP填写错误",function(){e.$refs.ipRangeFrom.focus()})},validateIP:function(e){if(!e.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/))return!1;let t=e.split("."),i=!0;return t.forEach(function(e){255 +`}),Vue.component("ns-route-ranges-box",{props:["v-ranges"],data:function(){let e=this.vRanges;return{ranges:e=null==e?[]:e,isAdding:!1,isAddingBatch:!1,ipRangeFrom:"",ipRangeTo:"",batchIPRange:""}},methods:{add:function(){this.isAdding=!0;let e=this;setTimeout(function(){e.$refs.ipRangeFrom.focus()},100)},remove:function(e){this.ranges.$remove(e)},cancelIPRange:function(){this.isAdding=!1,this.ipRangeFrom="",this.ipRangeTo=""},confirmIPRange:function(){let e=this;this.ipRangeFrom=this.ipRangeFrom.trim(),this.validateIP(this.ipRangeFrom)?(this.ipRangeTo=this.ipRangeTo.trim(),this.validateIP(this.ipRangeTo)?(this.ranges.push({type:"ipRange",params:{ipFrom:this.ipRangeFrom,ipTo:this.ipRangeTo}}),this.cancelIPRange()):teaweb.warn("结束IP填写错误",function(){e.$refs.ipRangeTo.focus()})):teaweb.warn("开始IP填写错误",function(){e.$refs.ipRangeFrom.focus()})},addBatch:function(){this.isAddingBatch=!0;let e=this;setTimeout(function(){e.$refs.batchIPRange.focus()},100)},cancelBatchIPRange:function(){this.isAddingBatch=!1,this.batchIPRange=""},confirmBatchIPRange:function(){let a=this,e=this.batchIPRange;if(0==e.length)teaweb.warn("请填写要加入的IP范围",function(){a.$refs.batchIPRange.focus()});else{let n=[],o="";e.split("\n").forEach(function(t){if(0!=(t=t.trim()).length){let e=(t=t.replace(",",",")).split(",");var i,s;2!=e.length?o=t:(i=e[0].trim(),s=e[1].trim(),a.validateIP(i)&&a.validateIP(s)?n.push({type:"ipRange",params:{ipFrom:i,ipTo:s}}):o=t)}}),0
-
+
IP范围: {{range.params.ipFrom}} - {{range.params.ipTo}}  
- +
@@ -443,8 +443,23 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
+ + +
+
+ +

每行一条,格式为开始IP,结束IP,比如192.168.1.100,192.168.1.200

+
+
+   + +
+
- +
+   + +
`}),Vue.component("ns-route-selector",{props:["v-route-code"],mounted:function(){let t=this;Tea.action("/ns/routes/options").post().success(function(e){t.routes=e.data.routes})},data:function(){let e=this.vRouteCode;return{routeCode:e=null==e?"":e,routes:[]}},template:`
@@ -3742,7 +3757,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio 网页提示内容 -

[使用模板]。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容。

+

[使用模板]。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容,适用于网站类服务。

diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index e1435370..1d8e37b6 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -1436,10 +1436,13 @@ Vue.component("ns-route-ranges-box", { return { ranges: ranges, isAdding: false, + isAddingBatch: false, // IP范围 ipRangeFrom: "", - ipRangeTo: "" + ipRangeTo: "", + + batchIPRange: "" } }, methods: { @@ -1486,6 +1489,65 @@ Vue.component("ns-route-ranges-box", { }) this.cancelIPRange() }, + addBatch: function () { + this.isAddingBatch = true + let that = this + setTimeout(function () { + that.$refs.batchIPRange.focus() + }, 100) + }, + cancelBatchIPRange: function () { + this.isAddingBatch = false + this.batchIPRange = "" + }, + confirmBatchIPRange: function () { + let that = this + let rangesText = this.batchIPRange + if (rangesText.length == 0) { + teaweb.warn("请填写要加入的IP范围", function () { + that.$refs.batchIPRange.focus() + }) + return + } + + let validRanges = [] + let invalidLine = "" + rangesText.split("\n").forEach(function (line) { + line = line.trim() + if (line.length == 0) { + return + } + line = line.replace(",", ",") + let pieces = line.split(",") + if (pieces.length != 2) { + invalidLine = line + return + } + let ipFrom = pieces[0].trim() + let ipTo = pieces[1].trim() + if (!that.validateIP(ipFrom) || !that.validateIP(ipTo)) { + invalidLine = line + return + } + validRanges.push({ + type: "ipRange", + params: { + ipFrom: ipFrom, + ipTo: ipTo + } + }) + }) + if (invalidLine.length > 0) { + teaweb.warn("'" + invalidLine + "'格式错误", function () { + that.$refs.batchIPRange.focus() + }) + return + } + validRanges.forEach(function (v) { + that.ranges.push(v) + }) + this.cancelBatchIPRange() + }, validateIP: function (ip) { if (!ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)) { return false @@ -1504,14 +1566,14 @@ Vue.component("ns-route-ranges-box", { template: `
-
+
IP范围: {{range.params.ipFrom}} - {{range.params.ipTo}}  
- +
@@ -1527,8 +1589,23 @@ Vue.component("ns-route-ranges-box", {
+ + +
+
+ +

每行一条,格式为开始IP,结束IP,比如192.168.1.100,192.168.1.200

+
+
+   + +
+
- +
+   + +
` }) @@ -10786,7 +10863,7 @@ Vue.component("traffic-limit-config-box", { 网页提示内容 -

[使用模板]。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容。

+

[使用模板]。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容,适用于网站类服务。

diff --git a/web/public/js/components/server/traffic-limit-config-box.js b/web/public/js/components/server/traffic-limit-config-box.js index f9f95f37..e37b3a33 100644 --- a/web/public/js/components/server/traffic-limit-config-box.js +++ b/web/public/js/components/server/traffic-limit-config-box.js @@ -94,7 +94,7 @@ Vue.component("traffic-limit-config-box", { 网页提示内容 -

[使用模板]。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容。

+

[使用模板]。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容,适用于网站类服务。

diff --git a/web/public/js/utils.js b/web/public/js/utils.js index 5a4bf955..312de8c0 100644 --- a/web/public/js/utils.js +++ b/web/public/js/utils.js @@ -94,8 +94,8 @@ window.teaweb = { field: element, firstDay: 1, minDate: new Date(year - 1, 0, 1), - maxDate: new Date(year + 10, 11, 31), - yearRange: [year - 1, year + 10], + maxDate: new Date(year + 20, 11, 31), + yearRange: [year - 1, year + 20], format: "YYYY-MM-DD", i18n: { previousMonth: '上月',