mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-01 17:43:16 +00:00
first
This commit is contained in:
42
http/controller/api/webClient.go
Normal file
42
http/controller/api/webClient.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"Gwen/global"
|
||||
"Gwen/http/response"
|
||||
"Gwen/http/response/api"
|
||||
"Gwen/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type WebClient struct {
|
||||
}
|
||||
|
||||
// ServerConfig 服务配置
|
||||
// @Tags WEBCLIENT
|
||||
// @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) ServerConfig(c *gin.Context) {
|
||||
u := service.AllService.UserService.CurUser(c)
|
||||
|
||||
peers := map[string]*api.WebClientPeerPayload{}
|
||||
abs := service.AllService.AddressBookService.ListByUserId(u.Id, 1, 100)
|
||||
for _, ab := range abs.AddressBooks {
|
||||
pp := &api.WebClientPeerPayload{}
|
||||
pp.FromAddressBook(ab)
|
||||
peers[ab.Id] = pp
|
||||
}
|
||||
response.Success(
|
||||
c,
|
||||
gin.H{
|
||||
"id_server": global.Config.Rustdesk.IdServer,
|
||||
"key": global.Config.Rustdesk.Key,
|
||||
//"peers": peers,
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user