自定义页面增加“跳转URL”功能

This commit is contained in:
GoEdgeLab
2023-11-10 16:36:03 +08:00
parent 9fdd61674b
commit a48448f9bd
7 changed files with 115 additions and 30 deletions

View File

@@ -6,7 +6,6 @@ import (
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/types"
)
@@ -20,7 +19,7 @@ func (this *CreatePopupAction) Init() {
}
func (this *CreatePopupAction) RunGet(params struct{}) {
this.Data["bodyTypes"] = shared.FindAllBodyTypes()
this.Data["bodyTypes"] = serverconfigs.FindAllHTTPPageBodyTypes()
this.Show()
}
@@ -42,12 +41,17 @@ func (this *CreatePopupAction) RunPost(params struct {
Require("请输入响应状态码")
switch params.BodyType {
case shared.BodyTypeURL:
case serverconfigs.HTTPPageBodyTypeURL:
params.Must.
Field("url", params.URL).
Require("请输入要显示的URL").
Match( `^(?i)(http|https)://`, "请输入正确的URL")
case shared.BodyTypeHTML:
case serverconfigs.HTTPPageBodyTypeRedirectURL:
params.Must.
Field("url", params.URL).
Require("请输入要跳转的URL").
Match( `^(?i)(http|https)://`, "请输入正确的URL")
case serverconfigs.HTTPPageBodyTypeHTML:
params.Must.
Field("body", params.Body).
Require("请输入要显示的HTML内容")