URL跳转中增加例外域名和仅限域名

This commit is contained in:
GoEdgeLab
2023-11-10 11:05:05 +08:00
parent 46e247f207
commit 03a64742c7
3 changed files with 55 additions and 9 deletions

View File

@@ -52,7 +52,11 @@ func (this *CreatePopupAction) RunPost(params struct {
PortAfter int
PortAfterScheme string
Status int
Status int
ExceptDomainsJSON []byte
OnlyDomainsJSON []byte
CondsJSON []byte
IsOn bool
@@ -186,6 +190,27 @@ func (this *CreatePopupAction) RunPost(params struct {
Field("status", params.Status).
Gte(0, "请选择正确的跳转状态码")
// 域名
if len(params.ExceptDomainsJSON) > 0 {
var exceptDomains = []string{}
err := json.Unmarshal(params.ExceptDomainsJSON, &exceptDomains)
if err != nil {
this.ErrorPage(err)
return
}
config.ExceptDomains = exceptDomains
}
if len(params.OnlyDomainsJSON) > 0 {
var onlyDomains = []string{}
err := json.Unmarshal(params.OnlyDomainsJSON, &onlyDomains)
if err != nil {
this.ErrorPage(err)
return
}
config.OnlyDomains = onlyDomains
}
// 校验匹配条件
var conds *shared.HTTPRequestCondsConfig
if len(params.CondsJSON) > 0 {