2019-02-01 07:28:17 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "log"
|
2019-05-24 02:04:37 -05:00
|
|
|
import "fmt"
|
2019-05-06 20:57:59 -05:00
|
|
|
import "os"
|
2019-05-06 19:42:59 -05:00
|
|
|
import "time"
|
2019-05-23 13:33:30 -05:00
|
|
|
import "os/user"
|
2019-05-23 18:38:51 -05:00
|
|
|
import "runtime"
|
|
|
|
import "runtime/debug"
|
2019-05-24 20:41:31 -05:00
|
|
|
import "github.com/golang/protobuf/jsonpb"
|
|
|
|
// import "github.com/golang/protobuf/proto"
|
|
|
|
|
|
|
|
import "git.wit.com/wit/gui"
|
|
|
|
import pb "git.wit.com/wit/witProtobuf"
|
2019-02-01 07:28:17 -06:00
|
|
|
|
2019-05-23 11:47:48 -05:00
|
|
|
import "github.com/gobuffalo/packr"
|
2019-05-24 17:35:57 -05:00
|
|
|
import "github.com/davecgh/go-spew/spew"
|
2019-02-01 07:28:17 -06:00
|
|
|
|
2019-05-24 03:17:37 -05:00
|
|
|
// will try to get this hosts FQDN
|
|
|
|
import "github.com/Showmax/go-fqdn"
|
|
|
|
|
2019-05-23 02:11:49 -05:00
|
|
|
var GITCOMMIT string // this is passed in as an ldflag
|
|
|
|
var GOVERSION string // this is passed in as an ldflag
|
2019-05-24 02:21:15 -05:00
|
|
|
var BUILDTIME string // this is passed in as an ldflag
|
2019-05-23 02:11:49 -05:00
|
|
|
|
2019-05-24 19:39:05 -05:00
|
|
|
var pbC *pb.Config
|
|
|
|
|
2019-02-01 07:28:17 -06:00
|
|
|
// reminder to use this for JSON
|
|
|
|
// https://github.com/tidwall/gjson
|
|
|
|
// value := gjson.Get(json, "name.last")
|
|
|
|
// println(value.String())
|
|
|
|
// value := gjson.Get(json, friends.#[last=="Murphy"].first)
|
|
|
|
|
|
|
|
// use mergo to merge structs
|
|
|
|
// import "github.com/imdario/mergo"
|
|
|
|
// mergo.Merge(&dest, src)
|
|
|
|
|
|
|
|
// always sorted slice (new project)
|
|
|
|
// https://github.com/yaa110/sslice
|
|
|
|
|
2019-05-12 08:18:06 -05:00
|
|
|
// several smart slice functions (new project. April 2019)
|
|
|
|
// https://github.com/elliotchance/pie
|
|
|
|
|
2019-05-23 13:33:30 -05:00
|
|
|
func onExit(err error) {
|
2019-05-12 01:21:57 -05:00
|
|
|
log.Println("Sleep for 1 second")
|
|
|
|
time.Sleep(1 * 1000 * 1000 * 1000)
|
|
|
|
|
2019-05-24 21:03:15 -05:00
|
|
|
filename := pbC.Filename
|
2019-05-23 15:14:57 -05:00
|
|
|
if (filename == "") {
|
|
|
|
log.Println("NOT SAVING CONFIG FILE")
|
|
|
|
} else {
|
2019-05-24 21:03:15 -05:00
|
|
|
marshaler := &jsonpb.Marshaler{}
|
|
|
|
stuff, _ := marshaler.MarshalToString(pbC)
|
|
|
|
log.Println(stuff)
|
|
|
|
|
|
|
|
// TODO: Fix this
|
|
|
|
log.Println("FIXME: NOT SAVING CONFIG FILE AS:", filename)
|
|
|
|
/*
|
2019-05-23 15:14:57 -05:00
|
|
|
f, err := os.Create(filename + ".yaml")
|
|
|
|
if err == nil {
|
2019-05-24 21:03:15 -05:00
|
|
|
// DumpTo(f, "yaml")
|
2019-05-23 15:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
f, err = os.Create(filename)
|
|
|
|
if err == nil {
|
2019-05-24 21:03:15 -05:00
|
|
|
// DumpTo(f, "json")
|
2019-05-23 15:14:57 -05:00
|
|
|
}
|
2019-05-24 21:03:15 -05:00
|
|
|
*/
|
2019-05-12 01:21:57 -05:00
|
|
|
}
|
|
|
|
|
2019-05-23 13:33:30 -05:00
|
|
|
if (err != nil) {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2019-05-12 01:21:57 -05:00
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
|
2019-05-24 13:32:26 -05:00
|
|
|
var packrBox packr.Box
|
|
|
|
|
2019-05-10 03:21:32 -05:00
|
|
|
func main() {
|
2019-05-23 11:47:48 -05:00
|
|
|
// This puts all the files in that directory in the binary
|
|
|
|
// This directory includes the default config file if there is not already one
|
2019-05-24 13:32:26 -05:00
|
|
|
packrBox = packr.NewBox("./resources")
|
|
|
|
defaultConfig, _ := packrBox.FindString("cloud.json")
|
2019-05-23 11:47:48 -05:00
|
|
|
|
2019-05-24 19:39:05 -05:00
|
|
|
pbC = pb.MakeDefaultConfig()
|
|
|
|
spew.Dump(pbC)
|
|
|
|
|
2019-05-24 20:41:31 -05:00
|
|
|
// This will parse the command line and config file
|
|
|
|
parseConfig(defaultConfig)
|
|
|
|
|
2019-05-24 20:17:53 -05:00
|
|
|
for key, foo := range pbC.Accounts {
|
|
|
|
log.Println("account = ", key, foo)
|
|
|
|
}
|
|
|
|
gui.Data.Config = pbC
|
|
|
|
// onExit(nil)
|
|
|
|
|
2019-05-11 09:53:32 -05:00
|
|
|
initChannel()
|
|
|
|
go processEvents()
|
|
|
|
|
2019-05-12 08:18:06 -05:00
|
|
|
go gorillaDial("v000185.testing.com.customers.wprod.wit.com:9000")
|
2019-05-23 00:33:16 -05:00
|
|
|
go watchGUI()
|
2019-05-07 16:54:08 -05:00
|
|
|
|
2019-05-23 13:33:30 -05:00
|
|
|
user, err := user.Current()
|
|
|
|
if err != nil {
|
|
|
|
onExit(err)
|
|
|
|
}
|
|
|
|
|
2019-05-24 19:39:05 -05:00
|
|
|
gui.Data.Width = int(pbC.Width)
|
|
|
|
gui.Data.Height = int(pbC.Height)
|
2019-05-24 00:47:26 -05:00
|
|
|
|
|
|
|
// TODO: figure out the hostname the right way
|
2019-05-24 03:17:37 -05:00
|
|
|
hostname := fqdn.Get()
|
|
|
|
log.Println("fqdn.Get() = ", hostname)
|
|
|
|
gui.Data.Hostname = hostname
|
2019-05-24 00:47:26 -05:00
|
|
|
gui.Data.IPv6 = "2604:bbc0:3:3:0:10:0:1004"
|
|
|
|
|
2019-05-24 15:43:22 -05:00
|
|
|
gui.Data.Version = "v0.7"
|
2019-05-23 02:11:49 -05:00
|
|
|
gui.Data.GitCommit = GITCOMMIT
|
|
|
|
gui.Data.GoVersion = GOVERSION
|
2019-05-24 02:21:15 -05:00
|
|
|
gui.Data.Buildtime = BUILDTIME
|
2019-05-24 15:43:22 -05:00
|
|
|
gui.Data.MouseClick = mainButtonClick
|
2019-05-23 13:33:30 -05:00
|
|
|
gui.Data.HomeDir = user.HomeDir
|
2019-05-24 11:04:36 -05:00
|
|
|
|
|
|
|
// Set output debugging level
|
2019-05-24 21:03:15 -05:00
|
|
|
gui.Data.Debug = pbC.Debugging
|
|
|
|
gui.Data.DebugTable = pbC.Debugtable
|
2019-05-23 15:14:57 -05:00
|
|
|
log.Println("gui.Data.Debug = ", gui.Data.Debug)
|
2019-05-24 11:04:36 -05:00
|
|
|
log.Println("gui.Data.DebugTable = ", gui.Data.DebugTable)
|
2019-05-23 13:33:30 -05:00
|
|
|
|
|
|
|
// Current User
|
|
|
|
log.Println("Hi " + user.Name + " (id: " + user.Uid + ")")
|
|
|
|
log.Println("Username: " + user.Username)
|
|
|
|
log.Println("Home Dir: " + user.HomeDir)
|
|
|
|
|
|
|
|
// Get "Real" User under sudo.
|
|
|
|
// More Info: https://stackoverflow.com/q/29733575/402585
|
|
|
|
log.Println("Real User: " + os.Getenv("SUDO_USER"))
|
2019-05-23 00:33:16 -05:00
|
|
|
|
2019-05-10 03:21:32 -05:00
|
|
|
// make this the main loop in an attempt to figure out the crashes
|
|
|
|
// do not change this until the GUI is stable
|
2019-05-23 00:33:16 -05:00
|
|
|
gui.GoMainWindow()
|
|
|
|
}
|
2019-05-10 03:21:32 -05:00
|
|
|
|
2019-05-24 15:43:22 -05:00
|
|
|
func mainButtonClick(b *gui.ButtonMap) {
|
|
|
|
log.Println("mainButtonClick() b =", b)
|
2019-05-09 08:52:51 -05:00
|
|
|
|
2019-05-24 21:29:28 -05:00
|
|
|
|
2019-05-23 15:45:11 -05:00
|
|
|
if (b == nil) {
|
2019-05-24 15:43:22 -05:00
|
|
|
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
|
|
|
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
|
|
|
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
2019-05-23 15:45:11 -05:00
|
|
|
} else {
|
2019-05-24 21:29:28 -05:00
|
|
|
gui.Data.Current = b.Account
|
|
|
|
log.Println("mainButtonClick() setting current account = ", b.Account)
|
|
|
|
|
2019-05-24 21:45:19 -05:00
|
|
|
log.Println("main() BACK IN CONTROL PANEL CODE (button =", b, ")")
|
|
|
|
if (b.Action == "BACK") {
|
2019-05-23 15:45:11 -05:00
|
|
|
gui.Data.State = "splash"
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "QUIT") {
|
2019-05-23 15:45:11 -05:00
|
|
|
onExit(nil)
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "CREATE") {
|
2019-05-24 15:43:22 -05:00
|
|
|
log.Println("TRY TO ADD A NEW VIRTUAL MACHINE")
|
|
|
|
log.Println("\tTRIGGER CREATE VM")
|
|
|
|
gui.Data.State = "CREATE"
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "CONFIG") {
|
2019-05-24 13:32:26 -05:00
|
|
|
log.Println("TRY TO LOAD DEFAULT CONFIG")
|
2019-05-24 21:03:15 -05:00
|
|
|
defaultConfig, _ := packrBox.FindString("protobuf-config.json")
|
2019-05-24 13:32:26 -05:00
|
|
|
log.Println("defaultConfig =", defaultConfig)
|
2019-05-24 21:03:15 -05:00
|
|
|
log.Println("NEED TO UNMARSHAL THIS HERE")
|
|
|
|
log.Println("NEED TO UNMARSHAL THIS HERE")
|
|
|
|
log.Println("NEED TO UNMARSHAL THIS HERE")
|
|
|
|
var newpb *pb.Config
|
|
|
|
err := jsonpb.UnmarshalString(defaultConfig, newpb)
|
|
|
|
log.Println("ATTEMTED TO UNMARSHAL err =", err)
|
|
|
|
spew.Dump(newpb)
|
2019-05-24 13:32:26 -05:00
|
|
|
gui.Data.State = "done"
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "DEBUG") {
|
2019-05-23 18:38:51 -05:00
|
|
|
log.Println("debug.PrintStack() (SHOULD BE JUST THIS goroutine)")
|
|
|
|
debug.PrintStack()
|
|
|
|
|
|
|
|
log.Println("ATTEMPT FULL STACK DUMP")
|
|
|
|
buf := make([]byte, 1<<16)
|
|
|
|
runtime.Stack(buf, true)
|
|
|
|
log.Printf("%s", buf)
|
|
|
|
log.Println("FINISHED FULL STACK DUMP")
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "ADD") {
|
2019-05-23 15:45:11 -05:00
|
|
|
log.Println("\tSHOULD ADD ACCOUNT HERE")
|
2019-05-24 20:17:53 -05:00
|
|
|
/*
|
2019-05-23 15:45:11 -05:00
|
|
|
if (gui.Data.AccNick != "") {
|
|
|
|
config.Set("accounts." + gui.Data.AccNick + ".username", gui.Data.AccUser)
|
|
|
|
config.Set("accounts." + gui.Data.AccNick + ".password", gui.Data.AccPass)
|
|
|
|
config.Set("accounts." + gui.Data.AccNick + ".hostname", "v000185.testing.com.customers.wprod.wit.com")
|
|
|
|
}
|
2019-05-24 20:17:53 -05:00
|
|
|
*/
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "LOGIN") {
|
2019-05-24 00:47:26 -05:00
|
|
|
log.Println("\tTRIGGER LOGIN ACCOUNT")
|
|
|
|
gui.Data.State = "SEND LOGIN"
|
|
|
|
count := 0
|
|
|
|
for {
|
|
|
|
log.Println("Sleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
|
|
|
if (gui.Data.State == "NEW PROTOBUF") {
|
|
|
|
if (currentMessage == nil) {
|
|
|
|
gui.SocketError()
|
|
|
|
gui.Data.State = "done"
|
|
|
|
} else {
|
2019-05-24 02:04:37 -05:00
|
|
|
log.Println("LOGIN currentMessage =", currentMessage)
|
|
|
|
if (currentMessage.Type == pb.Event_OK) {
|
|
|
|
log.Println("LOGIN WAS OK!")
|
|
|
|
log.Println("LOGIN WAS OK!")
|
|
|
|
log.Println("LOGIN WAS OK!")
|
2019-05-24 21:45:19 -05:00
|
|
|
msg := "On account " + b.Account.Nick + "\n"
|
2019-05-24 02:21:15 -05:00
|
|
|
gui.ErrorWindow("Login OK", msg)
|
2019-05-24 02:04:37 -05:00
|
|
|
}
|
|
|
|
if (currentMessage.Type == pb.Event_FAIL) {
|
|
|
|
log.Println("LOGIN FAILED")
|
|
|
|
log.Println("LOGIN FAILED")
|
|
|
|
log.Println("LOGIN FAILED")
|
2019-05-24 21:45:19 -05:00
|
|
|
msg := "On account " + b.Account.Nick + "\n"
|
2019-05-24 02:04:37 -05:00
|
|
|
msg += "pb.Comment = " + currentMessage.Comment + "\n"
|
|
|
|
msg += "pb.Id = " + fmt.Sprintf("%d", currentMessage.Id) + "\n"
|
|
|
|
msg += "pb.Email = " + currentMessage.Email + "\n"
|
|
|
|
msg += "pb.Username = " + currentMessage.Username + "\n"
|
|
|
|
gui.ErrorWindow("Login Failed", msg)
|
2019-05-24 00:47:26 -05:00
|
|
|
}
|
|
|
|
currentMessage = nil
|
|
|
|
gui.Data.State = "done"
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
count += 1
|
|
|
|
if (count > 10) {
|
|
|
|
log.Println("ERROR: waited too long for a resposne")
|
|
|
|
currentMessage = nil
|
|
|
|
gui.Data.State = "done"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
2019-05-24 21:45:19 -05:00
|
|
|
} else if (b.Action == "SHOW") {
|
2019-05-23 18:38:51 -05:00
|
|
|
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
2019-05-23 21:36:20 -05:00
|
|
|
gui.Data.State = "SEND WEBSOCKET"
|
|
|
|
count := 0
|
2019-05-23 18:38:51 -05:00
|
|
|
for {
|
|
|
|
log.Println("Sleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
|
|
|
if (gui.Data.State == "NEW PROTOBUF") {
|
|
|
|
if (currentMessage == nil) {
|
|
|
|
gui.SocketError()
|
2019-05-23 19:43:41 -05:00
|
|
|
gui.Data.State = "done"
|
2019-05-23 18:38:51 -05:00
|
|
|
} else {
|
|
|
|
count := countVMS(currentMessage)
|
|
|
|
log.Println("SHOW VMS currentMessage =", currentMessage)
|
|
|
|
log.Println("SHOW VMS count =", count)
|
|
|
|
if (count != 0) {
|
2019-05-24 21:45:19 -05:00
|
|
|
name := "Virtual Machines (" + "FIXME" + ")"
|
2019-05-23 19:43:41 -05:00
|
|
|
mh := gui.AddVmsTab(name, count)
|
2019-05-23 18:38:51 -05:00
|
|
|
ReadReceivedData(currentMessage, mh)
|
|
|
|
}
|
|
|
|
currentMessage = nil
|
2019-05-23 19:43:41 -05:00
|
|
|
gui.Data.State = "done"
|
2019-05-23 18:38:51 -05:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2019-05-23 21:36:20 -05:00
|
|
|
count += 1
|
|
|
|
if (count > 10) {
|
|
|
|
log.Println("ERROR: waited too long for a resposne")
|
|
|
|
currentMessage = nil
|
|
|
|
gui.Data.State = "done"
|
|
|
|
return
|
|
|
|
}
|
2019-05-23 18:38:51 -05:00
|
|
|
}
|
|
|
|
}
|
2019-05-23 00:33:16 -05:00
|
|
|
}
|
|
|
|
if (gui.Data.State == "splash") {
|
|
|
|
gui.ShowAccountQuestionTab()
|
|
|
|
gui.Data.State = "account1"
|
|
|
|
return
|
|
|
|
} else if (gui.Data.State == "account1") {
|
|
|
|
gui.ShowAccountTab()
|
|
|
|
gui.Data.State = "main"
|
|
|
|
} else if (gui.Data.State == "main") {
|
|
|
|
gui.ShowMainTab()
|
|
|
|
gui.Data.State = "done"
|
2019-05-23 15:45:11 -05:00
|
|
|
} else if (gui.Data.State == "QUIT") {
|
|
|
|
onExit(nil)
|
2019-05-23 00:33:16 -05:00
|
|
|
}
|
|
|
|
}
|
2019-05-09 08:52:51 -05:00
|
|
|
|
2019-05-24 21:03:15 -05:00
|
|
|
func getToken() string {
|
|
|
|
if (gui.Data.Current == nil) {
|
|
|
|
log.Println("gui.Data.Current == nil")
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
log.Println("gui.Data.Current.Token = ", gui.Data.Current.Token)
|
|
|
|
return gui.Data.Current.Token
|
|
|
|
}
|
|
|
|
|
2019-05-24 00:47:26 -05:00
|
|
|
// this watches the GUI primarily to process protobuf's
|
2019-05-23 00:33:16 -05:00
|
|
|
func watchGUI() {
|
2019-05-23 15:27:05 -05:00
|
|
|
count := 0
|
2019-05-23 00:33:16 -05:00
|
|
|
|
2019-05-24 21:45:19 -05:00
|
|
|
/*
|
2019-05-24 19:39:05 -05:00
|
|
|
// This is how you marshal into JSON from a Protobuf
|
|
|
|
event := pb.MakeGetEvent()
|
2019-05-24 21:03:15 -05:00
|
|
|
if (gui.Data.Current == nil) {
|
|
|
|
log.Println("gui.Data.Current == nil")
|
|
|
|
} else {
|
|
|
|
event.Token = gui.Data.Current.Token
|
|
|
|
}
|
|
|
|
|
2019-05-24 19:39:05 -05:00
|
|
|
marshaler := &jsonpb.Marshaler{}
|
|
|
|
stuff, _ := marshaler.MarshalToString(event)
|
|
|
|
log.Println(stuff)
|
2019-05-24 21:45:19 -05:00
|
|
|
*/
|
2019-05-24 21:03:15 -05:00
|
|
|
|
2019-05-24 19:39:05 -05:00
|
|
|
// also:
|
|
|
|
// var j *bytes.Buffer
|
|
|
|
// marshaler.Marshal(j, event)
|
|
|
|
// w.Write(j.Bytes())
|
|
|
|
|
2019-05-23 00:33:16 -05:00
|
|
|
for {
|
2019-05-23 15:27:05 -05:00
|
|
|
if (count > 10) {
|
|
|
|
log.Println("Sleep() in watchGUI() gui.Data.State =", gui.Data.State)
|
|
|
|
count = 0
|
|
|
|
}
|
|
|
|
count += 1
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
2019-05-23 00:33:16 -05:00
|
|
|
|
2019-05-23 21:36:20 -05:00
|
|
|
if (gui.Data.State == "SEND WEBSOCKET") {
|
2019-05-24 21:45:19 -05:00
|
|
|
log.Println("\tTRIGGERING WEBSOCKET HERE on AccNick =")
|
|
|
|
log.Println("\tTRIGGERING WEBSOCKET HERE on AccNick =")
|
|
|
|
log.Println("\tTRIGGERING WEBSOCKET HERE on AccNick =")
|
2019-05-23 21:36:20 -05:00
|
|
|
|
|
|
|
event := pb.MakeGetEvent()
|
2019-05-24 21:03:15 -05:00
|
|
|
event.Token = getToken()
|
2019-05-23 21:36:20 -05:00
|
|
|
log.Println("\tTRIGGERING WEBSOCKET HERE with event.Token =", event.Token)
|
|
|
|
|
2019-05-23 21:44:10 -05:00
|
|
|
gorillaSendProtobuf(event)
|
|
|
|
gui.Data.State = "READ PROTOBUF"
|
2019-05-23 18:38:51 -05:00
|
|
|
}
|
2019-05-24 00:47:26 -05:00
|
|
|
if (gui.Data.State == "SEND LOGIN") {
|
2019-05-24 21:45:19 -05:00
|
|
|
log.Println("\tTRIGGERING LOGIN HERE on AccNick =")
|
|
|
|
log.Println("\tTRIGGERING LOGIN HERE on AccNick =")
|
|
|
|
log.Println("\tTRIGGERING LOGIN HERE on AccNick =")
|
2019-05-24 00:47:26 -05:00
|
|
|
|
|
|
|
event := pb.MakeLoginEvent()
|
2019-05-24 21:29:28 -05:00
|
|
|
event.Token = getToken()
|
|
|
|
event.Username = gui.Data.Current.Username
|
2019-05-24 00:47:26 -05:00
|
|
|
log.Println("\tTRIGGERING LOGIN HERE with event.Token =", event.Token)
|
|
|
|
gorillaSendProtobuf(event)
|
|
|
|
gui.Data.State = "READ PROTOBUF"
|
|
|
|
}
|
2019-05-24 15:43:22 -05:00
|
|
|
if (gui.Data.State == "CREATE") {
|
|
|
|
log.Println("\tTRIGGERING CREATE HERE")
|
|
|
|
|
|
|
|
event := pb.MakeAddVmEvent()
|
2019-05-24 21:29:28 -05:00
|
|
|
event.Username = gui.Data.Current.Username
|
|
|
|
event.Token = gui.Data.Current.Token
|
2019-05-24 15:43:22 -05:00
|
|
|
log.Println("\tTRIGGERING LOGIN HERE with event.Token =", event.Token)
|
|
|
|
|
2019-05-24 17:35:57 -05:00
|
|
|
spew.Dump(event)
|
2019-05-24 15:43:22 -05:00
|
|
|
gorillaSendProtobuf(event)
|
2019-05-24 17:35:57 -05:00
|
|
|
|
|
|
|
log.Println("\tEVENT SENT TO GORILLA WEBSOCKET")
|
2019-05-24 15:43:22 -05:00
|
|
|
gui.Data.State = "READ PROTOBUF"
|
|
|
|
}
|
2019-05-23 00:33:16 -05:00
|
|
|
if (gui.Data.State == "kill") {
|
|
|
|
log.Println("gui.State = kill")
|
|
|
|
log.Println("gui.State = kill")
|
|
|
|
log.Println("gui.State = kill")
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
2019-05-23 15:27:05 -05:00
|
|
|
if (gui.Data.State == "splash") {
|
2019-05-24 21:03:15 -05:00
|
|
|
for key, _ := range pbC.Accounts {
|
|
|
|
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Nick = ", pbC.Accounts[key].Nick)
|
|
|
|
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Username = ", pbC.Accounts[key].Username)
|
2019-05-23 15:27:05 -05:00
|
|
|
log.Println("SETTING gui.State = main")
|
|
|
|
gui.Data.State = "main";
|
|
|
|
}
|
|
|
|
}
|
2019-05-07 16:54:08 -05:00
|
|
|
}
|
2019-05-07 07:02:39 -05:00
|
|
|
}
|