2022-08-18 10:54:21 +00:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
2022-10-17 08:32:31 +00:00
|
|
|
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/middleware"
|
2022-08-18 10:54:21 +00:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type HostRouter struct{}
|
|
|
|
|
|
|
|
func (s *HostRouter) InitHostRouter(Router *gin.RouterGroup) {
|
2022-09-29 08:15:59 +00:00
|
|
|
hostRouter := Router.Group("hosts").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired())
|
2022-08-18 10:54:21 +00:00
|
|
|
baseApi := v1.ApiGroupApp.BaseApi
|
|
|
|
{
|
2022-12-13 10:54:28 +00:00
|
|
|
hostRouter.POST("", baseApi.CreateHost)
|
|
|
|
hostRouter.POST("/del", baseApi.DeleteHost)
|
|
|
|
hostRouter.POST("/update", baseApi.UpdateHost)
|
2023-03-01 09:43:28 +00:00
|
|
|
hostRouter.POST("/update/group", baseApi.UpdateHostGroup)
|
|
|
|
hostRouter.POST("/search", baseApi.SearchHost)
|
|
|
|
hostRouter.POST("/tree", baseApi.HostTree)
|
2023-01-03 06:37:17 +00:00
|
|
|
hostRouter.POST("/test/byinfo", baseApi.TestByInfo)
|
|
|
|
hostRouter.POST("/test/byid/:id", baseApi.TestByID)
|
2023-02-13 09:13:55 +00:00
|
|
|
|
2023-03-30 08:07:28 +00:00
|
|
|
hostRouter.GET("/firewall/base", baseApi.LoadFirewallBaseInfo)
|
2023-03-27 11:02:36 +00:00
|
|
|
hostRouter.POST("/firewall/search", baseApi.SearchFirewallRule)
|
2023-03-30 08:07:28 +00:00
|
|
|
hostRouter.POST("/firewall/operate", baseApi.OperateFirewall)
|
2023-03-27 11:02:36 +00:00
|
|
|
hostRouter.POST("/firewall/port", baseApi.OperatePortRule)
|
|
|
|
hostRouter.POST("/firewall/ip", baseApi.OperateIPRule)
|
2023-03-28 07:17:13 +00:00
|
|
|
hostRouter.POST("/firewall/batch", baseApi.BatchOperateRule)
|
|
|
|
hostRouter.POST("/firewall/update/port", baseApi.UpdatePortRule)
|
|
|
|
hostRouter.POST("/firewall/update/addr", baseApi.UpdateAddrRule)
|
2023-08-15 14:48:11 +00:00
|
|
|
hostRouter.POST("/firewall/update/description", baseApi.UpdateFirewallDescription)
|
2023-03-27 11:02:36 +00:00
|
|
|
|
2023-08-02 08:47:30 +00:00
|
|
|
hostRouter.GET("/ssh/conf", baseApi.LoadSSHConf)
|
2023-05-11 10:09:42 +00:00
|
|
|
hostRouter.POST("/ssh/search", baseApi.GetSSHInfo)
|
|
|
|
hostRouter.POST("/ssh/update", baseApi.UpdateSSH)
|
2023-05-15 11:00:40 +00:00
|
|
|
hostRouter.POST("/ssh/generate", baseApi.GenerateSSH)
|
|
|
|
hostRouter.POST("/ssh/secret", baseApi.LoadSSHSecret)
|
2023-05-16 10:49:27 +00:00
|
|
|
hostRouter.POST("/ssh/log", baseApi.LoadSSHLogs)
|
2023-09-20 06:18:20 +00:00
|
|
|
hostRouter.POST("/ssh/log/analysis", baseApi.AnalysisLog)
|
2023-05-17 06:45:48 +00:00
|
|
|
hostRouter.POST("/ssh/conffile/update", baseApi.UpdateSSHByfile)
|
2023-05-17 10:45:48 +00:00
|
|
|
hostRouter.POST("/ssh/operate", baseApi.OperateSSH)
|
2023-05-11 10:09:42 +00:00
|
|
|
|
2023-02-13 09:13:55 +00:00
|
|
|
hostRouter.GET("/command", baseApi.ListCommand)
|
|
|
|
hostRouter.POST("/command", baseApi.CreateCommand)
|
|
|
|
hostRouter.POST("/command/del", baseApi.DeleteCommand)
|
|
|
|
hostRouter.POST("/command/search", baseApi.SearchCommand)
|
2023-10-31 06:14:30 +00:00
|
|
|
hostRouter.GET("/command/tree", baseApi.SearchCommandTree)
|
2023-02-13 09:13:55 +00:00
|
|
|
hostRouter.POST("/command/update", baseApi.UpdateCommand)
|
2023-07-31 03:28:41 +00:00
|
|
|
|
|
|
|
hostRouter.POST("/tool", baseApi.GetToolStatus)
|
|
|
|
hostRouter.POST("/tool/init", baseApi.InitToolConfig)
|
|
|
|
hostRouter.POST("/tool/operate", baseApi.OperateTool)
|
|
|
|
hostRouter.POST("/tool/config", baseApi.OperateToolConfig)
|
|
|
|
hostRouter.POST("/tool/log", baseApi.GetToolLog)
|
|
|
|
hostRouter.POST("/tool/supervisor/process", baseApi.OperateProcess)
|
2023-08-01 09:31:42 +00:00
|
|
|
hostRouter.GET("/tool/supervisor/process", baseApi.GetProcess)
|
|
|
|
hostRouter.POST("/tool/supervisor/process/file", baseApi.GetProcessFile)
|
2022-08-18 10:54:21 +00:00
|
|
|
}
|
|
|
|
}
|