From 7ffff890a8666b50f71d3108ed112f29b6b4584e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 7 Apr 2021 11:20:23 +0800 Subject: [PATCH] =?UTF-8?q?URL=E8=B7=B3=E8=BD=AC=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=89=8D=E7=BC=80=E5=92=8C=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=BF=9D=E7=95=99RequestURI=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/settings/redirects/createPopup.go | 19 +++++++++----- .../server/http-host-redirect-box.js | 2 +- .../settings/redirects/createPopup.html | 22 ++++++++++++++-- .../server/settings/redirects/createPopup.js | 26 +++++++++++-------- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/internal/web/actions/default/servers/server/settings/redirects/createPopup.go b/internal/web/actions/default/servers/server/settings/redirects/createPopup.go index afdaf14d..278c3dd7 100644 --- a/internal/web/actions/default/servers/server/settings/redirects/createPopup.go +++ b/internal/web/actions/default/servers/server/settings/redirects/createPopup.go @@ -24,9 +24,12 @@ func (this *CreatePopupAction) RunGet(params struct { } func (this *CreatePopupAction) RunPost(params struct { - BeforeURL string - AfterURL string - Status int + BeforeURL string + AfterURL string + MatchPrefix bool + KeepRequestURI bool + + Status int Must *actions.Must CSRF *actionutils.CSRF @@ -69,10 +72,12 @@ func (this *CreatePopupAction) RunPost(params struct { Gte(0, "请选择正确的跳转状态码") this.Data["redirect"] = maps.Map{ - "status": params.Status, - "beforeURL": params.BeforeURL, - "afterURL": params.AfterURL, - "isOn": true, + "status": params.Status, + "beforeURL": params.BeforeURL, + "afterURL": params.AfterURL, + "matchPrefix": params.MatchPrefix, + "keepRequestURI": params.KeepRequestURI, + "isOn": true, } this.Success() diff --git a/web/public/js/components/server/http-host-redirect-box.js b/web/public/js/components/server/http-host-redirect-box.js index ab68b3ce..cea2f7aa 100644 --- a/web/public/js/components/server/http-host-redirect-box.js +++ b/web/public/js/components/server/http-host-redirect-box.js @@ -50,7 +50,7 @@ Vue.component("http-host-redirect-box", {
- [{{redirect.status}}] {{redirect.beforeURL}} -> {{redirect.afterURL}}   + [{{redirect.status}}][prefix] {{redirect.beforeURL}} -> {{redirect.afterURL}}  
diff --git a/web/views/@default/servers/server/settings/redirects/createPopup.html b/web/views/@default/servers/server/settings/redirects/createPopup.html index f3cfa773..ccfddc06 100644 --- a/web/views/@default/servers/server/settings/redirects/createPopup.html +++ b/web/views/@default/servers/server/settings/redirects/createPopup.html @@ -8,12 +8,30 @@ - + + + + + + + + + - +
跳转前URL *跳转前URL *

需要填写完整的URL,包括http://或者https://,如果有非默认端口,也需要带上端口号。

匹配模式 + +

精准匹配跳转前的URL。

+

只要URL头部部分包含跳转前URL,即可跳转。

+
是否保留URL路径参数 + +

选中后,则跳转之后,保留跳转之前的URL路径和参数。

+
跳转后URL * @@ -22,7 +40,7 @@
跳转状态码跳转状态码