diff --git a/conf/config.yaml b/conf/config.yaml index ecef3ef..2befe9f 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -28,6 +28,7 @@ rustdesk: key: "" key-file: "./conf/data/id_ed25519.pub" personal: 1 + webclient-magic-queryonline: 0 logger: path: "./runtime/log.txt" level: "warn" #trace,debug,info,warn,error,fatal diff --git a/config/rustdesk.go b/config/rustdesk.go index 59056d4..f1903d1 100644 --- a/config/rustdesk.go +++ b/config/rustdesk.go @@ -11,6 +11,8 @@ type Rustdesk struct { Key string `mapstructure:"key"` KeyFile string `mapstructure:"key-file"` Personal int `mapstructure:"personal"` + //webclient-magic-queryonline + WebclientMagicQueryonline int `mapstructure:"webclient-magic-queryonline"` } func LoadKeyFile(rustdesk *Rustdesk) { diff --git a/http/controller/web/index.go b/http/controller/web/index.go index 8b6b326..af3b1b6 100644 --- a/http/controller/web/index.go +++ b/http/controller/web/index.go @@ -3,6 +3,7 @@ package web import ( "Gwen/global" "github.com/gin-gonic/gin" + "strconv" ) type Index struct { @@ -14,11 +15,13 @@ func (i *Index) Index(c *gin.Context) { func (i *Index) ConfigJs(c *gin.Context) { apiServer := global.Config.Rustdesk.ApiServer - + magicQueryonline := strconv.Itoa(global.Config.Rustdesk.WebclientMagicQueryonline) tmp := ` localStorage.setItem('api-server', "` + apiServer + `") const ws2_prefix = 'wc-' localStorage.setItem(ws2_prefix+'api-server', "` + apiServer + `") -` + +window.webclient_magic_queryonline = ` + magicQueryonline + `` + c.String(200, tmp) }