mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-09 20:10:27 +08:00
增加防盗链功能
This commit is contained in:
@@ -229,6 +229,14 @@ func (this *HTTPRequest) Do() {
|
||||
}
|
||||
}
|
||||
|
||||
// 防盗链
|
||||
if !this.isSubRequest && this.web.Referers != nil && this.web.Referers.IsOn {
|
||||
if this.doCheckReferers() {
|
||||
this.doEnd()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 访问控制
|
||||
if !this.isSubRequest && this.web.Auth != nil && this.web.Auth.IsOn {
|
||||
if this.doAuth() {
|
||||
@@ -513,6 +521,11 @@ func (this *HTTPRequest) configureWeb(web *serverconfigs.HTTPWebConfig, isTop bo
|
||||
this.web.Auth = web.Auth
|
||||
}
|
||||
|
||||
// referers
|
||||
if web.Referers != nil && (web.Referers.IsPrior || isTop) {
|
||||
this.web.Referers = web.Referers
|
||||
}
|
||||
|
||||
// request limit
|
||||
if web.RequestLimit != nil && (web.RequestLimit.IsPrior || isTop) {
|
||||
this.web.RequestLimit = web.RequestLimit
|
||||
|
||||
Reference in New Issue
Block a user