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

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

+ 2 - 0
config/rustdesk.go

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

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

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