diff --git a/go.mod b/go.mod index 6b9c3c6..738896f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module apigo.cc/gojs/service go 1.18 require ( - apigo.cc/gojs v0.0.9 + apigo.cc/gojs v0.0.12 apigo.cc/gojs/console v0.0.2 apigo.cc/gojs/http v0.0.3 apigo.cc/gojs/util v0.0.8 @@ -32,7 +32,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/shirou/gopsutil/v3 v3.24.5 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect - github.com/ssgo/tool v0.4.27 // indirect + github.com/ssgo/tool v0.4.28 // indirect github.com/tklauser/go-sysconf v0.3.14 // indirect github.com/tklauser/numcpus v0.9.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect diff --git a/service.go b/service.go index fd6d799..4c13e76 100644 --- a/service.go +++ b/service.go @@ -90,7 +90,7 @@ func initConfig(opt *gojs.Obj, logger *log.Logger, vm *goja.Runtime) { s.SetWorkPath(u.String(startPath)) } // 处理配置 - serviceConfig = Config{"Session", "Device", "Client", "userId", "", 3600, "auth failed", "verify failed", "too many requests", nil, "", map[string]string{}, map[string]string{}, map[string]string{}} + serviceConfig = Config{"Session", "Device", "Client", "id", "", 3600, "auth failed", "verify failed", "too many requests", nil, "", map[string]string{}, map[string]string{}, map[string]string{}} if errs := config.LoadConfig("service", &serviceConfig); errs != nil && len(errs) > 0 { panic(vm.NewGoError(errs[0])) } @@ -237,6 +237,9 @@ func init() { s.SetOutFilter(func(in map[string]any, request *s.Request, response *s.Response, out any, logger *log.Logger) (newOut any, isOver bool) { if strings.HasPrefix(response.Header().Get("Content-Type"), "text/html") { outStr := u.String(out) + if strings.Contains(outStr, "let _watchWS = null") { + return nil, false + } // 注入自动刷新的代码 outStr = strings.ReplaceAll(outStr, "", `