add webclientv2

This commit is contained in:
lejianwen
2024-11-16 18:33:02 +08:00
parent 78869a4a57
commit 22e470fee5
4 changed files with 24 additions and 0 deletions

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@ go.sum
resources/* resources/*
!resources/public/upload/.gitignore !resources/public/upload/.gitignore
!resources/web !resources/web
!resources/web2
!resources/i18n !resources/i18n
release release
data data

View File

@@ -85,3 +85,23 @@ func (i *WebClient) SharedPeer(c *gin.Context) {
"peer": pp, "peer": pp,
}) })
} }
// ServerConfigV2 服务配置
// @Tags WEBCLIENT_V2
// @Summary 服务配置
// @Description 服务配置,给webclient提供api-server
// @Accept json
// @Produce json
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /server-config [get]
// @Security token
func (i *WebClient) ServerConfigV2(c *gin.Context) {
response.Success(
c,
gin.H{
"id_server": global.Config.Rustdesk.IdServer,
"key": global.Config.Rustdesk.Key,
},
)
}

View File

@@ -17,6 +17,8 @@ func (i *Index) ConfigJs(c *gin.Context) {
tmp := ` tmp := `
localStorage.setItem('api-server', "` + apiServer + `") localStorage.setItem('api-server', "` + apiServer + `")
const ws2_prefix = 'wc-'
localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `")
` `
c.String(200, tmp) c.String(200, tmp)
} }

View File

@@ -121,6 +121,7 @@ func WebClientRoutes(frg *gin.RouterGroup) {
} }
{ {
frg.POST("/server-config", middleware.RustAuth(), w.ServerConfig) frg.POST("/server-config", middleware.RustAuth(), w.ServerConfig)
frg.POST("/server-config-v2", middleware.RustAuth(), w.ServerConfigV2)
} }
} }