2020-10-08 11:11:37 +08:00
|
|
|
|
{$layout "layout_popup"}
|
|
|
|
|
|
|
|
|
|
|
|
<h3 v-if="!isUpdating">添加规则</h3>
|
|
|
|
|
|
<h3 v-if="isUpdating">修改规则</h3>
|
|
|
|
|
|
|
2020-11-10 12:47:24 +08:00
|
|
|
|
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
2020-10-08 11:11:37 +08:00
|
|
|
|
<input type="hidden" name="ruleId" :value="rule.id"/>
|
|
|
|
|
|
<input type="hidden" name="optionsJSON" v-if="checkpoint != null && checkpoint.options != null" :value="JSON.stringify(checkpoint.options)"/>
|
|
|
|
|
|
<table class="ui table definition selectable">
|
|
|
|
|
|
<tr>
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<td class="title">参数 *</td>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
<td>
|
|
|
|
|
|
<select name="prefix" class="ui dropdown auto-width" @change="changeCheckpoint()" v-model="rule.checkpointPrefix">
|
|
|
|
|
|
<option value="">[选择参数]</option>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<optgroup label="特殊参数"></optgroup>
|
2023-01-13 18:51:14 +08:00
|
|
|
|
<option v-for="cp in checkpoints" v-if="cp.isComposed" :value="cp.prefix">{{cp.name}} - [{{cp.prefix}}]</option>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<optgroup label="通用参数"></optgroup>
|
2023-01-13 18:51:14 +08:00
|
|
|
|
<option v-for="cp in checkpoints" v-if="!cp.isComposed" :value="cp.prefix">{{cp.name}} - [{{cp.prefix}}]</option>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
<p class="comment" v-if="checkpoint != null"><span class="ui label tiny">${<em style="font-style: normal;">{{checkpoint.prefix}}</em>}</span>{{checkpoint.description}}</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2020-11-21 20:43:45 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 参数名 -->
|
2020-10-08 11:11:37 +08:00
|
|
|
|
<tr v-if="checkpoint != null && checkpoint.hasParams">
|
|
|
|
|
|
<td>参数名</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<select name="param" v-model="rule.checkpointParam" class="ui dropdown auto-width" v-if="checkpoint.params != null">
|
|
|
|
|
|
<option v-for="o in checkpoint.params" :value="o.value">{{o.name}}</option>
|
|
|
|
|
|
</select>
|
2020-11-21 20:43:45 +08:00
|
|
|
|
<input type="text" name="param" maxlength="100" v-model="rule.checkpointParam" v-if="checkpoint.params == null"/>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<!-- 组合规则的选项 -->
|
|
|
|
|
|
<tbody v-if="checkpoint != null && checkpoint.isComposed">
|
2021-07-19 10:48:53 +08:00
|
|
|
|
<tr>
|
|
|
|
|
|
<td colspan="2">配置选项</td>
|
|
|
|
|
|
</tr>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<tr>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
<td colspan="2">
|
|
|
|
|
|
<!-- 通用header -->
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<http-cond-general-header-length v-if="checkpoint.prefix == 'requestGeneralHeaderLength' || checkpoint.prefix == 'responseGeneralHeaderLength'" :v-checkpoint="checkpoint"></http-cond-general-header-length>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
|
2022-10-24 10:20:44 +08:00
|
|
|
|
<!-- 防盗链 -->
|
2021-10-19 11:38:56 +08:00
|
|
|
|
<http-firewall-checkpoint-referer-block v-if="checkpoint.prefix == 'refererBlock'" :v-checkpoint="checkpoint"></http-firewall-checkpoint-referer-block>
|
|
|
|
|
|
|
2022-10-24 10:20:44 +08:00
|
|
|
|
<!-- CC -->
|
2021-07-19 10:48:53 +08:00
|
|
|
|
<http-firewall-checkpoint-cc v-if="checkpoint.prefix == 'cc2'" :v-checkpoint="checkpoint"></http-firewall-checkpoint-cc>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
|
2020-10-08 11:11:37 +08:00
|
|
|
|
<!-- 选项 -->
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<tbody v-if="checkpoint != null && !checkpoint.isComposed && checkpoint.options != null && checkpoint.options.length > 0">
|
|
|
|
|
|
<tr v-for="option in checkpoint.options">
|
|
|
|
|
|
<td>{{option.name}}</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<div class="ui fields inline" v-if="option.type == 'field'">
|
|
|
|
|
|
<div class="ui field">
|
|
|
|
|
|
<input type="text" name="" :placeholder="option.placeholder" :maxlength="(option.maxLength > 0)?option.maxLength:1024" :size="option.size" v-model="option.value"/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="ui field">
|
|
|
|
|
|
{{option.rightLabel}}
|
|
|
|
|
|
</div>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
</div>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<div class="ui fields inline" v-if="option.type == 'options'">
|
|
|
|
|
|
<div class="ui field">
|
|
|
|
|
|
<select class="ui dropdown" :style="'width:' + option.size + 'em'" name="" v-model="option.value">
|
|
|
|
|
|
<option v-for="opt in option.options" :value="opt.value">{{opt.name}}</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="ui field">
|
|
|
|
|
|
{{option.rightLabel}}
|
|
|
|
|
|
</div>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
</div>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<p class="comment" v-if="option.comment != null && option.comment.length > 0">{{option.comment}}</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
</tbody>
|
|
|
|
|
|
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<tbody v-show="checkpoint != null && !checkpoint.isComposed">
|
|
|
|
|
|
<tr>
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<td>操作符 *</td>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<td>
|
|
|
|
|
|
<select class="ui dropdown" name="operator" style="width:10em" v-model="rule.operator" @change="changeOperator()">
|
|
|
|
|
|
<option v-for="op in operators" :value="op.code">{{op.name}}</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<p class="comment" v-if="operator != null" v-html="operator.description"></p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<td>
|
2022-11-16 15:43:08 +08:00
|
|
|
|
<span v-if="(checkpoint == null || checkpoint.dataType != 'bool') && (rule.operator == 'match' || rule.operator == 'not match')">正则表达式</span>
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<span v-else>对比值</span>
|
|
|
|
|
|
</td>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
<td>
|
2020-11-21 20:43:45 +08:00
|
|
|
|
<!-- 二进制数据 -->
|
2020-11-27 19:15:12 +08:00
|
|
|
|
<div v-if="rule.operator == 'contains binary'">
|
2020-11-21 20:43:45 +08:00
|
|
|
|
<textarea rows="3" maxlength="4096" name="value" v-model="rule.value"></textarea>
|
|
|
|
|
|
<p class="comment">将二进制进行Base64Encode后放在这里,比如<code-label>Hello</code-label>对应<code-label>SGVsbG8=</code-label>。</p>
|
|
|
|
|
|
</div>
|
2020-11-27 19:15:12 +08:00
|
|
|
|
<div v-else-if="rule.operator == 'not contains binary'">
|
2020-11-21 20:43:45 +08:00
|
|
|
|
<textarea rows="3" maxlength="4096" name="value" v-model="rule.value"></textarea>
|
|
|
|
|
|
<p class="comment">将二进制进行Base64Encode后放在这里,比如<code-label>Hello</code-label>对应<code-label>SGVsbG8=</code-label>。</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2022-11-16 15:43:08 +08:00
|
|
|
|
<!-- bool数据 -->
|
|
|
|
|
|
<div v-else-if="checkpoint != null && checkpoint.dataType == 'bool'">
|
|
|
|
|
|
<select name="value" class="ui selectable auto-width" v-model="rule.value" @change="changeRuleValue">
|
|
|
|
|
|
<option value="">[请选择]</option>
|
|
|
|
|
|
<option value="1">是(1)</option>
|
|
|
|
|
|
<option value="0">否(0)</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2020-11-21 20:43:45 +08:00
|
|
|
|
<!-- 其余数据 -->
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<textarea rows="3" maxlength="4096" name="value" v-model="rule.value" @input="changeRuleValue" v-else></textarea>
|
2022-06-14 17:38:50 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 特殊规则 -->
|
|
|
|
|
|
<div style="margin-top: 1em">
|
|
|
|
|
|
<!-- geo country name -->
|
|
|
|
|
|
<div v-if="checkpoint != null && checkpoint.prefix == 'geoCountryName'" >
|
|
|
|
|
|
<combo-box title="已添加" width="14em" data-url="/ui/countryOptions" data-key="countries" placeholder="点这里选择国家/地区" @change="selectGeoCountryName" ref="countryComboBox" key="combo-box-country"></combo-box>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- geo province name -->
|
|
|
|
|
|
<div v-if="checkpoint != null && checkpoint.prefix == 'geoProvinceName'" >
|
|
|
|
|
|
<combo-box title="已添加" data-url="/ui/provinceOptions" data-key="provinces" placeholder="点这里选择省份名称" @change="selectGeoProvinceName" ref="provinceComboBox" key="combo-box-province"></combo-box>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- geo city name -->
|
|
|
|
|
|
<div v-if="checkpoint != null && checkpoint.prefix == 'geoCityName'" >
|
|
|
|
|
|
<combo-box title="已添加" data-url="/ui/cityOptions" data-key="cities" placeholder="点这里选择城市名称" @change="selectGeoCityName" ref="cityComboBox" key="combo-box-city"></combo-box>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ISP Name -->
|
|
|
|
|
|
<div v-if="checkpoint != null && checkpoint.prefix == 'ispName'" >
|
|
|
|
|
|
<combo-box title="已添加" data-url="/ui/providerOptions" data-key="providers" placeholder="点这里选择ISP名称" @change="selectISPName" ref="ispComboBox" key="combo-box-isp"></combo-box>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2022-11-16 15:43:08 +08:00
|
|
|
|
<tr v-if="(checkpoint == null || checkpoint.dataType != 'bool') && (rule.operator == 'match' || rule.operator == 'not match')">
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<td>正则表达式测试</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<a href="" v-if="!regexpTestIsOn" @click.prevent="changeRegexpTestIsOn">[输入测试字符串]</a>
|
|
|
|
|
|
<div v-if="regexpTestIsOn">
|
|
|
|
|
|
<textarea placeholder="输入要测试的内容" rows="3" v-model="regexpTestBody" ref="regexpTestBody" @input="changeRegexpTestBody"></textarea>
|
|
|
|
|
|
<p class="comment">
|
|
|
|
|
|
<span v-if="regexpTestResult.isOk" class="green">{{regexpTestResult.message}}</span>
|
|
|
|
|
|
<span v-if="!regexpTestResult.isOk" class="red">{{regexpTestResult.message}}</span>
|
|
|
|
|
|
|
|
|
|
|
|
<a href="" @click.prevent="changeRegexpTestIsOn">[结束测试]</a>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2022-11-16 15:43:08 +08:00
|
|
|
|
<tr v-if="(checkpoint == null || checkpoint.dataType != 'bool') && operator != null && operator.case != 'none'">
|
2021-12-12 20:56:25 +08:00
|
|
|
|
<td>不区分大小写</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<div class="ui checkbox">
|
|
|
|
|
|
<input name="case" type="checkbox" value="1" v-model="rule.isCaseInsensitive" @change="changeCaseInsensitive"/>
|
|
|
|
|
|
<label></label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p class="comment">开启后忽略英文字母大小写</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<!-- 参数过滤器 -->
|
|
|
|
|
|
<tr v-if="checkpoint != null && !checkpoint.isComposed">
|
|
|
|
|
|
<td>编解码</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<http-firewall-param-filters-box :v-filters="rule.paramFilters"></http-firewall-param-filters-box>
|
|
|
|
|
|
</td>
|
2022-01-10 10:28:23 +08:00
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>备注</td>
|
|
|
|
|
|
<td><input type="text" name="description" v-model="rule.description"/></td>
|
2021-12-12 20:56:25 +08:00
|
|
|
|
</tr>
|
2020-11-18 19:35:32 +08:00
|
|
|
|
</tbody>
|
2020-10-08 11:11:37 +08:00
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<submit-btn></submit-btn>
|
|
|
|
|
|
</form>
|