add webclientv2
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@ go.sum
|
||||
resources/*
|
||||
!resources/public/upload/.gitignore
|
||||
!resources/web
|
||||
!resources/web2
|
||||
!resources/i18n
|
||||
release
|
||||
data
|
||||
@@ -85,3 +85,23 @@ func (i *WebClient) SharedPeer(c *gin.Context) {
|
||||
"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,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ func (i *Index) ConfigJs(c *gin.Context) {
|
||||
|
||||
tmp := `
|
||||
localStorage.setItem('api-server', "` + apiServer + `")
|
||||
const ws2_prefix = 'wc-'
|
||||
localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `")
|
||||
`
|
||||
c.String(200, tmp)
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ func WebClientRoutes(frg *gin.RouterGroup) {
|
||||
}
|
||||
{
|
||||
frg.POST("/server-config", middleware.RustAuth(), w.ServerConfig)
|
||||
frg.POST("/server-config-v2", middleware.RustAuth(), w.ServerConfigV2)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user