mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
URL跳转中增加例外域名和仅限域名
This commit is contained in:
@@ -53,6 +53,10 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
PortAfterScheme string
|
PortAfterScheme string
|
||||||
|
|
||||||
Status int
|
Status int
|
||||||
|
|
||||||
|
ExceptDomainsJSON []byte
|
||||||
|
OnlyDomainsJSON []byte
|
||||||
|
|
||||||
CondsJSON []byte
|
CondsJSON []byte
|
||||||
IsOn bool
|
IsOn bool
|
||||||
|
|
||||||
@@ -186,6 +190,27 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
Field("status", params.Status).
|
Field("status", params.Status).
|
||||||
Gte(0, "请选择正确的跳转状态码")
|
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
|
var conds *shared.HTTPRequestCondsConfig
|
||||||
if len(params.CondsJSON) > 0 {
|
if len(params.CondsJSON) > 0 {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Vue.component("http-host-redirect-box", {
|
|||||||
|
|
||||||
teaweb.popup("/servers/server/settings/redirects/createPopup", {
|
teaweb.popup("/servers/server/settings/redirects/createPopup", {
|
||||||
width: "50em",
|
width: "50em",
|
||||||
height: "30em",
|
height: "36em",
|
||||||
callback: function (resp) {
|
callback: function (resp) {
|
||||||
that.id++
|
that.id++
|
||||||
resp.data.redirect.id = that.id
|
resp.data.redirect.id = that.id
|
||||||
@@ -60,7 +60,7 @@ Vue.component("http-host-redirect-box", {
|
|||||||
|
|
||||||
teaweb.popup("/servers/server/settings/redirects/createPopup", {
|
teaweb.popup("/servers/server/settings/redirects/createPopup", {
|
||||||
width: "50em",
|
width: "50em",
|
||||||
height: "30em",
|
height: "36em",
|
||||||
callback: function (resp) {
|
callback: function (resp) {
|
||||||
resp.data.redirect.id = redirect.id
|
resp.data.redirect.id = redirect.id
|
||||||
Vue.set(that.redirects, index, resp.data.redirect)
|
Vue.set(that.redirects, index, resp.data.redirect)
|
||||||
@@ -119,6 +119,8 @@ Vue.component("http-host-redirect-box", {
|
|||||||
<grey-label v-if="redirect.matchPrefix">匹配前缀</grey-label>
|
<grey-label v-if="redirect.matchPrefix">匹配前缀</grey-label>
|
||||||
<grey-label v-if="redirect.matchRegexp">正则匹配</grey-label>
|
<grey-label v-if="redirect.matchRegexp">正则匹配</grey-label>
|
||||||
<grey-label v-if="!redirect.matchPrefix && !redirect.matchRegexp">精准匹配</grey-label>
|
<grey-label v-if="!redirect.matchPrefix && !redirect.matchRegexp">精准匹配</grey-label>
|
||||||
|
<grey-label v-if="redirect.exceptDomains != null && redirect.exceptDomains.length > 0" v-for="domain in redirect.exceptDomains">排除:{{domain}}</grey-label>
|
||||||
|
<grey-label v-if="redirect.onlyDomains != null && redirect.onlyDomains.length > 0" v-for="domain in redirect.onlyDomains">仅限:{{domain}}</grey-label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="redirect.type == 'domain'">
|
<div v-if="redirect.type == 'domain'">
|
||||||
|
|||||||
@@ -150,6 +150,24 @@
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||||
|
</tr>
|
||||||
|
<tbody v-show="moreOptionsVisible">
|
||||||
|
<tr>
|
||||||
|
<td>例外域名</td>
|
||||||
|
<td>
|
||||||
|
<domains-box name="exceptDomainsJSON" :v-domains="redirect.exceptDomains"></domains-box>
|
||||||
|
<p class="comment">这些域名<strong>不</strong>执行跳转。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>仅限域名</td>
|
||||||
|
<td>
|
||||||
|
<domains-box name="onlyDomainsJSON" :v-domains="redirect.onlyDomains"></domains-box>
|
||||||
|
<p class="comment">只有这些域名执行跳转。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>匹配条件</td>
|
<td>匹配条件</td>
|
||||||
<td><http-request-conds-box :v-conds="redirect.conds" @change="changeConds"></http-request-conds-box></td>
|
<td><http-request-conds-box :v-conds="redirect.conds" @change="changeConds"></http-request-conds-box></td>
|
||||||
@@ -158,6 +176,7 @@
|
|||||||
<td>启用当前跳转</td>
|
<td>启用当前跳转</td>
|
||||||
<td><checkbox name="isOn" value="1" v-model="redirect.isOn"></checkbox></td>
|
<td><checkbox name="isOn" value="1" v-model="redirect.isOn"></checkbox></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<submit-btn></submit-btn>
|
<submit-btn></submit-btn>
|
||||||
|
|||||||
Reference in New Issue
Block a user