summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-09-08 02:23:18 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-09-08 19:58:25 +0200
commite591c3147e3c504611ff612e8918018125ffa2eb (patch)
treed4004f33ddc2c7f9f70d95d0244b93ac27b9eb76 /pkg
parentc2871f4aece61b939e0e6c8d7a94677fb055620a (diff)
[bug] pass json as bytes to go side
Diffstat (limited to 'pkg')
-rw-r--r--pkg/backend/api.go27
1 files changed, 24 insertions, 3 deletions
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) {