From d656828a0f210561020a7ae742041d19cc44b624 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 9 Sep 2025 19:15:31 -0500 Subject: [PATCH] used this to fix autogenpb 'http' functions --- http.go | 16 +++++++--------- machine.proto | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/http.go b/http.go index fae1ff7..f2a470c 100644 --- a/http.go +++ b/http.go @@ -37,10 +37,10 @@ func (m *Machine) HttpPostMachine(url string) ([]byte, error) { log.Info("WTF. check == nil") } // log.Info("good? check.hostname =", m.Hostname) - return m.HttpPost(url, msg) + return m.HttpPostOld(url, msg) } -func (m *Machine) HttpPost(url string, data []byte) ([]byte, error) { +func (m *Machine) HttpPostOld(url string, data []byte) ([]byte, error) { var err error var req *http.Request @@ -49,13 +49,11 @@ func (m *Machine) HttpPost(url string, data []byte) ([]byte, error) { usr, _ := user.Current() req.Header.Set("author", usr.Username) - /* - if f.Machine == nil { - // run f.InitMachine() here? - log.Info("you must run f.InitMachine()") - return nil, fmt.Errorf("you must run f.InitMachine()") - } - */ + // if f.Machine == nil { + // // run f.InitMachine() here? + // log.Info("you must run f.InitMachine()") + // return nil, fmt.Errorf("you must run f.InitMachine()") + // } req.Header.Set("hostname", m.Hostname) client := &http.Client{} diff --git a/machine.proto b/machine.proto index c0f6c48..9cca303 100644 --- a/machine.proto +++ b/machine.proto @@ -7,7 +7,7 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time // global settings for autogenpb `autogenpb:mutex` -message Machine { // `autogenpb:marshal` +message Machine { // `autogenpb:marshal` `autogenpb:http` string hostname = 1; // `autogenpb:unique` `autogenpb:sort` int64 memory = 2; int64 cpus = 3; @@ -23,7 +23,7 @@ message Machine { // `autogenpb:marshal` string upgradeCmd = 13; // upgrade cmd } -message Machines { // `autogenpb:marshal` `autogenpb:gui` +message Machines { // `autogenpb:marshal` `autogenpb:gui` `autogenpb:http` string uuid = 1; // `autogenpb:uuid:b57e7fac-a8fc-4949-9d50-fa38312dec87` string version = 2; // `autogenpb:version:v0.0.1` repeated Machine machines = 3;