[waf]支持包含二进制、不支持二进制等操作符;支持对参数值编解码

This commit is contained in:
刘祥超
2020-11-21 20:43:45 +08:00
parent 32bf2a7dd3
commit 1655208e14
7 changed files with 120 additions and 13 deletions

View File

@@ -0,0 +1,72 @@
Vue.component("http-firewall-param-filters-box", {
props: ["v-filters"],
data: function () {
let filters = this.vFilters
if (filters == null) {
filters = []
}
return {
filters: filters,
isAdding: false,
options: [
{name: "MD5", code: "md5"},
{name: "URLEncode", code: "urlEncode"},
{name: "URLDecode", code: "urlDecode"},
{name: "BASE64Encode", code: "base64Encode"},
{name: "BASE64Decode", code: "base64Decode"},
{name: "计算长度", code: "length"}
],
addingCode: ""
}
},
methods: {
add: function () {
this.isAdding = true
this.addingCode = ""
},
confirm: function () {
if (this.addingCode.length == 0) {
return
}
let that = this
this.filters.push(this.options.$find(function (k, v) {
return (v.code == that.addingCode)
}))
this.isAdding = false
},
cancel: function () {
this.isAdding = false
},
remove: function (index) {
this.filters.$remove(index)
}
},
template: `<div>
<input type="hidden" name="paramFiltersJSON" :value="JSON.stringify(filters)" />
<div v-if="filters.length > 0">
<div v-for="(filter, index) in filters" class="ui label small basic">
{{filter.name}} <a href="" title="删除" @click.prevent="remove(index)"><i class="icon remove"></i></a>
</div>
<div class="ui divider"></div>
</div>
<div v-if="isAdding">
<div class="ui fields inline">
<div class="ui field">
<select class="ui dropdown auto-width" v-model="addingCode">
<option value="">[请选择]</option>
<option v-for="option in options" :value="option.code">{{option.name}}</option>
</select>
</div>
<div class="ui field">
<button class="ui button tiny" type="button" @click.prevent="confirm()">确定</button>
&nbsp; <a href="" @click.prevent="cancel()" title="取消"><i class="icon remove"></i></a>
</div>
</div>
</div>
<div v-if="!isAdding">
<button class="ui button tiny" type="button" @click.prevent="add">+</button>
</div>
<p class="comment">可以对参数值进行特定的编解码处理。</p>
</div>`
})

View File

@@ -38,8 +38,8 @@ Vue.component("http-firewall-rules-box", {
template: `<div>
<input type="hidden" name="rulesJSON" :value="JSON.stringify(rules)"/>
<div v-if="rules.length > 0">
<div v-for="(rule, index) in rules" class="ui label tiny" style="margin-bottom: 0.5em">
<span>{{rule.param}} <var v-if="rule.value.length > 0">{{rule.operator}}</var> {{rule.value}}</span>
<div v-for="(rule, index) in rules" class="ui label small basic" style="margin-bottom: 0.5em">
<span>{{rule.param}}<span v-if="rule.paramFilters != null && rule.paramFilters.length > 0" v-for="paramFilter in rule.paramFilters"> | {{paramFilter.code}}</span> <var v-if="rule.value.length > 0">{{rule.operator}}</var> {{rule.value}}</span>
<a href="" title="修改" @click.prevent="updateRule(index, rule)"><i class="icon pencil small"></i></a>
<a href="" title="删除" @click.prevent="removeRule(index)"><i class="icon remove"></i></a>
</div>