+`}),Vue.component("http-request-limit-config-box",{props:["v-request-limit-config","v-is-group","v-is-location"],data:function(){let e=this.vRequestLimitConfig;return{config:e=null==e?{isPrior:!1,isOn:!1,maxConns:0,maxConnsPerIP:0,maxBodySize:{count:-1,unit:"kb"},outBandwidthPerConn:{count:-1,unit:"kb"}}:e,maxConns:e.maxConns,maxConnsPerIP:e.maxConnsPerIP}},watch:{maxConns:function(e){e=parseInt(e,10);isNaN(e)?this.config.maxConns=0:this.config.maxConns=e<0?0:e},maxConnsPerIP:function(e){e=parseInt(e,10);isNaN(e)?this.config.maxConnsPerIP=0:this.config.maxConnsPerIP=e<0?0:e}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.config.isPrior)&&this.config.isOn}},template:`
`
-})
-
-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: `
`}),Vue.component("http-header-replace-values",{props:["v-replace-values"],data:function(){let e=this.vReplaceValues;return{values:e=null==e?[]:e,isAdding:!1,addingValue:{pattern:"",replacement:"",isCaseInsensitive:!1,isRegexp:!1}}},methods:{add:function(){this.isAdding=!0;let e=this;setTimeout(function(){e.$refs.pattern.focus()})},remove:function(e){this.values.$remove(e)},confirm:function(){let e=this;0==this.addingValue.pattern.length?teaweb.warn("替换前内容不能为空",function(){e.$refs.pattern.focus()}):(this.values.push(this.addingValue),this.cancel())},cancel:function(){this.isAdding=!1,this.addingValue={pattern:"",replacement:"",isCaseInsensitive:!1,isRegexp:!1}}},template:`
@@ -3231,61 +1107,7 @@ Vue.component("http-header-replace-values", {
+
-
`
-})
-
-// 浏览条件列表
-Vue.component("http-request-conds-view", {
- props: ["v-conds"],
- data: function () {
- let conds = this.vConds
- if (conds == null) {
- conds = {
- isOn: true,
- connector: "or",
- groups: []
- }
- }
-
- let that = this
- conds.groups.forEach(function (group) {
- group.conds.forEach(function (cond) {
- cond.typeName = that.typeName(cond)
- })
- })
-
- return {
- initConds: conds,
- version: 0 // 为了让组件能及时更新加入此变量
- }
- },
- computed: {
- // 之所以使用computed,是因为需要动态更新
- conds: function () {
- return this.initConds
- }
- },
- methods: {
- typeName: function (cond) {
- let c = window.REQUEST_COND_COMPONENTS.$find(function (k, v) {
- return v.type == cond.type
- })
- if (c != null) {
- return c.name;
- }
- return cond.param + " " + cond.operator
- },
- notifyChange: function () {
- this.version++
- let that = this
- this.initConds.groups.forEach(function (group) {
- group.conds.forEach(function (cond) {
- cond.typeName = that.typeName(cond)
- })
- })
- }
- },
- template: `
+
`}),Vue.component("http-request-conds-view",{props:["v-conds"],data:function(){let e=this.vConds,t=(null==e&&(e={isOn:!0,connector:"or",groups:[]}),this);return e.groups.forEach(function(e){e.conds.forEach(function(e){e.typeName=t.typeName(e)})}),{initConds:e,version:0}},computed:{conds:function(){return this.initConds}},methods:{typeName:function(i){var e=window.REQUEST_COND_COMPONENTS.$find(function(e,t){return t.type==i.type});return null!=e?e.name:i.param+" "+i.operator},notifyChange:function(){this.version++;let t=this;this.initConds.groups.forEach(function(e){e.conds.forEach(function(e){e.typeName=t.typeName(e)})})}},template:`
{{version}}
@@ -3306,26 +1128,7 @@ Vue.component("http-request-conds-view", {
-
`
-})
-
-Vue.component("http-firewall-config-box", {
- props: ["v-firewall-config", "v-is-location", "v-is-group", "v-firewall-policy"],
- data: function () {
- let firewall = this.vFirewallConfig
- if (firewall == null) {
- firewall = {
- isPrior: false,
- isOn: false,
- firewallPolicyId: 0
- }
- }
-
- return {
- firewall: firewall
- }
- },
- template: `
+
`}),Vue.component("http-firewall-config-box",{props:["v-firewall-config","v-is-location","v-is-group","v-firewall-policy"],data:function(){let e=this.vFirewallConfig;return{firewall:e=null==e?{isPrior:!1,isOn:!1,firewallPolicyId:0}:e}},template:`
@@ -3352,493 +1155,18 @@ Vue.component("http-firewall-config-box", {
-
`
-})
-
-// 指标图表
-Vue.component("metric-chart", {
- props: ["v-chart", "v-stats", "v-item"],
- mounted: function () {
- this.load()
- },
- data: function () {
- let stats = this.vStats
- if (stats == null) {
- stats = []
- }
- if (stats.length > 0) {
- let sum = stats.$sum(function (k, v) {
- return v.value
- })
- if (sum < stats[0].total) {
- if (this.vChart.type == "pie") {
- stats.push({
- keys: ["其他"],
- value: stats[0].total - sum,
- total: stats[0].total,
- time: stats[0].time
- })
- }
- }
- }
- if (this.vChart.maxItems > 0) {
- stats = stats.slice(0, this.vChart.maxItems)
- } else {
- stats = stats.slice(0, 10)
- }
-
- stats.$rsort(function (v1, v2) {
- return v1.value - v2.value
- })
-
- let widthPercent = 100
- if (this.vChart.widthDiv > 0) {
- widthPercent = 100 / this.vChart.widthDiv
- }
-
- return {
- chart: this.vChart,
- stats: stats,
- item: this.vItem,
- width: widthPercent + "%",
- chartId: "metric-chart-" + this.vChart.id,
- valueTypeName: (this.vItem != null && this.vItem.valueTypeName != null && this.vItem.valueTypeName.length > 0) ? this.vItem.valueTypeName : ""
- }
- },
- methods: {
- load: function () {
- var el = document.getElementById(this.chartId)
- if (el == null || el.offsetWidth == 0 || el.offsetHeight == 0) {
- setTimeout(this.load, 100)
- } else {
- this.render(el)
- }
- },
- render: function (el) {
- let chart = echarts.init(el)
- window.addEventListener("resize", function () {
- chart.resize()
- })
- switch (this.chart.type) {
- case "pie":
- this.renderPie(chart)
- break
- case "bar":
- this.renderBar(chart)
- break
- case "timeBar":
- this.renderTimeBar(chart)
- break
- case "timeLine":
- this.renderTimeLine(chart)
- break
- case "table":
- this.renderTable(chart)
- break
- }
- },
- renderPie: function (chart) {
- let values = this.stats.map(function (v) {
- return {
- name: v.keys[0],
- value: v.value
- }
- })
- let that = this
- chart.setOption({
- tooltip: {
- show: true,
- trigger: "item",
- formatter: function (data) {
- let stat = that.stats[data.dataIndex]
- let percent = 0
- if (stat.total > 0) {
- percent = Math.round((stat.value * 100 / stat.total) * 100) / 100
- }
- let value = stat.value
- switch (that.item.valueType) {
- case "byte":
- value = teaweb.formatBytes(value)
- break
- case "count":
- value = teaweb.formatNumber(value)
- break
- }
- return stat.keys[0] + "
" + that.valueTypeName + ": " + value + "
占比:" + percent + "%"
- }
- },
- series: [
- {
- name: name,
- type: "pie",
- data: values,
- areaStyle: {},
- color: ["#9DD3E8", "#B2DB9E", "#F39494", "#FBD88A", "#879BD7"]
- }
- ]
- })
- },
- renderTimeBar: function (chart) {
- this.stats.$sort(function (v1, v2) {
- return (v1.time < v2.time) ? -1 : 1
- })
- let values = this.stats.map(function (v) {
- return v.value
- })
-
- let axis = {unit: "", divider: 1}
- switch (this.item.valueType) {
- case "count":
- axis = teaweb.countAxis(values, function (v) {
- return v
- })
- break
- case "byte":
- axis = teaweb.bytesAxis(values, function (v) {
- return v
- })
- break
- }
-
- let that = this
- chart.setOption({
- xAxis: {
- data: this.stats.map(function (v) {
- return that.formatTime(v.time)
- })
- },
- yAxis: {
- axisLabel: {
- formatter: function (value) {
- return value + axis.unit
- }
- }
- },
- tooltip: {
- show: true,
- trigger: "item",
- formatter: function (data) {
- let stat = that.stats[data.dataIndex]
- let value = stat.value
- switch (that.item.valueType) {
- case "byte":
- value = teaweb.formatBytes(value)
- break
- }
- return that.formatTime(stat.time) + ": " + value
- }
- },
- grid: {
- left: 50,
- top: 10,
- right: 20,
- bottom: 25
- },
- series: [
- {
- name: name,
- type: "bar",
- data: values.map(function (v) {
- return v / axis.divider
- }),
- itemStyle: {
- color: "#9DD3E8"
- },
- areaStyle: {},
- barWidth: "20em"
- }
- ]
- })
- },
- renderTimeLine: function (chart) {
- this.stats.$sort(function (v1, v2) {
- return (v1.time < v2.time) ? -1 : 1
- })
- let values = this.stats.map(function (v) {
- return v.value
- })
-
- let axis = {unit: "", divider: 1}
- switch (this.item.valueType) {
- case "count":
- axis = teaweb.countAxis(values, function (v) {
- return v
- })
- break
- case "byte":
- axis = teaweb.bytesAxis(values, function (v) {
- return v
- })
- break
- }
-
- let that = this
- chart.setOption({
- xAxis: {
- data: this.stats.map(function (v) {
- return that.formatTime(v.time)
- })
- },
- yAxis: {
- axisLabel: {
- formatter: function (value) {
- return value + axis.unit
- }
- }
- },
- tooltip: {
- show: true,
- trigger: "item",
- formatter: function (data) {
- let stat = that.stats[data.dataIndex]
- let value = stat.value
- switch (that.item.valueType) {
- case "byte":
- value = teaweb.formatBytes(value)
- break
- }
- return that.formatTime(stat.time) + ": " + value
- }
- },
- grid: {
- left: 50,
- top: 10,
- right: 20,
- bottom: 25
- },
- series: [
- {
- name: name,
- type: "line",
- data: values.map(function (v) {
- return v / axis.divider
- }),
- itemStyle: {
- color: "#9DD3E8"
- },
- areaStyle: {}
- }
- ]
- })
- },
- renderBar: function (chart) {
- let values = this.stats.map(function (v) {
- return v.value
- })
- let axis = {unit: "", divider: 1}
- switch (this.item.valueType) {
- case "count":
- axis = teaweb.countAxis(values, function (v) {
- return v
- })
- break
- case "byte":
- axis = teaweb.bytesAxis(values, function (v) {
- return v
- })
- break
- }
- let bottom = 24
- let rotate = 0
- let result = teaweb.xRotation(chart, this.stats.map(function (v) {
- return v.keys[0]
- }))
- if (result != null) {
- bottom = result[0]
- rotate = result[1]
- }
- let that = this
- chart.setOption({
- xAxis: {
- data: this.stats.map(function (v) {
- return v.keys[0]
- }),
- axisLabel: {
- interval: 0,
- rotate: rotate
- }
- },
- tooltip: {
- show: true,
- trigger: "item",
- formatter: function (data) {
- let stat = that.stats[data.dataIndex]
- let percent = 0
- if (stat.total > 0) {
- percent = Math.round((stat.value * 100 / stat.total) * 100) / 100
- }
- let value = stat.value
- switch (that.item.valueType) {
- case "byte":
- value = teaweb.formatBytes(value)
- break
- case "count":
- value = teaweb.formatNumber(value)
- break
- }
- return stat.keys[0] + "
" + that.valueTypeName + ":" + value + "
占比:" + percent + "%"
- }
- },
- yAxis: {
- axisLabel: {
- formatter: function (value) {
- return value + axis.unit
- }
- }
- },
- grid: {
- left: 40,
- top: 10,
- right: 20,
- bottom: bottom
- },
- series: [
- {
- name: name,
- type: "bar",
- data: values.map(function (v) {
- return v / axis.divider
- }),
- itemStyle: {
- color: "#9DD3E8"
- },
- areaStyle: {},
- barWidth: "20em"
- }
- ]
- })
-
- if (this.item.keys != null) {
- // IP相关操作
- if (this.item.keys.$contains("${remoteAddr}")) {
- let that = this
- chart.on("click", function (args) {
- let index = that.item.keys.$indexesOf("${remoteAddr}")[0]
- let value = that.stats[args.dataIndex].keys[index]
- teaweb.popup("/servers/ipbox?ip=" + value, {
- width: "50em",
- height: "30em"
- })
- })
- }
- }
- },
- renderTable: function (chart) {
- let table = `
+`}),Vue.component("metric-chart",{props:["v-chart","v-stats","v-item"],mounted:function(){this.load()},data:function(){let e=this.vStats;var t;0<(e=null==e?[]:e).length&&((t=e.$sum(function(e,t){return t.value})) "+s.valueTypeName+": "+i+" 占比:"+t+"%"}},series:[{name:name,type:"pie",data:t,areaStyle:{},color:["#9DD3E8","#B2DB9E","#F39494","#FBD88A","#879BD7"]}]})},renderTimeBar:function(e){this.stats.$sort(function(e,t){return e.time "+a.valueTypeName+":"+i+" 占比:"+t+"%"}},yAxis:{axisLabel:{formatter:function(e){return e+i.unit}}},grid:{left:40,top:10,right:20,bottom:s},series:[{name:name,type:"bar",data:t.map(function(e){return e/i.divider}),itemStyle:{color:"#9DD3E8"},areaStyle:{},barWidth:"20em"}]}),null!=this.item.keys&&this.item.keys.$contains("${remoteAddr}")){let i=this;e.on("click",function(e){var t=i.item.keys.$indexesOf("${remoteAddr}")[0],e=i.stats[e.dataIndex].keys[t];teaweb.popup("/servers/ipbox?ip="+e,{width:"50em",height:"30em"})})}},renderTable:function(e){let s=`
对象
数值
占比
- `
- let that = this
- this.stats.forEach(function (v) {
- let value = v.value
- switch (that.item.valueType) {
- case "byte":
- value = teaweb.formatBytes(value)
- break
- }
- table += "" + v.keys[0] + " " + value + " "
- let percent = 0
- if (v.total > 0) {
- percent = Math.round((v.value * 100 / v.total) * 100) / 100
- }
- table += "" + percent + "% "
- table += " "
- })
-
- table += `
`
- document.getElementById(this.chartId).innerHTML = table
- },
- formatTime: function (time) {
- if (time == null) {
- return ""
- }
- switch (this.item.periodUnit) {
- case "month":
- return time.substring(0, 4) + "-" + time.substring(4, 6)
- case "week":
- return time.substring(0, 4) + "-" + time.substring(4, 6)
- case "day":
- return time.substring(0, 4) + "-" + time.substring(4, 6) + "-" + time.substring(6, 8)
- case "hour":
- return time.substring(0, 4) + "-" + time.substring(4, 6) + "-" + time.substring(6, 8) + " " + time.substring(8, 10)
- case "minute":
- return time.substring(0, 4) + "-" + time.substring(4, 6) + "-" + time.substring(6, 8) + " " + time.substring(8, 10) + ":" + time.substring(10, 12)
- }
- return time
- }
- },
- template: `
+ `,n=this;this.stats.forEach(function(e){let t=e.value,i=("byte"===n.item.valueType&&(t=teaweb.formatBytes(t)),s+="
"+e.keys[0]+" "+t+" ",0);0'+i)+"% "}),s+="
",document.getElementById(this.chartId).innerHTML=s},formatTime:function(e){if(null==e)return"";switch(this.item.periodUnit){case"month":case"week":return e.substring(0,4)+"-"+e.substring(4,6);case"day":return e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8);case"hour":return e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8)+" "+e.substring(8,10);case"minute":return e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8)+" "+e.substring(8,10)+":"+e.substring(10,12)}return e}},template:`
{{chart.name}} ({{valueTypeName}})
-
`
-})
-
-Vue.component("metric-board", {
- template: `
`
-})
-
-Vue.component("http-cache-config-box", {
- props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy", "v-web-id"],
- data: function () {
- let cacheConfig = this.vCacheConfig
- if (cacheConfig == null) {
- cacheConfig = {
- isPrior: false,
- isOn: false,
- addStatusHeader: true,
- addAgeHeader: false,
- enableCacheControlMaxAge: false,
- cacheRefs: [],
- purgeIsOn: false,
- purgeKey: "",
- disablePolicyRefs: false
- }
- }
- if (cacheConfig.cacheRefs == null) {
- cacheConfig.cacheRefs = []
- }
-
- return {
- cacheConfig: cacheConfig,
- moreOptionsVisible: false,
- enablePolicyRefs: !cacheConfig.disablePolicyRefs
- }
- },
- watch: {
- enablePolicyRefs: function (v) {
- this.cacheConfig.disablePolicyRefs = !v
- }
- },
- methods: {
- isOn: function () {
- return ((!this.vIsLocation && !this.vIsGroup) || this.cacheConfig.isPrior) && this.cacheConfig.isOn
- },
- isPlus: function () {
- return Tea.Vue.teaIsPlus
- },
- generatePurgeKey: function () {
- let r = Math.random().toString() + Math.random().toString()
- let s = r.replace(/0\./g, "")
- .replace(/\./g, "")
- let result = ""
- for (let i = 0; i < s.length; i++) {
- result += String.fromCharCode(parseInt(s.substring(i, i + 1)) + ((Math.random() < 0.5) ? "a" : "A").charCodeAt(0))
- }
- this.cacheConfig.purgeKey = result
- },
- showMoreOptions: function () {
- this.moreOptionsVisible = !this.moreOptionsVisible
- },
- changeStale: function (stale) {
- this.cacheConfig.stale = stale
- }
- },
- template: `
+
`}),Vue.component("metric-board",{template:"
"}),Vue.component("http-cache-config-box",{props:["v-cache-config","v-is-location","v-is-group","v-cache-policy","v-web-id"],data:function(){let e=this.vCacheConfig;return null==(e=null==e?{isPrior:!1,isOn:!1,addStatusHeader:!0,addAgeHeader:!1,enableCacheControlMaxAge:!1,cacheRefs:[],purgeIsOn:!1,purgeKey:"",disablePolicyRefs:!1}:e).cacheRefs&&(e.cacheRefs=[]),{cacheConfig:e,moreOptionsVisible:!1,enablePolicyRefs:!e.disablePolicyRefs}},watch:{enablePolicyRefs:function(e){this.cacheConfig.disablePolicyRefs=!e}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.cacheConfig.isPrior)&&this.cacheConfig.isOn},isPlus:function(){return Tea.Vue.teaIsPlus},generatePurgeKey:function(){let e=Math.random().toString()+Math.random().toString(),t=e.replace(/0\./g,"").replace(/\./g,""),i="";for(let e=0;e
@@ -3925,74 +1253,7 @@ Vue.component("http-cache-config-box", {
-`
-})
-
-// 通用Header长度
-let defaultGeneralHeaders = ["Cache-Control", "Connection", "Date", "Pragma", "Trailer", "Transfer-Encoding", "Upgrade", "Via", "Warning"]
-Vue.component("http-cond-general-header-length", {
- props: ["v-checkpoint"],
- data: function () {
- let headers = null
- let length = null
-
- if (window.parent.UPDATING_RULE != null) {
- let options = window.parent.UPDATING_RULE.checkpointOptions
- if (options.headers != null && Array.$isArray(options.headers)) {
- headers = options.headers
- }
- if (options.length != null) {
- length = options.length
- }
- }
-
-
- if (headers == null) {
- headers = defaultGeneralHeaders
- }
-
- if (length == null) {
- length = 128
- }
-
- let that = this
- setTimeout(function () {
- that.change()
- }, 100)
-
- return {
- headers: headers,
- length: length
- }
- },
- watch: {
- length: function (v) {
- let len = parseInt(v)
- if (isNaN(len)) {
- len = 0
- }
- if (len < 0) {
- len = 0
- }
- this.length = len
- this.change()
- }
- },
- methods: {
- change: function () {
- this.vCheckpoint.options = [
- {
- code: "headers",
- value: this.headers
- },
- {
- code: "length",
- value: this.length
- }
- ]
- }
- },
- template: `
+
`});let defaultGeneralHeaders=["Cache-Control","Connection","Date","Pragma","Trailer","Transfer-Encoding","Upgrade","Via","Warning"];function sortTable(n){let e=document.createElement("script");e.setAttribute("src","/js/sortable.min.js"),e.addEventListener("load",function(){let s=document.querySelector("#sortable-table");null!=s&&Sortable.create(s,{draggable:"tbody",handle:".icon.handle",onStart:function(){},onUpdate:function(e){let t=s.querySelectorAll("tbody"),i=[];t.forEach(function(e){i.push(parseInt(e.getAttribute("v-id")))}),n(i)}})}),document.head.appendChild(e)}function sortLoad(e){let t=document.createElement("script");t.setAttribute("src","/js/sortable.min.js"),t.addEventListener("load",function(){"function"==typeof e&&e()}),document.head.appendChild(t)}function emitClick(e,arguments){let t=["click"];for(let e=0;e
通用Header列表
@@ -4012,93 +1273,7 @@ Vue.component("http-cond-general-header-length", {
-`
-})
-
-// CC
-Vue.component("http-firewall-checkpoint-cc", {
- props: ["v-checkpoint"],
- data: function () {
- let keys = []
- let period = 60
- let threshold = 1000
-
- let options = {}
- if (window.parent.UPDATING_RULE != null) {
- options = window.parent.UPDATING_RULE.checkpointOptions
- }
-
- if (options == null) {
- options = {}
- }
- if (options.keys != null) {
- keys = options.keys
- }
- if (keys.length == 0) {
- keys = ["${remoteAddr}", "${requestPath}"]
- }
- if (options.period != null) {
- period = options.period
- }
- if (options.threshold != null) {
- threshold = options.threshold
- }
-
- let that = this
- setTimeout(function () {
- that.change()
- }, 100)
-
- return {
- keys: keys,
- period: period,
- threshold: threshold,
- options: {},
- value: threshold
- }
- },
- watch: {
- period: function () {
- this.change()
- },
- threshold: function () {
- this.change()
- }
- },
- methods: {
- changeKeys: function (keys) {
- this.keys = keys
- this.change()
- },
- change: function () {
- let period = parseInt(this.period.toString())
- if (isNaN(period) || period <= 0) {
- period = 60
- }
-
- let threshold = parseInt(this.threshold.toString())
- if (isNaN(threshold) || threshold <= 0) {
- threshold = 1000
- }
- this.value = threshold
-
- this.vCheckpoint.options = [
- {
- code: "keys",
- value: this.keys
- },
- {
- code: "period",
- value: period,
- },
- {
- code: "threshold",
- value: threshold
- }
- ]
- }
- },
- template: `
+
`}),Vue.component("http-firewall-checkpoint-cc",{props:["v-checkpoint"],data:function(){let e=[],t=60,i=1e3,s={},n=(null==(s=null!=window.parent.UPDATING_RULE?window.parent.UPDATING_RULE.checkpointOptions:s)&&(s={}),0==(e=null!=s.keys?s.keys:e).length&&(e=["${remoteAddr}","${requestPath}"]),null!=s.period&&(t=s.period),null!=s.threshold&&(i=s.threshold),this);return setTimeout(function(){n.change()},100),{keys:e,period:t,threshold:i,options:{},value:i}},watch:{period:function(){this.change()},threshold:function(){this.change()}},methods:{changeKeys:function(e){this.keys=e,this.change()},change:function(){let e=parseInt(this.period.toString()),t=((isNaN(e)||e<=0)&&(e=60),parseInt(this.threshold.toString()));(isNaN(t)||t<=0)&&(t=1e3),this.value=t,this.vCheckpoint.options=[{code:"keys",value:this.keys},{code:"period",value:e},{code:"threshold",value:t}]}},template:`
@@ -4124,79 +1299,7 @@ Vue.component("http-firewall-checkpoint-cc", {
-
`
-})
-
-// 防盗链
-Vue.component("http-firewall-checkpoint-referer-block", {
- props: ["v-checkpoint"],
- data: function () {
- let allowEmpty = true
- let allowSameDomain = true
- let allowDomains = []
-
- let options = {}
- if (window.parent.UPDATING_RULE != null) {
- options = window.parent.UPDATING_RULE.checkpointOptions
- }
-
- if (options == null) {
- options = {}
- }
- if (typeof (options.allowEmpty) == "boolean") {
- allowEmpty = options.allowEmpty
- }
- if (typeof (options.allowSameDomain) == "boolean") {
- allowSameDomain = options.allowSameDomain
- }
- if (options.allowDomains != null && typeof (options.allowDomains) == "object") {
- allowDomains = options.allowDomains
- }
-
- let that = this
- setTimeout(function () {
- that.change()
- }, 100)
-
- return {
- allowEmpty: allowEmpty,
- allowSameDomain: allowSameDomain,
- allowDomains: allowDomains,
- options: {},
- value: 0
- }
- },
- watch: {
- allowEmpty: function () {
- this.change()
- },
- allowSameDomain: function () {
- this.change()
- }
- },
- methods: {
- changeAllowDomains: function (values) {
- this.allowDomains = values
- this.change()
- },
- change: function () {
- this.vCheckpoint.options = [
- {
- code: "allowEmpty",
- value: this.allowEmpty
- },
- {
- code: "allowSameDomain",
- value: this.allowSameDomain,
- },
- {
- code: "allowDomains",
- value: this.allowDomains
- }
- ]
- }
- },
- template: `
+
`}),Vue.component("http-firewall-checkpoint-referer-block",{props:["v-checkpoint"],data:function(){let e=!0,t=!0,i=[],s={},n=("boolean"==typeof(s=null==(s=null!=window.parent.UPDATING_RULE?window.parent.UPDATING_RULE.checkpointOptions:s)?{}:s).allowEmpty&&(e=s.allowEmpty),"boolean"==typeof s.allowSameDomain&&(t=s.allowSameDomain),null!=s.allowDomains&&"object"==typeof s.allowDomains&&(i=s.allowDomains),this);return setTimeout(function(){n.change()},100),{allowEmpty:e,allowSameDomain:t,allowDomains:i,options:{},value:0}},watch:{allowEmpty:function(){this.change()},allowSameDomain:function(){this.change()}},methods:{changeAllowDomains:function(e){this.allowDomains=e,this.change()},change:function(){this.vCheckpoint.options=[{code:"allowEmpty",value:this.allowEmpty},{code:"allowSameDomain",value:this.allowSameDomain},{code:"allowDomains",value:this.allowDomains}]}},template:`
@@ -4222,175 +1325,7 @@ Vue.component("http-firewall-checkpoint-referer-block", {
-
`
-})
-
-Vue.component("http-cache-refs-config-box", {
- props: ["v-cache-refs", "v-cache-config", "v-cache-policy-id", "v-web-id"],
- mounted: function () {
- let that = this
- sortTable(function (ids) {
- let newRefs = []
- ids.forEach(function (id) {
- that.refs.forEach(function (ref) {
- if (ref.id == id) {
- newRefs.push(ref)
- }
- })
- })
- that.updateRefs(newRefs)
- that.change()
- })
- },
- data: function () {
- let refs = this.vCacheRefs
- if (refs == null) {
- refs = []
- }
-
- let id = 0
- refs.forEach(function (ref) {
- id++
- ref.id = id
- })
- return {
- refs: refs,
- id: id // 用来对条件进行排序
- }
- },
- methods: {
- addRef: function (isReverse) {
- window.UPDATING_CACHE_REF = null
-
- let width = window.innerWidth
- if (width > 1024) {
- width = 1024
- }
- let height = window.innerHeight
- if (height > 500) {
- height = 500
- }
- let that = this
- teaweb.popup("/servers/server/settings/cache/createPopup?isReverse=" + (isReverse ? 1 : 0), {
- width: width + "px",
- height: height + "px",
- callback: function (resp) {
- let newRef = resp.data.cacheRef
- if (newRef.conds == null) {
- return
- }
-
- that.id++
- newRef.id = that.id
-
- if (newRef.isReverse) {
- let newRefs = []
- let isAdded = false
- that.refs.forEach(function (v) {
- if (!v.isReverse && !isAdded) {
- newRefs.push(newRef)
- isAdded = true
- }
- newRefs.push(v)
- })
- if (!isAdded) {
- newRefs.push(newRef)
- }
-
- that.updateRefs(newRefs)
- } else {
- that.refs.push(newRef)
- }
-
- that.change()
- }
- })
- },
- updateRef: function (index, cacheRef) {
- window.UPDATING_CACHE_REF = cacheRef
-
- let width = window.innerWidth
- if (width > 1024) {
- width = 1024
- }
- let height = window.innerHeight
- if (height > 500) {
- height = 500
- }
- let that = this
- teaweb.popup("/servers/server/settings/cache/createPopup", {
- width: width + "px",
- height: height + "px",
- callback: function (resp) {
- resp.data.cacheRef.id = that.refs[index].id
- Vue.set(that.refs, index, resp.data.cacheRef)
- that.change()
- }
- })
- },
- disableRef: function (ref) {
- ref.isOn = false
- this.change()
- },
- enableRef: function (ref) {
- ref.isOn = true
- this.change()
- },
- removeRef: function (index) {
- let that = this
- teaweb.confirm("确定要删除此缓存设置吗?", function () {
- that.refs.$remove(index)
- that.change()
- })
- },
- updateRefs: function (newRefs) {
- this.refs = newRefs
- if (this.vCacheConfig != null) {
- this.vCacheConfig.cacheRefs = newRefs
- }
- },
- timeUnitName: function (unit) {
- switch (unit) {
- case "ms":
- return "毫秒"
- case "second":
- return "秒"
- case "minute":
- return "分钟"
- case "hour":
- return "小时"
- case "day":
- return "天"
- case "week":
- return "周 "
- }
- return unit
- },
- change: function () {
- // 自动保存
- if (this.vCachePolicyId != null && this.vCachePolicyId > 0) { // 缓存策略
- Tea.action("/servers/components/cache/updateRefs")
- .params({
- cachePolicyId: this.vCachePolicyId,
- refsJSON: JSON.stringify(this.refs)
- })
- .post()
- } else if (this.vWebId != null && this.vWebId > 0) { // Server Web or Group Web
- Tea.action("/servers/server/settings/cache/updateRefs")
- .params({
- webId: this.vWebId,
- refsJSON: JSON.stringify(this.refs)
- })
- .success(function (resp) {
- if (resp.data.isUpdated) {
- teaweb.successToast("保存成功")
- }
- })
- .post()
- }
- }
- },
- template: `
+
`}),Vue.component("http-cache-refs-config-box",{props:["v-cache-refs","v-cache-config","v-cache-policy-id","v-web-id"],mounted:function(){let s=this;sortTable(function(e){let i=[];e.forEach(function(t){s.refs.forEach(function(e){e.id==t&&i.push(e)})}),s.updateRefs(i),s.change()})},data:function(){let e=this.vCacheRefs,t=(null==e&&(e=[]),0);return e.forEach(function(e){t++,e.id=t}),{refs:e,id:t}},methods:{addRef:function(e){window.UPDATING_CACHE_REF=null;let t=window.innerWidth,i=(1024
@@ -4441,62 +1376,7 @@ Vue.component("http-cache-refs-config-box", {
+添加缓存设置 +添加不缓存设置
-`
-})
-
-Vue.component("origin-list-box", {
- props: ["v-primary-origins", "v-backup-origins", "v-server-type", "v-params"],
- data: function () {
- return {
- primaryOrigins: this.vPrimaryOrigins,
- backupOrigins: this.vBackupOrigins
- }
- },
- methods: {
- createPrimaryOrigin: function () {
- teaweb.popup("/servers/server/settings/origins/addPopup?originType=primary&" + this.vParams, {
- height: "27em",
- callback: function (resp) {
- teaweb.success("保存成功", function () {
- window.location.reload()
- })
- }
- })
- },
- createBackupOrigin: function () {
- teaweb.popup("/servers/server/settings/origins/addPopup?originType=backup&" + this.vParams, {
- height: "27em",
- callback: function (resp) {
- teaweb.success("保存成功", function () {
- window.location.reload()
- })
- }
- })
- },
- updateOrigin: function (originId, originType) {
- teaweb.popup("/servers/server/settings/origins/updatePopup?originType=" + originType + "&" + this.vParams + "&originId=" + originId, {
- height: "27em",
- callback: function (resp) {
- teaweb.success("保存成功", function () {
- window.location.reload()
- })
- }
- })
- },
- deleteOrigin: function (originId, originType) {
- let that = this
- teaweb.confirm("确定要删除此源站吗?", function () {
- Tea.action("/servers/server/settings/origins/delete?" + that.vParams + "&originId=" + originId + "&originType=" + originType)
- .post()
- .success(function () {
- teaweb.success("删除成功", function () {
- window.location.reload()
- })
- })
- })
- }
- },
- template: `
+
`}),Vue.component("origin-list-box",{props:["v-primary-origins","v-backup-origins","v-server-type","v-params"],data:function(){return{primaryOrigins:this.vPrimaryOrigins,backupOrigins:this.vBackupOrigins}},methods:{createPrimaryOrigin:function(){teaweb.popup("/servers/server/settings/origins/addPopup?originType=primary&"+this.vParams,{height:"27em",callback:function(e){teaweb.success("保存成功",function(){window.location.reload()})}})},createBackupOrigin:function(){teaweb.popup("/servers/server/settings/origins/addPopup?originType=backup&"+this.vParams,{height:"27em",callback:function(e){teaweb.success("保存成功",function(){window.location.reload()})}})},updateOrigin:function(e,t){teaweb.popup("/servers/server/settings/origins/updatePopup?originType="+t+"&"+this.vParams+"&originId="+e,{height:"27em",callback:function(e){teaweb.success("保存成功",function(){window.location.reload()})}})},deleteOrigin:function(e,t){let i=this;teaweb.confirm("确定要删除此源站吗?",function(){Tea.action("/servers/server/settings/origins/delete?"+i.vParams+"&originId="+e+"&originType="+t).post().success(function(){teaweb.success("删除成功",function(){window.location.reload()})})})}},template:`
@@ -4504,23 +1384,7 @@ Vue.component("origin-list-box", {
-
`
-})
-
-Vue.component("origin-list-table", {
- props: ["v-origins", "v-origin-type"],
- data: function () {
- return {}
- },
- methods: {
- deleteOrigin: function (originId) {
- this.$emit("deleteOrigin", originId, this.vOriginType)
- },
- updateOrigin: function (originId) {
- this.$emit("updateOrigin", originId, this.vOriginType)
- }
- },
- template: `
+`}),Vue.component("origin-list-table",{props:["v-origins","v-origin-type"],data:function(){return{}},methods:{deleteOrigin:function(e){this.$emit("deleteOrigin",e,this.vOriginType)},updateOrigin:function(e){this.$emit("updateOrigin",e,this.vOriginType)}},template:`
@@ -4548,49 +1412,7 @@ Vue.component("origin-list-table", {
删除
-
`
-})
-
-Vue.component("http-firewall-policy-selector", {
- props: ["v-http-firewall-policy"],
- mounted: function () {
- let that = this
- Tea.action("/servers/components/waf/count")
- .post()
- .success(function (resp) {
- that.count = resp.data.count
- })
- },
- data: function () {
- let firewallPolicy = this.vHttpFirewallPolicy
- return {
- count: 0,
- firewallPolicy: firewallPolicy
- }
- },
- methods: {
- remove: function () {
- this.firewallPolicy = null
- },
- select: function () {
- let that = this
- teaweb.popup("/servers/components/waf/selectPopup", {
- callback: function (resp) {
- that.firewallPolicy = resp.data.firewallPolicy
- }
- })
- },
- create: function () {
- let that = this
- teaweb.popup("/servers/components/waf/createPopup", {
- height: "26em",
- callback: function (resp) {
- that.firewallPolicy = resp.data.firewallPolicy
- }
- })
- }
- },
- template: `
+
`}),Vue.component("http-firewall-policy-selector",{props:["v-http-firewall-policy"],mounted:function(){let t=this;Tea.action("/servers/components/waf/count").post().success(function(e){t.count=e.data.count})},data:function(){return{count:0,firewallPolicy:this.vHttpFirewallPolicy}},methods:{remove:function(){this.firewallPolicy=null},select:function(){let t=this;teaweb.popup("/servers/components/waf/selectPopup",{callback:function(e){t.firewallPolicy=e.data.firewallPolicy}})},create:function(){let t=this;teaweb.popup("/servers/components/waf/createPopup",{height:"26em",callback:function(e){t.firewallPolicy=e.data.firewallPolicy}})}},template:`
{{firewallPolicy.name}}
@@ -4598,85 +1420,7 @@ Vue.component("http-firewall-policy-selector", {
-
`
-})
-
-Vue.component("http-websocket-box", {
- props: ["v-websocket-ref", "v-websocket-config", "v-is-location", "v-is-group"],
- data: function () {
- let websocketRef = this.vWebsocketRef
- if (websocketRef == null) {
- websocketRef = {
- isPrior: false,
- isOn: false,
- websocketId: 0
- }
- }
-
- let websocketConfig = this.vWebsocketConfig
- if (websocketConfig == null) {
- websocketConfig = {
- id: 0,
- isOn: false,
- handshakeTimeout: {
- count: 30,
- unit: "second"
- },
- allowAllOrigins: true,
- allowedOrigins: [],
- requestSameOrigin: true,
- requestOrigin: ""
- }
- } else {
- if (websocketConfig.handshakeTimeout == null) {
- websocketConfig.handshakeTimeout = {
- count: 30,
- unit: "second",
- }
- }
- if (websocketConfig.allowedOrigins == null) {
- websocketConfig.allowedOrigins = []
- }
- }
-
- return {
- websocketRef: websocketRef,
- websocketConfig: websocketConfig,
- handshakeTimeoutCountString: websocketConfig.handshakeTimeout.count.toString(),
- advancedVisible: false
- }
- },
- watch: {
- handshakeTimeoutCountString: function (v) {
- let count = parseInt(v)
- if (!isNaN(count) && count >= 0) {
- this.websocketConfig.handshakeTimeout.count = count
- } else {
- this.websocketConfig.handshakeTimeout.count = 0
- }
- }
- },
- methods: {
- isOn: function () {
- return ((!this.vIsLocation && !this.vIsGroup) || this.websocketRef.isPrior) && this.websocketRef.isOn
- },
- changeAdvancedVisible: function (v) {
- this.advancedVisible = v
- },
- createOrigin: function () {
- let that = this
- teaweb.popup("/servers/server/settings/websocket/createOrigin", {
- height: "12.5em",
- callback: function (resp) {
- that.websocketConfig.allowedOrigins.push(resp.data.origin)
- }
- })
- },
- removeOrigin: function (index) {
- this.websocketConfig.allowedOrigins.$remove(index)
- }
- },
- template: `
+
`}),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:`
@@ -4760,64 +1504,7 @@ Vue.component("http-websocket-box", {
-
`
-})
-
-Vue.component("http-rewrite-rule-list", {
- props: ["v-web-id", "v-rewrite-rules"],
- mounted: function () {
- setTimeout(this.sort, 1000)
- },
- data: function () {
- let rewriteRules = this.vRewriteRules
- if (rewriteRules == null) {
- rewriteRules = []
- }
- return {
- rewriteRules: rewriteRules
- }
- },
- methods: {
- updateRewriteRule: function (rewriteRuleId) {
- teaweb.popup("/servers/server/settings/rewrite/updatePopup?webId=" + this.vWebId + "&rewriteRuleId=" + rewriteRuleId, {
- height: "26em",
- callback: function () {
- window.location.reload()
- }
- })
- },
- deleteRewriteRule: function (rewriteRuleId) {
- let that = this
- teaweb.confirm("确定要删除此重写规则吗?", function () {
- Tea.action("/servers/server/settings/rewrite/delete")
- .params({
- webId: that.vWebId,
- rewriteRuleId: rewriteRuleId
- })
- .post()
- .refresh()
- })
- },
- // 排序
- sort: function () {
- if (this.rewriteRules.length == 0) {
- return
- }
- let that = this
- sortTable(function (rowIds) {
- Tea.action("/servers/server/settings/rewrite/sort")
- .post()
- .params({
- webId: that.vWebId,
- rewriteRuleIds: rowIds
- })
- .success(function () {
- teaweb.success("保存成功")
- })
- })
- }
- },
- template: `
+
`}),Vue.component("http-rewrite-rule-list",{props:["v-web-id","v-rewrite-rules"],mounted:function(){setTimeout(this.sort,1e3)},data:function(){let e=this.vRewriteRules;return{rewriteRules:e=null==e?[]:e}},methods:{updateRewriteRule:function(e){teaweb.popup("/servers/server/settings/rewrite/updatePopup?webId="+this.vWebId+"&rewriteRuleId="+e,{height:"26em",callback:function(){window.location.reload()}})},deleteRewriteRule:function(e){let t=this;teaweb.confirm("确定要删除此重写规则吗?",function(){Tea.action("/servers/server/settings/rewrite/delete").params({webId:t.vWebId,rewriteRuleId:e}).post().refresh()})},sort:function(){if(0!=this.rewriteRules.length){let t=this;sortTable(function(e){Tea.action("/servers/server/settings/rewrite/sort").post().params({webId:t.vWebId,rewriteRuleIds:e}).success(function(){teaweb.success("保存成功")})})}}},template:`
@@ -4857,89 +1544,7 @@ Vue.component("http-rewrite-rule-list", {
-
`
-})
-
-Vue.component("http-rewrite-labels-label", {
- props: ["v-class"],
- template: `
`
-})
-
-Vue.component("server-name-box", {
- props: ["v-server-names"],
- data: function () {
- let serverNames = this.vServerNames;
- if (serverNames == null) {
- serverNames = []
- }
- return {
- serverNames: serverNames,
- isSearching: false,
- keyword: ""
- }
- },
- methods: {
- addServerName: function () {
- window.UPDATING_SERVER_NAME = null
- let that = this
- teaweb.popup("/servers/addServerNamePopup", {
- callback: function (resp) {
- var serverName = resp.data.serverName
- that.serverNames.push(serverName)
- }
- });
- },
-
- removeServerName: function (index) {
- this.serverNames.$remove(index)
- },
-
- updateServerName: function (index, serverName) {
- window.UPDATING_SERVER_NAME = serverName
- let that = this
- teaweb.popup("/servers/addServerNamePopup", {
- callback: function (resp) {
- var serverName = resp.data.serverName
- Vue.set(that.serverNames, index, serverName)
- }
- });
- },
- showSearchBox: function () {
- this.isSearching = !this.isSearching
- if (this.isSearching) {
- let that = this
- setTimeout(function () {
- that.$refs.keywordRef.focus()
- }, 200)
- } else {
- this.keyword = ""
- }
- },
- },
- watch: {
- keyword: function (v) {
- this.serverNames.forEach(function (serverName) {
- if (v.length == 0) {
- serverName.isShowing = true
- return
- }
- if (serverName.subNames == null || serverName.subNames.length == 0) {
- if (!teaweb.match(serverName.name, v)) {
- serverName.isShowing = false
- }
- } else {
- let found = false
- serverName.subNames.forEach(function (subName) {
- if (teaweb.match(subName, v)) {
- found = true
- }
- })
- serverName.isShowing = found
- }
- })
- }
- },
- template: `
+
`}),Vue.component("http-rewrite-labels-label",{props:["v-class"],template:'
'}),Vue.component("server-name-box",{props:["v-server-names"],data:function(){let e=this.vServerNames;return{serverNames:e=null==e?[]:e,isSearching:!1,keyword:""}},methods:{addServerName:function(){window.UPDATING_SERVER_NAME=null;let t=this;teaweb.popup("/servers/addServerNamePopup",{callback:function(e){e=e.data.serverName;t.serverNames.push(e)}})},removeServerName:function(e){this.serverNames.$remove(e)},updateServerName:function(t,e){window.UPDATING_SERVER_NAME=e;let i=this;teaweb.popup("/servers/addServerNamePopup",{callback:function(e){e=e.data.serverName;Vue.set(i.serverNames,t,e)}})},showSearchBox:function(){if(this.isSearching=!this.isSearching,this.isSearching){let e=this;setTimeout(function(){e.$refs.keywordRef.focus()},200)}else this.keyword=""}},watch:{keyword:function(i){this.serverNames.forEach(function(e){if(0==i.length)e.isShowing=!0;else if(null==e.subNames||0==e.subNames.length)teaweb.match(e.name,i)||(e.isShowing=!1);else{let t=!1;e.subNames.forEach(function(e){teaweb.match(e,i)&&(t=!0)}),e.isShowing=t}})}},template:`
`
-})
-
-Vue.component("http-cache-stale-config", {
- props: ["v-cache-stale-config"],
- data: function () {
- let config = this.vCacheStaleConfig
- if (config == null) {
- config = {
- isPrior: false,
- isOn: false,
- status: [],
- supportStaleIfErrorHeader: true,
- life: {
- count: 1,
- unit: "day"
- }
- }
- }
- return {
- config: config
- }
- },
- watch: {
- config: {
- deep: true,
- handler: function () {
- this.$emit("change", this.config)
- }
- }
- },
- methods: {},
- template: `
+`}),Vue.component("http-cache-stale-config",{props:["v-cache-stale-config"],data:function(){let e=this.vCacheStaleConfig;return{config:e=null==e?{isPrior:!1,isOn:!1,status:[],supportStaleIfErrorHeader:!0,life:{count:1,unit:"day"}}:e}},watch:{config:{deep:!0,handler:function(){this.$emit("change",this.config)}}},methods:{},template:`
启用过时缓存
@@ -5023,70 +1596,7 @@ Vue.component("http-cache-stale-config", {
-
`
-})
-
-// 域名列表
-Vue.component("domains-box", {
- props: ["v-domains"],
- data: function () {
- let domains = this.vDomains
- if (domains == null) {
- domains = []
- }
- return {
- domains: domains,
- isAdding: false,
- addingDomain: ""
- }
- },
- methods: {
- add: function () {
- this.isAdding = true
- let that = this
- setTimeout(function () {
- that.$refs.addingDomain.focus()
- }, 100)
- },
- confirm: function () {
- let that = this
-
- // 删除其中的空格
- this.addingDomain = this.addingDomain.replace(/\s/g, "")
-
- if (this.addingDomain.length == 0) {
- teaweb.warn("请输入要添加的域名", function () {
- that.$refs.addingDomain.focus()
- })
- return
- }
-
-
- // 基本校验
- if (this.addingDomain[0] == "~") {
- let expr = this.addingDomain.substring(1)
- try {
- new RegExp(expr)
- } catch (e) {
- teaweb.warn("正则表达式错误:" + e.message, function () {
- that.$refs.addingDomain.focus()
- })
- return
- }
- }
-
- this.domains.push(this.addingDomain)
- this.cancel()
- },
- remove: function (index) {
- this.domains.$remove(index)
- },
- cancel: function () {
- this.isAdding = false
- this.addingDomain = ""
- }
- },
- template: `
+
`}),Vue.component("domains-box",{props:["v-domains"],data:function(){let e=this.vDomains;return{domains:e=null==e?[]:e,isAdding:!1,addingDomain:""}},methods:{add:function(){this.isAdding=!0;let e=this;setTimeout(function(){e.$refs.addingDomain.focus()},100)},confirm:function(){let t=this;if(this.addingDomain=this.addingDomain.replace(/\s/g,""),0==this.addingDomain.length)teaweb.warn("请输入要添加的域名",function(){t.$refs.addingDomain.focus()});else{if("~"==this.addingDomain[0]){var e=this.addingDomain.substring(1);try{new RegExp(e)}catch(e){return void teaweb.warn("正则表达式错误:"+e.message,function(){t.$refs.addingDomain.focus()})}}this.domains.push(this.addingDomain),this.cancel()}},remove:function(e){this.domains.$remove(e)},cancel:function(){this.isAdding=!1,this.addingDomain=""}},template:`
@@ -5114,71 +1624,7 @@ Vue.component("domains-box", {
+
- `
-})
-
-Vue.component("http-redirect-to-https-box", {
- props: ["v-redirect-to-https-config", "v-is-location"],
- data: function () {
- let redirectToHttpsConfig = this.vRedirectToHttpsConfig
- if (redirectToHttpsConfig == null) {
- redirectToHttpsConfig = {
- isPrior: false,
- isOn: false,
- host: "",
- port: 0,
- status: 0,
- onlyDomains: [],
- exceptDomains: []
- }
- } else {
- if (redirectToHttpsConfig.onlyDomains == null) {
- redirectToHttpsConfig.onlyDomains = []
- }
- if (redirectToHttpsConfig.exceptDomains == null) {
- redirectToHttpsConfig.exceptDomains = []
- }
- }
- return {
- redirectToHttpsConfig: redirectToHttpsConfig,
- portString: (redirectToHttpsConfig.port > 0) ? redirectToHttpsConfig.port.toString() : "",
- moreOptionsVisible: false,
- statusOptions: [
- {"code": 301, "text": "Moved Permanently"},
- {"code": 308, "text": "Permanent Redirect"},
- {"code": 302, "text": "Found"},
- {"code": 303, "text": "See Other"},
- {"code": 307, "text": "Temporary Redirect"}
- ]
- }
- },
- watch: {
- "redirectToHttpsConfig.status": function () {
- this.redirectToHttpsConfig.status = parseInt(this.redirectToHttpsConfig.status)
- },
- portString: function (v) {
- let port = parseInt(v)
- if (!isNaN(port)) {
- this.redirectToHttpsConfig.port = port
- } else {
- this.redirectToHttpsConfig.port = 0
- }
- }
- },
- methods: {
- changeMoreOptions: function (isVisible) {
- this.moreOptionsVisible = isVisible
- },
- changeOnlyDomains: function (values) {
- this.redirectToHttpsConfig.onlyDomains = values
- this.$forceUpdate()
- },
- changeExceptDomains: function (values) {
- this.redirectToHttpsConfig.exceptDomains = values
- this.$forceUpdate()
- }
- },
- template: `
+
`}),Vue.component("http-redirect-to-https-box",{props:["v-redirect-to-https-config","v-is-location"],data:function(){let e=this.vRedirectToHttpsConfig;return null==e?e={isPrior:!1,isOn:!1,host:"",port:0,status:0,onlyDomains:[],exceptDomains:[]}:(null==e.onlyDomains&&(e.onlyDomains=[]),null==e.exceptDomains&&(e.exceptDomains=[])),{redirectToHttpsConfig:e,portString:0
@@ -5275,537 +1721,14 @@ Vue.component("http-redirect-to-https-box", {
-
`
-})
-
-// 动作选择
-Vue.component("http-firewall-actions-box", {
- props: ["v-actions", "v-firewall-policy", "v-action-configs"],
- mounted: function () {
- let that = this
- Tea.action("/servers/iplists/levelOptions")
- .success(function (resp) {
- that.ipListLevels = resp.data.levels
- })
- .post()
-
- this.loadJS(function () {
- let box = document.getElementById("actions-box")
- Sortable.create(box, {
- draggable: ".label",
- handle: ".icon.handle",
- onStart: function () {
- that.cancel()
- },
- onUpdate: function (event) {
- let labels = box.getElementsByClassName("label")
- let newConfigs = []
- for (let i = 0; i < labels.length; i++) {
- let index = parseInt(labels[i].getAttribute("data-index"))
- newConfigs.push(that.configs[index])
- }
- that.configs = newConfigs
- }
- })
- })
- },
- data: function () {
- if (this.vFirewallPolicy.inbound == null) {
- this.vFirewallPolicy.inbound = {}
- }
- if (this.vFirewallPolicy.inbound.groups == null) {
- this.vFirewallPolicy.inbound.groups = []
- }
-
- let id = 0
- let configs = []
- if (this.vActionConfigs != null) {
- configs = this.vActionConfigs
- configs.forEach(function (v) {
- v.id = (id++)
- })
- }
-
- var defaultPageBody = `
+ `}),Vue.component("http-firewall-actions-box",{props:["v-actions","v-firewall-policy","v-action-configs"],mounted:function(){let o=this;Tea.action("/servers/iplists/levelOptions").success(function(e){o.ipListLevels=e.data.levels}).post(),this.loadJS(function(){let n=document.getElementById("actions-box");Sortable.create(n,{draggable:".label",handle:".icon.handle",onStart:function(){o.cancel()},onUpdate:function(e){let t=n.getElementsByClassName("label"),i=[];for(let e=0;e