更新components.js

This commit is contained in:
GoEdgeLab
2022-10-25 14:36:40 +08:00
parent 68aad3284c
commit 429a101ca5
2 changed files with 108 additions and 10 deletions

View File

@@ -1467,7 +1467,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<!-- refererBlock --> <!-- refererBlock -->
<span v-if="rule.param == '\${refererBlock}'"> <span v-if="rule.param == '\${refererBlock}'">
{{rule.checkpointOptions.allowDomains}} <span v-if="rule.checkpointOptions.allowDomains != null && rule.checkpointOptions.allowDomains.length > 0">允许{{rule.checkpointOptions.allowDomains}}</span>
<span v-if="rule.checkpointOptions.denyDomains != null && rule.checkpointOptions.denyDomains.length > 0">禁止{{rule.checkpointOptions.denyDomains}}</span>
</span> </span>
<span v-else> <span v-else>
@@ -2029,7 +2030,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
</td> </td>
</tr> </tr>
</table> </table>
</div>`}),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:`<div> </div>`}),Vue.component("http-firewall-checkpoint-referer-block",{props:["v-checkpoint"],data:function(){let e=!0,t=!0,i=[],s=[],n={},o=("boolean"==typeof(n=null==(n=null!=window.parent.UPDATING_RULE?window.parent.UPDATING_RULE.checkpointOptions:n)?{}:n).allowEmpty&&(e=n.allowEmpty),"boolean"==typeof n.allowSameDomain&&(t=n.allowSameDomain),null!=n.allowDomains&&"object"==typeof n.allowDomains&&(i=n.allowDomains),null!=n.denyDomains&&"object"==typeof n.denyDomains&&(s=n.denyDomains),this);return setTimeout(function(){o.change()},100),{allowEmpty:e,allowSameDomain:t,allowDomains:i,denyDomains:s,options:{},value:0}},watch:{allowEmpty:function(){this.change()},allowSameDomain:function(){this.change()}},methods:{changeAllowDomains:function(e){this.allowDomains=e,this.change()},changeDenyDomains:function(e){this.denyDomains=e,this.change()},change:function(){this.vCheckpoint.options=[{code:"allowEmpty",value:this.allowEmpty},{code:"allowSameDomain",value:this.allowSameDomain},{code:"allowDomains",value:this.allowDomains},{code:"denyDomains",value:this.denyDomains}]}},template:`<div>
<input type="hidden" name="operator" value="eq"/> <input type="hidden" name="operator" value="eq"/>
<input type="hidden" name="value" :value="value"/> <input type="hidden" name="value" :value="value"/>
<table class="ui table"> <table class="ui table">
@@ -2054,6 +2055,13 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p> <p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
</td> </td>
</tr> </tr>
<tr>
<td>禁止的来源域名</td>
<td>
<values-box :values="denyDomains" @change="changeDenyDomains"></values-box>
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
</td>
</tr>
</table> </table>
</div>`}),Vue.component("http-access-log-partitions-box",{props:["v-partition","v-day","v-query"],mounted:function(){let t=this;Tea.action("/servers/logs/partitionData").params({day:this.vDay}).success(function(e){t.partitions=[],e.data.partitions.reverse().forEach(function(e){t.partitions.push({code:e,isDisabled:!1,hasLogs:!1})}),0<t.partitions.length&&((null==t.vPartition||t.vPartition<0)&&(t.selectedPartition=t.partitions[0].code),1<t.partitions.length&&t.checkLogs())}).post()},data:function(){return{partitions:[],selectedPartition:this.vPartition,checkingPartition:0}},methods:{url:function(e){let t=window.location.toString();return 0<(t=(t=(t=(t=t.replace(/\?partition=-?\d+/,"?")).replace(/\?requestId=-?\d+/,"?")).replace(/&partition=-?\d+/,"")).replace(/&requestId=-?\d+/,"")).indexOf("?")?t+="&partition="+e:t+="?partition="+e,t},disable:function(t){this.partitions.forEach(function(e){e.code==t&&(e.isDisabled=!0)})},checkLogs:function(){let t=this,i=this.checkingPartition,s={partition:i},e=this.vQuery;null!=e&&0!=e.length&&(e.split("&").forEach(function(e){e=e.split("=");s[e[0]]=decodeURIComponent(e[1])}),Tea.action("/servers/logs/hasLogs").params(s).post().success(function(e){e.data.hasLogs&&(t.partitions[t.partitions.length-1-i].hasLogs=!0),++i>=t.partitions.length||(t.checkingPartition=i,t.checkLogs())}))}},template:`<div v-if="partitions.length > 1"> </div>`}),Vue.component("http-access-log-partitions-box",{props:["v-partition","v-day","v-query"],mounted:function(){let t=this;Tea.action("/servers/logs/partitionData").params({day:this.vDay}).success(function(e){t.partitions=[],e.data.partitions.reverse().forEach(function(e){t.partitions.push({code:e,isDisabled:!1,hasLogs:!1})}),0<t.partitions.length&&((null==t.vPartition||t.vPartition<0)&&(t.selectedPartition=t.partitions[0].code),1<t.partitions.length&&t.checkLogs())}).post()},data:function(){return{partitions:[],selectedPartition:this.vPartition,checkingPartition:0}},methods:{url:function(e){let t=window.location.toString();return 0<(t=(t=(t=(t=t.replace(/\?partition=-?\d+/,"?")).replace(/\?requestId=-?\d+/,"?")).replace(/&partition=-?\d+/,"")).replace(/&requestId=-?\d+/,"")).indexOf("?")?t+="&partition="+e:t+="?partition="+e,t},disable:function(t){this.partitions.forEach(function(e){e.code==t&&(e.isDisabled=!0)})},checkLogs:function(){let t=this,i=this.checkingPartition,s={partition:i},e=this.vQuery;null!=e&&0!=e.length&&(e.split("&").forEach(function(e){e=e.split("=");s[e[0]]=decodeURIComponent(e[1])}),Tea.action("/servers/logs/hasLogs").params(s).post().success(function(e){e.data.hasLogs&&(t.partitions[t.partitions.length-1-i].hasLogs=!0),++i>=t.partitions.length||(t.checkingPartition=i,t.checkLogs())}))}},template:`<div v-if="partitions.length > 1">
<div class="ui divider" style="margin-bottom: 0"></div> <div class="ui divider" style="margin-bottom: 0"></div>
@@ -2376,7 +2384,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<div style="margin-top: 0.5em" v-if="!isAdding"> <div style="margin-top: 0.5em" v-if="!isAdding">
<button class="ui button tiny" type="button" @click.prevent="add">+</button> <button class="ui button tiny" type="button" @click.prevent="add">+</button>
</div> </div>
</div>`}),Vue.component("http-referers-config-box",{props:["v-referers-config","v-is-location","v-is-group"],data:function(){let e=this.vReferersConfig;return null==(e=null==e?{isPrior:!1,isOn:!1,allowEmpty:!0,allowSameDomain:!0,allowDomains:[]}:e).allowDomains&&(e.allowDomains=[]),{config:e}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.config.isPrior)&&this.config.isOn},changeAllowDomains:function(e){}},template:`<div> </div>`}),Vue.component("http-referers-config-box",{props:["v-referers-config","v-is-location","v-is-group"],data:function(){let e=this.vReferersConfig;return null==(e=null==e?{isPrior:!1,isOn:!1,allowEmpty:!0,allowSameDomain:!0,allowDomains:[],denyDomains:[]}:e).allowDomains&&(e.allowDomains=[]),null==e.denyDomains&&(e.denyDomains=[]),{config:e}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.config.isPrior)&&this.config.isOn},changeAllowDomains:function(e){},changeDenyDomains:function(e){}},template:`<div>
<input type="hidden" name="referersJSON" :value="JSON.stringify(config)"/> <input type="hidden" name="referersJSON" :value="JSON.stringify(config)"/>
<table class="ui table selectable definition"> <table class="ui table selectable definition">
<prior-checkbox :v-config="config" v-if="vIsLocation || vIsGroup"></prior-checkbox> <prior-checkbox :v-config="config" v-if="vIsLocation || vIsGroup"></prior-checkbox>
@@ -2414,6 +2422,13 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<p class="comment">允许的其他来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p> <p class="comment">允许的其他来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
</td> </td>
</tr> </tr>
<tr>
<td>禁止的来源域名</td>
<td>
<values-box :values="config.denyDomains" @change="changeDenyDomains"></values-box>
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<div class="ui margin"></div> <div class="ui margin"></div>
@@ -4087,7 +4102,10 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
{{cond.value}} {{cond.value}}
<sup v-if="cond.isCaseInsensitive" title="不区分大小写"><i class="icon info small"></i></sup> <sup v-if="cond.isCaseInsensitive" title="不区分大小写"><i class="icon info small"></i></sup>
</span> </span>
</div>`}),Vue.component("http-firewall-rules-box",{props:["v-rules","v-type"],data:function(){let e=this.vRules;return{rules:e=null==e?[]:e}},methods:{addRule:function(){window.UPDATING_RULE=null;let t=this;teaweb.popup("/servers/components/waf/createRulePopup?type="+this.vType,{callback:function(e){t.rules.push(e.data.rule)}})},updateRule:function(t,e){window.UPDATING_RULE=e;let i=this;teaweb.popup("/servers/components/waf/createRulePopup?type="+this.vType,{callback:function(e){Vue.set(i.rules,t,e.data.rule)}})},removeRule:function(e){let t=this;teaweb.confirm("确定要删除此规则吗?",function(){t.rules.$remove(e)})}},template:`<div> </div>`}),Vue.component("http-header-assistant",{props:["v-type","v-value"],mounted:function(){let t=this;Tea.action("/servers/headers/options?type="+this.vType).post().success(function(e){t.allHeaders=e.data.headers})},data:function(){return{allHeaders:[],matchedHeaders:[],selectedHeaderName:""}},watch:{vValue:function(t){t!=this.selectedHeaderName&&(this.selectedHeaderName=""),0==t.length?this.matchedHeaders=[]:this.matchedHeaders=this.allHeaders.filter(function(e){return teaweb.match(e,t)}).slice(0,5)}},methods:{select:function(e){this.$emit("select",e),this.selectedHeaderName=e}},template:`<span v-if="selectedHeaderName.length == 0">
<a href="" v-for="header in matchedHeaders" class="ui label basic tiny blue" style="font-weight: normal" @click.prevent="select(header)">{{header}}</a>
<span v-if="matchedHeaders.length > 0">&nbsp; &nbsp;</span>
</span>`}),Vue.component("http-firewall-rules-box",{props:["v-rules","v-type"],data:function(){let e=this.vRules;return{rules:e=null==e?[]:e}},methods:{addRule:function(){window.UPDATING_RULE=null;let t=this;teaweb.popup("/servers/components/waf/createRulePopup?type="+this.vType,{callback:function(e){t.rules.push(e.data.rule)}})},updateRule:function(t,e){window.UPDATING_RULE=e;let i=this;teaweb.popup("/servers/components/waf/createRulePopup?type="+this.vType,{callback:function(e){Vue.set(i.rules,t,e.data.rule)}})},removeRule:function(e){let t=this;teaweb.confirm("确定要删除此规则吗?",function(){t.rules.$remove(e)})}},template:`<div>
<input type="hidden" name="rulesJSON" :value="JSON.stringify(rules)"/> <input type="hidden" name="rulesJSON" :value="JSON.stringify(rules)"/>
<div v-if="rules.length > 0"> <div v-if="rules.length > 0">
<div v-for="(rule, index) in rules" class="ui label small basic" style="margin-bottom: 0.5em"> <div v-for="(rule, index) in rules" class="ui label small basic" style="margin-bottom: 0.5em">
@@ -4100,7 +4118,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<!-- refererBlock --> <!-- refererBlock -->
<span v-if="rule.param == '\${refererBlock}'"> <span v-if="rule.param == '\${refererBlock}'">
{{rule.checkpointOptions.allowDomains}} <span v-if="rule.checkpointOptions.allowDomains != null && rule.checkpointOptions.allowDomains.length > 0">允许{{rule.checkpointOptions.allowDomains}}</span>
<span v-if="rule.checkpointOptions.denyDomains != null && rule.checkpointOptions.denyDomains.length > 0">禁止{{rule.checkpointOptions.denyDomains}}</span>
</span> </span>
<span v-else> <span v-else>

