mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 06:40:27 +08:00
限制TCP和UDP网站操作HTTP网站的功能
This commit is contained in:
@@ -169,3 +169,14 @@ func (this *ParentAction) FailLang(messageCode langs.MessageCode, args ...any) {
|
|||||||
func (this *ParentAction) FailFieldLang(field string, messageCode langs.MessageCode, args ...any) {
|
func (this *ParentAction) FailFieldLang(field string, messageCode langs.MessageCode, args ...any) {
|
||||||
this.FailField(field, langs.Message(this.LangCode(), messageCode, args...))
|
this.FailField(field, langs.Message(this.LangCode(), messageCode, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ParentAction) FilterHTTPFamily() bool {
|
||||||
|
if this.Data.GetString("serverFamily") == "http" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ResponseWriter.WriteHeader(http.StatusNotFound)
|
||||||
|
_, _ = this.ResponseWriter.Write([]byte("page not found"))
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 网站分组设置
|
// 网站分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package charset
|
package charset
|
||||||
|
|
||||||
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||||
@@ -21,6 +22,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.Data["hasGroupConfig"] = false
|
this.Data["hasGroupConfig"] = false
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
|
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
|
||||||
if !isOk {
|
if !isOk {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
|
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
|
||||||
if !isOk {
|
if !isOk {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 分组设置
|
// 分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.Data["serverId"] = params.ServerId
|
this.Data["serverId"] = params.ServerId
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.Data["serverId"] = params.ServerId
|
this.Data["serverId"] = params.ServerId
|
||||||
|
|
||||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 分组设置
|
// 分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
|
// 只有HTTP服务才支持
|
||||||
|
if this.FilterHTTPFamily() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 服务分组设置
|
// 服务分组设置
|
||||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||||
ServerId: params.ServerId,
|
ServerId: params.ServerId,
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func (this *ServerHelper) createLeftMenu(action *actions.ActionObject) {
|
|||||||
if serverId == 0 {
|
if serverId == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
serverIdString := strconv.FormatInt(serverId, 10)
|
var serverIdString = strconv.FormatInt(serverId, 10)
|
||||||
action.Data["serverId"] = serverId
|
action.Data["serverId"] = serverId
|
||||||
|
|
||||||
// 读取server信息
|
// 读取server信息
|
||||||
@@ -95,7 +95,7 @@ func (this *ServerHelper) createLeftMenu(action *actions.ActionObject) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 协议簇
|
// 协议簇
|
||||||
family := ""
|
var family = ""
|
||||||
if serverConfig.IsHTTPFamily() {
|
if serverConfig.IsHTTPFamily() {
|
||||||
family = "http"
|
family = "http"
|
||||||
} else if serverConfig.IsTCPFamily() {
|
} else if serverConfig.IsTCPFamily() {
|
||||||
|
|||||||
Reference in New Issue
Block a user