add login fail warn &

add web client on/off &
up admin peer filter &
upgrade web client
This commit is contained in:
ljw
2024-10-14 10:43:29 +08:00
parent 5ef6810e3f
commit caef3897a0
20 changed files with 463 additions and 379 deletions

View File

@@ -30,6 +30,7 @@ func Init(g *gin.Engine) {
rs := &admin.Rustdesk{}
adg.GET("/server-config", rs.ServerConfig)
adg.GET("/app-config", rs.AppConfig)
//访问静态文件
//g.StaticFS("/upload", http.Dir(global.Config.Gin.ResourcesPath+"/upload"))

View File

@@ -47,17 +47,11 @@ func ApiInit(g *gin.Engine) {
frg.POST("/sysinfo", pe.SysInfo)
}
{
w := &api.WebClient{}
frg.POST("/shared-peer", w.SharedPeer)
if global.Config.App.WebClient == 1 {
WebClientRoutes(frg)
}
frg.Use(middleware.RustAuth())
{
w := &api.WebClient{}
frg.POST("/server-config", w.ServerConfig)
}
{
u := &api.User{}
frg.GET("/user/info", u.Info)
@@ -115,3 +109,14 @@ func PersonalRoutes(frg *gin.RouterGroup) {
}
}
func WebClientRoutes(frg *gin.RouterGroup) {
w := &api.WebClient{}
{
frg.POST("/shared-peer", w.SharedPeer)
}
{
frg.POST("/server-config", middleware.RustAuth(), w.ServerConfig)
}
}

View File

@@ -10,7 +10,13 @@ import (
func WebInit(g *gin.Engine) {
i := &web.Index{}
g.GET("/", i.Index)
g.GET("/webclient-config/index.js", i.ConfigJs)
g.StaticFS("/webclient", http.Dir(global.Config.Gin.ResourcesPath+"/web"))
if global.Config.App.WebClient == 1 {
g.GET("/webclient-config/index.js", i.ConfigJs)
}
if global.Config.App.WebClient == 1 {
g.StaticFS("/webclient", http.Dir(global.Config.Gin.ResourcesPath+"/web"))
}
g.StaticFS("/_admin", http.Dir(global.Config.Gin.ResourcesPath+"/admin"))
}