View File

@@ -4158,7 +4158,6 @@ Vue.component("http-firewall-rule-label", {
}, },
methods: { methods: {
showErr: function (err) { showErr: function (err) {
teaweb.popupTip("规则校验错误,请修正:<span class=\"red\">" + teaweb.encodeHTML(err) + "</span>") teaweb.popupTip("规则校验错误,请修正:<span class=\"red\">" + teaweb.encodeHTML(err) + "</span>")
}, },
@@ -4174,7 +4173,8 @@ Vue.component("http-firewall-rule-label", {
<!-- refererBlock --> <!-- refererBlock -->
<span v-if="rule.param == '\${refererBlock}'"> <span v-if="rule.param == '\${refererBlock}'">
{{rule.checkpointOptions.allowDomains}} <span v-if="rule.checkpointOptions.allowDomains != null && rule.checkpointOptions.allowDomains.length > 0">允许{{rule.checkpointOptions.allowDomains}}</span>
<span v-if="rule.checkpointOptions.denyDomains != null && rule.checkpointOptions.denyDomains.length > 0">禁止{{rule.checkpointOptions.denyDomains}}</span>
</span> </span>
<span v-else> <span v-else>
@@ -5975,6 +5975,7 @@ Vue.component("http-firewall-checkpoint-referer-block", {
let allowEmpty = true let allowEmpty = true
let allowSameDomain = true let allowSameDomain = true
let allowDomains = [] let allowDomains = []
let denyDomains = []
let options = {} let options = {}
if (window.parent.UPDATING_RULE != null) { if (window.parent.UPDATING_RULE != null) {
@@ -5993,6 +5994,9 @@ Vue.component("http-firewall-checkpoint-referer-block", {
if (options.allowDomains != null && typeof (options.allowDomains) == "object") { if (options.allowDomains != null && typeof (options.allowDomains) == "object") {
allowDomains = options.allowDomains allowDomains = options.allowDomains
} }
if (options.denyDomains != null && typeof (options.denyDomains) == "object") {
denyDomains = options.denyDomains
}
let that = this let that = this
setTimeout(function () { setTimeout(function () {
@@ -6003,6 +6007,7 @@ Vue.component("http-firewall-checkpoint-referer-block", {
allowEmpty: allowEmpty, allowEmpty: allowEmpty,
allowSameDomain: allowSameDomain, allowSameDomain: allowSameDomain,
allowDomains: allowDomains, allowDomains: allowDomains,
denyDomains: denyDomains,
options: {}, options: {},
value: 0 value: 0
} }
@@ -6020,6 +6025,10 @@ Vue.component("http-firewall-checkpoint-referer-block", {
this.allowDomains = values this.allowDomains = values
this.change() this.change()
}, },
changeDenyDomains: function (values) {
this.denyDomains = values
this.change()
},
change: function () { change: function () {
this.vCheckpoint.options = [ this.vCheckpoint.options = [
{ {
@@ -6033,7 +6042,11 @@ Vue.component("http-firewall-checkpoint-referer-block", {
{ {
code: "allowDomains", code: "allowDomains",
value: this.allowDomains value: this.allowDomains
} },
{
code: "denyDomains",
value: this.denyDomains
},
] ]
} }
}, },
@@ -6062,6 +6075,13 @@ Vue.component("http-firewall-checkpoint-referer-block", {
<p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p> <p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
</td> </td>
</tr> </tr>
<tr>
<td>禁止的来源域名</td>
<td>
<values-box :values="denyDomains" @change="changeDenyDomains"></values-box>
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
</td>
</tr>
</table> </table>
</div>` </div>`
}) })
@@ -7101,12 +7121,16 @@ Vue.component("http-referers-config-box", {
isOn: false, isOn: false,
allowEmpty: true, allowEmpty: true,
allowSameDomain: true, allowSameDomain: true,
allowDomains: [] allowDomains: [],
denyDomains: []
} }
} }
if (config.allowDomains == null) { if (config.allowDomains == null) {
config.allowDomains = [] config.allowDomains = []
} }
if (config.denyDomains == null) {
config.denyDomains = []
}
return { return {
config: config config: config
} }
@@ -7116,6 +7140,8 @@ Vue.component("http-referers-config-box", {
return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior) && this.config.isOn return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior) && this.config.isOn
}, },
changeAllowDomains: function (domains) { changeAllowDomains: function (domains) {
},
changeDenyDomains: function (domains) {
} }
}, },
template: `<div> template: `<div>
@@ -7156,6 +7182,13 @@ Vue.component("http-referers-config-box", {
<p class="comment">允许的其他来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p> <p class="comment">允许的其他来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
</td> </td>
</tr> </tr>
<tr>
<td>禁止的来源域名</td>
<td>
<values-box :values="config.denyDomains" @change="changeDenyDomains"></values-box>
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<div class="ui margin"></div> <div class="ui margin"></div>
@@ -11580,6 +11613,51 @@ Vue.component("http-request-cond-view", {
</div>` </div>`
}) })
Vue.component("http-header-assistant", {
props: ["v-type", "v-value"],
mounted: function () {
let that = this
Tea.action("/servers/headers/options?type=" + this.vType)
.post()
.success(function (resp) {
that.allHeaders = resp.data.headers
})
},
data: function () {
return {
allHeaders: [],
matchedHeaders: [],
selectedHeaderName: ""
}
},
watch: {
vValue: function (v) {
if (v != this.selectedHeaderName) {
this.selectedHeaderName = ""
}
if (v.length == 0) {
this.matchedHeaders = []
return
}
this.matchedHeaders = this.allHeaders.filter(function (header) {
return teaweb.match(header, v)
}).slice(0, 5)
}
},
methods: {
select: function (header) {
this.$emit("select", header)
this.selectedHeaderName = header
}
},
template: `<span v-if="selectedHeaderName.length == 0">
<a href="" v-for="header in matchedHeaders" class="ui label basic tiny blue" style="font-weight: normal" @click.prevent="select(header)">{{header}}</a>
<span v-if="matchedHeaders.length > 0">&nbsp; &nbsp;</span>
</span>`
})
Vue.component("http-firewall-rules-box", { Vue.component("http-firewall-rules-box", {
props: ["v-rules", "v-type"], props: ["v-rules", "v-type"],
data: function () { data: function () {
@@ -11630,7 +11708,8 @@ Vue.component("http-firewall-rules-box", {
<!-- refererBlock --> <!-- refererBlock -->
<span v-if="rule.param == '\${refererBlock}'"> <span v-if="rule.param == '\${refererBlock}'">
{{rule.checkpointOptions.allowDomains}} <span v-if="rule.checkpointOptions.allowDomains != null && rule.checkpointOptions.allowDomains.length > 0">允许{{rule.checkpointOptions.allowDomains}}</span>
<span v-if="rule.checkpointOptions.denyDomains != null && rule.checkpointOptions.denyDomains.length > 0">禁止{{rule.checkpointOptions.denyDomains}}</span>
</span> </span>
<span v-else> <span v-else>