From e591c3147e3c504611ff612e8918018125ffa2eb Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Tue, 8 Sep 2020 02:23:18 +0200 Subject: [bug] pass json as bytes to go side --- pkg/backend/api.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/backend/api.go b/pkg/backend/api.go index 125f7f5..59b386b 100644 --- a/pkg/backend/api.go +++ b/pkg/backend/api.go @@ -4,6 +4,7 @@ package backend import ( "C" + "encoding/json" "log" "strconv" "unsafe" @@ -61,10 +62,30 @@ func SubscribeToEvent(event string, f unsafe.Pointer) { subscribe(event, f) } +type Providers struct { + Default string `json:"default"` + Data []InitOpts +} + type InitOpts struct { - Provider string - AppName string - SkipLaunch bool + Provider string `json:"name"` + AppName string `json:"applicationName"` + BinaryName string `json:"binaryName"` + Auth string `json:"auth"` + ProviderURL string `json:"providerURL"` + TosURL string `json:"tosURL"` + HelpURL string `json:"helpURL"` + AskForDonations bool `json:"askForDonations"` + SkipLaunch bool +} + +func InitOptsFromJSON(provider, providersJSON string) *InitOpts { + opts := InitOpts{} + err := json.Unmarshal([]byte(providersJSON), &opts) + if err != nil { + log.Println("ERROR: %v", err) + } + return &opts } func InitializeBitmaskContext(opts *InitOpts) { -- cgit v1.2.3