mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-11-29 16:43:17 +00:00
36 lines
958 B
Go
36 lines
958 B
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
|
)
|
|
|
|
type Index struct {
|
|
}
|
|
|
|
func (i *Index) Index(c *gin.Context) {
|
|
c.Redirect(302, "/_admin/")
|
|
}
|
|
|
|
func (i *Index) ConfigJs(c *gin.Context) {
|
|
apiServer := global.Config.Rustdesk.ApiServer
|
|
magicQueryonline := global.Config.Rustdesk.WebclientMagicQueryonline
|
|
tmp := fmt.Sprintf(`localStorage.setItem('api-server', '%v');
|
|
const ws2_prefix = 'wc-';
|
|
localStorage.setItem(ws2_prefix+'api-server', '%v');
|
|
|
|
window.webclient_magic_queryonline = %d;
|
|
window.ws_host = '%v';
|
|
`, apiServer, apiServer, magicQueryonline, global.Config.Rustdesk.WsHost)
|
|
// tmp := `
|
|
//localStorage.setItem('api-server', "` + apiServer + `")
|
|
//const ws2_prefix = 'wc-'
|
|
//localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `")
|
|
//
|
|
//window.webclient_magic_queryonline = ` + magicQueryonline + ``
|
|
|
|
c.Header("Content-Type", "application/javascript")
|
|
c.String(200, tmp)
|
|
}
|