Separate the window sentence from the wrapped error so a bad certificate file is not reported as a key mismatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 15:01:38 +02:00
co-authored by Cursor
parent a405048f23
commit e642b24be0
17 changed files with 842 additions and 742 deletions
+11 -10
View File
@@ -2,8 +2,8 @@ package station
import (
"bytes"
jsonv2 "encoding/json/v2"
"golang.org/x/sys/unix"
)
@@ -14,23 +14,23 @@ const (
SoftwareVersion = "1.0.0"
)
type nodeSoftware struct {
type softwareIdentity struct {
SW string `json:"sw"`
SWVer string `json:"swVer"`
ProjVer string `json:"projVer"`
MachineArch string `json:"machineArch,omitempty"`
MachineArch string `json:"machineArch,omitzero"`
}
func softwareIdentityBody() ([]byte, error) {
raw, err := marshalNode(false)
raw, err := marshalIdentity(false)
if err != nil {
return nil, err
}
return appendString(nil, string(raw)), nil
}
func nodeInfoV3(iv, key []byte) ([]byte, error) {
raw, err := marshalNode(true)
func identityV3(iv, key []byte) ([]byte, error) {
raw, err := marshalIdentity(true)
if err != nil {
return nil, err
}
@@ -39,21 +39,22 @@ func nodeInfoV3(iv, key []byte) ([]byte, error) {
return appendString(body, string(raw)), nil
}
func marshalNode(arch bool) ([]byte, error) {
info := nodeSoftware{
func marshalIdentity(arch bool) ([]byte, error) {
info := softwareIdentity{
SW: SoftwareName,
SWVer: SoftwareVersion,
ProjVer: SoftwareVersion,
}
if arch {
if name, ok := machineArch(); ok {
if name, ok := MachineArch(); ok {
info.MachineArch = name
}
}
return jsonv2.Marshal(info)
}
func machineArch() (string, bool) {
// MachineArch is the hardware name from uname, when it can be read.
func MachineArch() (string, bool) {
var u unix.Utsname
if err := unix.Uname(&u); err != nil {
return "", false