summaryrefslogtreecommitdiff
path: root/pkg/backend/bitmask.go
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-16 21:28:48 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-26 12:12:41 +0200
commitc17b5f6f7b6b28c890764688ff5e966ecebece63 (patch)
tree4c9931b10e7cddd9050f76aff95205dbf04d6d26 /pkg/backend/bitmask.go
parenta18e61aa1be37aa568552c69fbd743d25498b9bb (diff)
[feat] re-implement donation reminders
first pass on giving functionality to the donation reminder
Diffstat (limited to 'pkg/backend/bitmask.go')
-rw-r--r--pkg/backend/bitmask.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkg/backend/bitmask.go b/pkg/backend/bitmask.go
index 07d27ea..8fd2367 100644
--- a/pkg/backend/bitmask.go
+++ b/pkg/backend/bitmask.go
@@ -5,6 +5,7 @@ import (
"os"
"0xacab.org/leap/bitmask-vpn/pkg/bitmask"
+ "0xacab.org/leap/bitmask-vpn/pkg/config"
)
func initializeBitmask() {
@@ -19,6 +20,7 @@ func initializeBitmask() {
log.Println("error: cannot initialize bitmask")
}
ctx.bm = b
+ ctx.cfg = config.ParseConfig()
}
func startVPN() {
@@ -36,16 +38,25 @@ func stopVPN() {
}
}
+func wantDonations() bool {
+ if config.AskForDonations == "true" {
+ return true
+ }
+ return false
+}
+
// initializeContext initializes an empty connStatus and assigns it to the
// global ctx holder. This is expected to be called only once, so the public
// api uses the sync.Once primitive to call this.
func initializeContext(provider, appName string) {
var st status = off
ctx = &connectionCtx{
- AppName: appName,
- Provider: provider,
- Donate: false,
- Status: st,
+ AppName: appName,
+ Provider: provider,
+ DonateURL: config.DonateURL,
+ AskForDonations: wantDonations(),
+ DonateDialog: false,
+ Status: st,
}
go trigger(OnStatusChanged)
initializeBitmask()