mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-19 23:50:25 +08:00
防盗链功能增加禁止的来源域名
This commit is contained in:
@@ -8,7 +8,6 @@ Vue.component("http-firewall-rule-label", {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showErr: function (err) {
|
showErr: function (err) {
|
||||||
|
|
||||||
teaweb.popupTip("规则校验错误,请修正:<span class=\"red\">" + teaweb.encodeHTML(err) + "</span>")
|
teaweb.popupTip("规则校验错误,请修正:<span class=\"red\">" + teaweb.encodeHTML(err) + "</span>")
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -24,7 +23,8 @@ Vue.component("http-firewall-rule-label", {
|
|||||||
|
|
||||||
<!-- refererBlock -->
|
<!-- refererBlock -->
|
||||||
<span v-if="rule.param == '\${refererBlock}'">
|
<span v-if="rule.param == '\${refererBlock}'">
|
||||||
{{rule.checkpointOptions.allowDomains}}
|
<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>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span v-else>
|
<span v-else>
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ Vue.component("http-firewall-rules-box", {
|
|||||||
|
|
||||||
<!-- refererBlock -->
|
<!-- refererBlock -->
|
||||||
<span v-if="rule.param == '\${refererBlock}'">
|
<span v-if="rule.param == '\${refererBlock}'">
|
||||||
{{rule.checkpointOptions.allowDomains}}
|
<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>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span v-else>
|
<span v-else>
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
let allowEmpty = true
|
let allowEmpty = true
|
||||||
let allowSameDomain = true
|
let allowSameDomain = true
|
||||||
let allowDomains = []
|
let allowDomains = []
|
||||||
|
let denyDomains = []
|
||||||
|
|
||||||
let options = {}
|
let options = {}
|
||||||
if (window.parent.UPDATING_RULE != null) {
|
if (window.parent.UPDATING_RULE != null) {
|
||||||
@@ -254,6 +255,9 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
if (options.allowDomains != null && typeof (options.allowDomains) == "object") {
|
if (options.allowDomains != null && typeof (options.allowDomains) == "object") {
|
||||||
allowDomains = options.allowDomains
|
allowDomains = options.allowDomains
|
||||||
}
|
}
|
||||||
|
if (options.denyDomains != null && typeof (options.denyDomains) == "object") {
|
||||||
|
denyDomains = options.denyDomains
|
||||||
|
}
|
||||||
|
|
||||||
let that = this
|
let that = this
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@@ -264,6 +268,7 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
allowEmpty: allowEmpty,
|
allowEmpty: allowEmpty,
|
||||||
allowSameDomain: allowSameDomain,
|
allowSameDomain: allowSameDomain,
|
||||||
allowDomains: allowDomains,
|
allowDomains: allowDomains,
|
||||||
|
denyDomains: denyDomains,
|
||||||
options: {},
|
options: {},
|
||||||
value: 0
|
value: 0
|
||||||
}
|
}
|
||||||
@@ -281,6 +286,10 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
this.allowDomains = values
|
this.allowDomains = values
|
||||||
this.change()
|
this.change()
|
||||||
},
|
},
|
||||||
|
changeDenyDomains: function (values) {
|
||||||
|
this.denyDomains = values
|
||||||
|
this.change()
|
||||||
|
},
|
||||||
change: function () {
|
change: function () {
|
||||||
this.vCheckpoint.options = [
|
this.vCheckpoint.options = [
|
||||||
{
|
{
|
||||||
@@ -294,7 +303,11 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
{
|
{
|
||||||
code: "allowDomains",
|
code: "allowDomains",
|
||||||
value: this.allowDomains
|
value: this.allowDomains
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
code: "denyDomains",
|
||||||
|
value: this.denyDomains
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -323,6 +336,13 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
<p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
|
<p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>禁止的来源域名</td>
|
||||||
|
<td>
|
||||||
|
<values-box :values="denyDomains" @change="changeDenyDomains"></values-box>
|
||||||
|
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
@@ -8,12 +8,16 @@ Vue.component("http-referers-config-box", {
|
|||||||
isOn: false,
|
isOn: false,
|
||||||
allowEmpty: true,
|
allowEmpty: true,
|
||||||
allowSameDomain: true,
|
allowSameDomain: true,
|
||||||
allowDomains: []
|
allowDomains: [],
|
||||||
|
denyDomains: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.allowDomains == null) {
|
if (config.allowDomains == null) {
|
||||||
config.allowDomains = []
|
config.allowDomains = []
|
||||||
}
|
}
|
||||||
|
if (config.denyDomains == null) {
|
||||||
|
config.denyDomains = []
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
config: config
|
config: config
|
||||||
}
|
}
|
||||||
@@ -23,6 +27,8 @@ Vue.component("http-referers-config-box", {
|
|||||||
return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior) && this.config.isOn
|
return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior) && this.config.isOn
|
||||||
},
|
},
|
||||||
changeAllowDomains: function (domains) {
|
changeAllowDomains: function (domains) {
|
||||||
|
},
|
||||||
|
changeDenyDomains: function (domains) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<div>
|
template: `<div>
|
||||||
@@ -63,6 +69,13 @@ Vue.component("http-referers-config-box", {
|
|||||||
<p class="comment">允许的其他来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
|
<p class="comment">允许的其他来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>禁止的来源域名</td>
|
||||||
|
<td>
|
||||||
|
<values-box :values="config.denyDomains" @change="changeDenyDomains"></values-box>
|
||||||
|
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="ui margin"></div>
|
<div class="ui margin"></div>
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
<!-- 通用header -->
|
<!-- 通用header -->
|
||||||
<http-cond-general-header-length v-if="checkpoint.prefix == 'requestGeneralHeaderLength' || checkpoint.prefix == 'responseGeneralHeaderLength'" :v-checkpoint="checkpoint"></http-cond-general-header-length>
|
<http-cond-general-header-length v-if="checkpoint.prefix == 'requestGeneralHeaderLength' || checkpoint.prefix == 'responseGeneralHeaderLength'" :v-checkpoint="checkpoint"></http-cond-general-header-length>
|
||||||
|
|
||||||
<!-- CC -->
|
<!-- 防盗链 -->
|
||||||
<http-firewall-checkpoint-referer-block v-if="checkpoint.prefix == 'refererBlock'" :v-checkpoint="checkpoint"></http-firewall-checkpoint-referer-block>
|
<http-firewall-checkpoint-referer-block v-if="checkpoint.prefix == 'refererBlock'" :v-checkpoint="checkpoint"></http-firewall-checkpoint-referer-block>
|
||||||
|
|
||||||
<!-- 防盗链 -->
|
<!-- CC -->
|
||||||
<http-firewall-checkpoint-cc v-if="checkpoint.prefix == 'cc2'" :v-checkpoint="checkpoint"></http-firewall-checkpoint-cc>
|
<http-firewall-checkpoint-cc v-if="checkpoint.prefix == 'cc2'" :v-checkpoint="checkpoint"></http-firewall-checkpoint-cc>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p class="comment" v-if="users.length == 0">暂时还没有用户。</p>
|
<p class="comment" v-if="users.length == 0">暂时还没有用户。</p>
|
||||||
<table class="ui table selectable" v-if="users.length > 0">
|
<table class="ui table selectable celled" v-if="users.length > 0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>用户名</th>
|
<th>用户名</th>
|
||||||
|
|||||||
Reference in New Issue
Block a user