2021-07-19 10:48:53 +08:00
|
|
|
|
// 显示WAF规则的标签
|
|
|
|
|
|
Vue.component("http-firewall-rule-label", {
|
|
|
|
|
|
props: ["v-rule"],
|
|
|
|
|
|
data: function () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
rule: this.vRule
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-09-27 10:11:37 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
showErr: function (err) {
|
|
|
|
|
|
teaweb.popupTip("规则校验错误,请修正:<span class=\"red\">" + teaweb.encodeHTML(err) + "</span>")
|
|
|
|
|
|
},
|
2023-01-06 19:12:53 +08:00
|
|
|
|
operatorName: function (operatorCode) {
|
2023-12-07 20:24:26 +08:00
|
|
|
|
let operatorName = operatorCode
|
2023-01-06 19:12:53 +08:00
|
|
|
|
if (typeof (window.WAF_RULE_OPERATORS) != null) {
|
|
|
|
|
|
window.WAF_RULE_OPERATORS.forEach(function (v) {
|
|
|
|
|
|
if (v.code == operatorCode) {
|
|
|
|
|
|
operatorName = v.name
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-09-27 10:11:37 +08:00
|
|
|
|
|
2023-01-06 19:12:53 +08:00
|
|
|
|
return operatorName
|
2023-01-13 15:58:35 +08:00
|
|
|
|
},
|
2023-12-07 20:24:26 +08:00
|
|
|
|
operatorDataType: function (operatorCode) {
|
|
|
|
|
|
let operatorDataType = "none"
|
|
|
|
|
|
if (typeof (window.WAF_RULE_OPERATORS) != null) {
|
|
|
|
|
|
window.WAF_RULE_OPERATORS.forEach(function (v) {
|
|
|
|
|
|
if (v.code == operatorCode) {
|
|
|
|
|
|
operatorDataType = v.dataType
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return operatorDataType
|
|
|
|
|
|
},
|
2023-01-13 15:58:35 +08:00
|
|
|
|
isEmptyString: function (v) {
|
|
|
|
|
|
return typeof v == "string" && v.length == 0
|
2023-01-06 19:12:53 +08:00
|
|
|
|
}
|
2021-09-27 10:11:37 +08:00
|
|
|
|
},
|
2021-07-19 10:48:53 +08:00
|
|
|
|
template: `<div>
|
2022-01-10 10:28:23 +08:00
|
|
|
|
<div class="ui label tiny basic" style="line-height: 1.5">
|
2021-07-19 10:48:53 +08:00
|
|
|
|
{{rule.name}}[{{rule.param}}]
|
|
|
|
|
|
|
|
|
|
|
|
<!-- cc2 -->
|
|
|
|
|
|
<span v-if="rule.param == '\${cc2}'">
|
2023-05-02 17:04:40 +08:00
|
|
|
|
{{rule.checkpointOptions.period}}秒内请求数
|
2021-07-19 10:48:53 +08:00
|
|
|
|
</span>
|
2021-10-19 11:38:56 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- refererBlock -->
|
|
|
|
|
|
<span v-if="rule.param == '\${refererBlock}'">
|
2022-10-24 10:20:44 +08:00
|
|
|
|
<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>
|
2021-10-19 11:38:56 +08:00
|
|
|
|
</span>
|
|
|
|
|
|
|
2021-07-19 10:48:53 +08:00
|
|
|
|
<span v-else>
|
|
|
|
|
|
<span v-if="rule.paramFilters != null && rule.paramFilters.length > 0" v-for="paramFilter in rule.paramFilters"> | {{paramFilter.code}}</span>
|
2023-02-02 16:14:07 +08:00
|
|
|
|
<span :class="{dash:!rule.isComposed && rule.isCaseInsensitive}" :title="(!rule.isComposed && rule.isCaseInsensitive) ? '大小写不敏感':''">{{operatorName(rule.operator)}}</span>
|
2023-01-13 15:58:35 +08:00
|
|
|
|
<span v-if="!isEmptyString(rule.value)">{{rule.value}}</span>
|
2023-12-07 20:24:26 +08:00
|
|
|
|
<span v-else-if="operatorDataType(rule.operator) != 'none'" class="disabled" style="font-weight: normal" title="空字符串">[空]</span>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
</span>
|
2021-09-27 10:11:37 +08:00
|
|
|
|
|
2022-01-10 10:28:23 +08:00
|
|
|
|
<!-- description -->
|
|
|
|
|
|
<span v-if="rule.description != null && rule.description.length > 0" class="grey small">({{rule.description}})</span>
|
|
|
|
|
|
|
2021-09-27 10:11:37 +08:00
|
|
|
|
<a href="" v-if="rule.err != null && rule.err.length > 0" @click.prevent="showErr(rule.err)" style="color: #db2828; opacity: 1; border-bottom: 1px #db2828 dashed; margin-left: 0.5em">规则错误</a>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>`
|
|
|
|
|
|
})
|