1.4.5.2
This commit is contained in:
124
EdgeUser/web/public/js/components/server/uam-config-box-plus.js
Normal file
124
EdgeUser/web/public/js/components/server/uam-config-box-plus.js
Normal file
@@ -0,0 +1,124 @@
|
||||
// UAM模式配置
|
||||
Vue.component("uam-config-box", {
|
||||
props: ["v-uam-config", "v-is-location", "v-is-group"],
|
||||
data: function () {
|
||||
let config = this.vUamConfig
|
||||
if (config == null) {
|
||||
config = {
|
||||
isPrior: false,
|
||||
isOn: false,
|
||||
addToWhiteList: true,
|
||||
onlyURLPatterns: [],
|
||||
exceptURLPatterns: [],
|
||||
minQPSPerIP: 0,
|
||||
keyLife: 0
|
||||
}
|
||||
}
|
||||
if (config.onlyURLPatterns == null) {
|
||||
config.onlyURLPatterns = []
|
||||
}
|
||||
if (config.exceptURLPatterns == null) {
|
||||
config.exceptURLPatterns = []
|
||||
}
|
||||
return {
|
||||
config: config,
|
||||
moreOptionsVisible: false,
|
||||
minQPSPerIP: config.minQPSPerIP,
|
||||
keyLife: config.keyLife
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
minQPSPerIP: function (v) {
|
||||
let qps = parseInt(v.toString())
|
||||
if (isNaN(qps) || qps < 0) {
|
||||
qps = 0
|
||||
}
|
||||
this.config.minQPSPerIP = qps
|
||||
},
|
||||
keyLife: function (v) {
|
||||
let keyLife = parseInt(v)
|
||||
if (isNaN(keyLife) || keyLife <= 0) {
|
||||
keyLife = 0
|
||||
}
|
||||
this.config.keyLife = keyLife
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showMoreOptions: function () {
|
||||
this.moreOptionsVisible = !this.moreOptionsVisible
|
||||
},
|
||||
changeConds: function (conds) {
|
||||
this.config.conds = conds
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="uamJSON" :value="JSON.stringify(config)"/>
|
||||
<table class="ui table definition selectable">
|
||||
<prior-checkbox :v-config="config" v-if="vIsLocation || vIsGroup"></prior-checkbox>
|
||||
<tbody v-show="((!vIsLocation && !vIsGroup) || config.isPrior)">
|
||||
<tr>
|
||||
<td class="title">启用5秒盾</td>
|
||||
<td>
|
||||
<checkbox v-model="config.isOn"></checkbox>
|
||||
<p class="comment"><plus-label></plus-label>启用后,访问网站时,自动检查浏览器环境,阻止非正常访问。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-show="config.isOn">
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator @change="showMoreOptions"></more-options-indicator></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-show="moreOptionsVisible && config.isOn">
|
||||
<tr>
|
||||
<td>验证有效期</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="keyLife" v-model="keyLife" maxlength="6" size="6" style="width: 6em"/>
|
||||
<span class="ui label">秒</span>
|
||||
</div>
|
||||
<p class="comment">单个客户端验证通过后,在这个有效期内不再重复验证;如果为0则表示系统默认。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单IP最低QPS</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="minQPSPerIP" maxlength="6" style="width: 6em" v-model="minQPSPerIP"/>
|
||||
<span class="ui label">请求数/秒</span>
|
||||
</div>
|
||||
<p class="comment">当某个IP在1分钟内平均QPS达到此值时,才会触发5秒盾;如果设置为0,表示任何访问都会触发。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>加入IP白名单</td>
|
||||
<td>
|
||||
<checkbox v-model="config.addToWhiteList"></checkbox>
|
||||
<p class="comment">选中后,表示验证通过后,将访问者IP加入到临时白名单中,此IP下次访问时不再校验5秒盾;此白名单只对5秒盾有效,不影响其他规则。此选项主要用于可能无法正常使用Cookie的网站。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例外URL</td>
|
||||
<td>
|
||||
<url-patterns-box v-model="config.exceptURLPatterns"></url-patterns-box>
|
||||
<p class="comment">如果填写了例外URL,表示这些URL跳过5秒盾不做处理。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>限制URL</td>
|
||||
<td>
|
||||
<url-patterns-box v-model="config.onlyURLPatterns"></url-patterns-box>
|
||||
<p class="comment">如果填写了限制URL,表示只对这些URL进行5秒盾处理;如果不填则表示支持所有的URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>匹配条件</td>
|
||||
<td>
|
||||
<http-request-conds-box :v-conds="config.conds" @change="changeConds"></http-request-conds-box>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
})
|
||||
Reference in New Issue
Block a user