Просмотр исходного кода

feat(webclient): add new query_online function

There may be a loss of performance
Therefore, it is not enabled by default
lejianwen 1 год назад
Родитель
Сommit
88765302e8
3 измененных файлов с 8 добавлено и 2 удалено
  1. 1 0
      conf/config.yaml
  2. 2 0
      config/rustdesk.go
  3. 5 2
      http/controller/web/index.go

+ 1 - 0
conf/config.yaml

@@ -28,6 +28,7 @@ rustdesk:
28
   key: ""
28
   key: ""
29
   key-file: "./conf/data/id_ed25519.pub"
29
   key-file: "./conf/data/id_ed25519.pub"
30
   personal: 1
30
   personal: 1
31
+  webclient-magic-queryonline: 0
31
 logger:
32
 logger:
32
   path: "./runtime/log.txt"
33
   path: "./runtime/log.txt"
33
   level: "warn" #trace,debug,info,warn,error,fatal
34
   level: "warn" #trace,debug,info,warn,error,fatal

+ 2 - 0
config/rustdesk.go

@@ -11,6 +11,8 @@ type Rustdesk struct {
11
 	Key         string `mapstructure:"key"`
11
 	Key         string `mapstructure:"key"`
12
 	KeyFile     string `mapstructure:"key-file"`
12
 	KeyFile     string `mapstructure:"key-file"`
13
 	Personal    int    `mapstructure:"personal"`
13
 	Personal    int    `mapstructure:"personal"`
14
+	//webclient-magic-queryonline
15
+	WebclientMagicQueryonline int `mapstructure:"webclient-magic-queryonline"`
14
 }
16
 }
15
 
17
 
16
 func LoadKeyFile(rustdesk *Rustdesk) {
18
 func LoadKeyFile(rustdesk *Rustdesk) {

+ 5 - 2
http/controller/web/index.go

@@ -3,6 +3,7 @@ package web
3
 import (
3
 import (
4
 	"Gwen/global"
4
 	"Gwen/global"
5
 	"github.com/gin-gonic/gin"
5
 	"github.com/gin-gonic/gin"
6
+	"strconv"
6
 )
7
 )
7
 
8
 
8
 type Index struct {
9
 type Index struct {
@@ -14,11 +15,13 @@ func (i *Index) Index(c *gin.Context) {
14
 
15
 
15
 func (i *Index) ConfigJs(c *gin.Context) {
16
 func (i *Index) ConfigJs(c *gin.Context) {
16
 	apiServer := global.Config.Rustdesk.ApiServer
17
 	apiServer := global.Config.Rustdesk.ApiServer
17
-
18
+	magicQueryonline := strconv.Itoa(global.Config.Rustdesk.WebclientMagicQueryonline)
18
 	tmp := `
19
 	tmp := `
19
 localStorage.setItem('api-server', "` + apiServer + `")
20
 localStorage.setItem('api-server', "` + apiServer + `")
20
 const ws2_prefix = 'wc-'
21
 const ws2_prefix = 'wc-'
21
 localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `")
22
 localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `")
22
-`
23
+
24
+window.webclient_magic_queryonline = ` + magicQueryonline + ``
25
+
23
 	c.String(200, tmp)
26
 	c.String(200, tmp)
24
 }
27
 }