缓存条件类型增加“URL通配符”

This commit is contained in:
GoEdgeLab
2023-06-16 11:34:39 +08:00
parent 6f5fd3fdb4
commit e52ba42118
3 changed files with 43 additions and 1 deletions

View File

@@ -179,10 +179,11 @@ Vue.component("http-cache-ref-box", {
<td> <td>
<select class="ui dropdown auto-width" name="condType" v-model="condType" @change="changeCondType(condType, false)"> <select class="ui dropdown auto-width" name="condType" v-model="condType" @change="changeCondType(condType, false)">
<option value="url-extension">文件扩展名</option> <option value="url-extension">文件扩展名</option>
<option value="url-prefix">URL前缀</option>
<option value="url-eq-index">首页</option> <option value="url-eq-index">首页</option>
<option value="url-all">全站</option> <option value="url-all">全站</option>
<option value="url-prefix">URL前缀</option>
<option value="url-eq">URL完整路径</option> <option value="url-eq">URL完整路径</option>
<option value="url-wildcard-match">URL通配符</option>
<option value="url-regexp">URL正则匹配</option> <option value="url-regexp">URL正则匹配</option>
<option value="params">参数匹配</option> <option value="params">参数匹配</option>
</select> </select>

View File

@@ -438,6 +438,38 @@ Vue.component("http-cond-url-not-regexp", {
</div>` </div>`
}) })
// URL通配符
Vue.component("http-cond-url-wildcard-match", {
props: ["v-cond"],
mounted: function () {
this.$refs.valueInput.focus()
},
data: function () {
let cond = {
isRequest: true,
param: "${requestPath}",
operator: "wildcard match",
value: "",
isCaseInsensitive: false
}
if (this.vCond != null && typeof this.vCond.value == "string") {
cond.value = this.vCond.value
}
return {
cond: cond
}
},
methods: {
changeCaseInsensitive: function (isCaseInsensitive) {
this.cond.isCaseInsensitive = isCaseInsensitive
}
},
template: `<div>
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
<input type="text" v-model="cond.value" ref="valueInput"/>
<p class="comment">匹配URL的通配符用星号<code-label>*</code-label>)表示任意字符,比如(<code-label>/images/*.png</code-label>、<code-label>/static/*</code-label>,不需要带域名。</p>
</div>`
})
// User-Agent正则匹配 // User-Agent正则匹配
Vue.component("http-cond-user-agent-regexp", { Vue.component("http-cond-user-agent-regexp", {

View File

@@ -52,6 +52,15 @@
"isRequest": true, "isRequest": true,
"caseInsensitive": true "caseInsensitive": true
}, },
{
"type": "url-wildcard-match",
"name": "URL通配符",
"description": "使用通配符检查URL中的文件路径是否一致",
"component": "http-cond-url-wildcard-match",
"paramsTitle": "通配符",
"isRequest": true,
"caseInsensitive": true
},
{ {
"type": "user-agent-regexp", "type": "user-agent-regexp",
"name": "User-Agent正则匹配", "name": "User-Agent正则匹配",