Files
EdgeAdmin/internal/web/actions/default/servers/server/settings/rewrite/index.go

40 lines
795 B
Go
Raw Normal View History

2020-09-26 19:54:02 +08:00
package rewrite
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
2021-01-03 20:25:15 +08:00
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
2020-09-26 19:54:02 +08:00
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "setting", "index")
this.SecondMenu("rewrite")
}
func (this *IndexAction) RunGet(params struct {
ServerId int64
}) {
// 只有HTTP服务才支持
if this.FilterHTTPFamily() {
return
}
2021-01-03 20:25:15 +08:00
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
2020-09-28 16:25:26 +08:00
if err != nil {
this.ErrorPage(err)
return
}
this.Data["webId"] = webConfig.Id
if len(webConfig.RewriteRules) == 0 {
this.Data["rewriteRules"] = []interface{}{}
} else {
this.Data["rewriteRules"] = webConfig.RewriteRules
}
2020-09-26 19:54:02 +08:00
this.Show()
}