diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2019-10-10 16:33:42 -0600 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2019-10-11 16:05:47 -0600 |
commit | a8e1ad2617c36a493b317c81e96f7c1bdcc1cd29 (patch) | |
tree | 0ef81ccc9f218f01fd85cf429d407f4c8db0b3f7 | |
parent | 267b606e7dfcc9af3b2f0c2bd75f4517fdaac7f7 (diff) |
[feat] donate menuitem is configurable
-rw-r--r-- | branding/config/vendor.conf | 2 | ||||
-rw-r--r-- | branding/scripts/provider.py | 3 | ||||
-rwxr-xr-x | branding/scripts/vendorize.py | 2 | ||||
-rw-r--r-- | branding/templates/bitmaskvpn/config.go | 1 | ||||
-rw-r--r-- | pkg/config/config.go | 3 | ||||
-rw-r--r-- | pkg/systray/systray.go | 12 |
6 files changed, 19 insertions, 4 deletions
diff --git a/branding/config/vendor.conf b/branding/config/vendor.conf index c68213e..1aed093 100644 --- a/branding/config/vendor.conf +++ b/branding/config/vendor.conf @@ -39,7 +39,7 @@ helpURL = https://calyx.net/support geolocationAPI = https://api.black.riseup.net:9001/json -askForDonations = true +askForDonations = false donateURL = http://example.org [demo] diff --git a/branding/scripts/provider.py b/branding/scripts/provider.py index 867007e..7455556 100644 --- a/branding/scripts/provider.py +++ b/branding/scripts/provider.py @@ -20,7 +20,8 @@ def getProviderData(provider, config): keys = ('name', 'applicationName', 'binaryName', 'providerURL', 'tosURL', 'helpURL', - 'donateURL', 'apiURL', 'geolocationAPI', 'caCertString') + 'askForDonations', 'donateURL', 'apiURL', + 'geolocationAPI', 'caCertString') for value in keys: d[value] = c.get(value) diff --git a/branding/scripts/vendorize.py b/branding/scripts/vendorize.py index 59edae0..ba248b0 100755 --- a/branding/scripts/vendorize.py +++ b/branding/scripts/vendorize.py @@ -10,7 +10,7 @@ from provider import getDefaultProvider from provider import getProviderData OUTFILE = 'config.go' -INFILE = '../templates/golang/config.go' +INFILE = '../templates/bitmaskvpn/config.go' CONFIGFILE = '../config/vendor.conf' SCRIPT_NAME = 'vendorize' diff --git a/branding/templates/bitmaskvpn/config.go b/branding/templates/bitmaskvpn/config.go index 67908c0..97b4617 100644 --- a/branding/templates/bitmaskvpn/config.go +++ b/branding/templates/bitmaskvpn/config.go @@ -11,6 +11,7 @@ const ( ApplicationName = "$applicationName" BinaryName = "$binaryName" DonateURL = "$donateURL" + AskForDonations = "$askForDonations" HelpURL = "$helpURL" TosURL = "$tosURL" APIURL = "$apiURL" diff --git a/pkg/config/config.go b/pkg/config/config.go index af1287c..33636ae 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,6 +1,6 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by vendorize.py -// At 2019-08-16 12:44:37 +// At 2019-10-11 16:05:25 package config @@ -11,6 +11,7 @@ const ( ApplicationName = "RiseupVPN" BinaryName = "riseup-vpn" DonateURL = "https://riseup.net/donate" + AskForDonations = "true" HelpURL = "https://riseup.net/support" TosURL = "https://riseup.net/tos" APIURL = "https://api.black.riseup.net/" diff --git a/pkg/systray/systray.go b/pkg/systray/systray.go index 714852d..6bd58b8 100644 --- a/pkg/systray/systray.go +++ b/pkg/systray/systray.go @@ -20,6 +20,7 @@ import ( "log" "os" "os/signal" + "strconv" "time" "0xacab.org/leap/bitmask-vpn/icon" @@ -88,10 +89,21 @@ func (bt *bmTray) setUpSystray() { bt.mHelp = systray.AddMenuItem(printer.Sprintf("Help..."), "") bt.mDonate = systray.AddMenuItem(printer.Sprintf("Donate..."), "") + bt.mAbout = systray.AddMenuItem(printer.Sprintf("About..."), "") systray.AddSeparator() bt.mQuit = systray.AddMenuItem(printer.Sprintf("Quit"), "") + + showDonate, err := strconv.ParseBool(config.AskForDonations) + if err != nil { + log.Printf("Error parsing AskForDonations: %v", err) + showDonate = true + } + if !showDonate { + bt.mDonate.Hide() + } + } func (bt *bmTray) loop(bm bitmask.Bitmask, notify *notificator, as bitmask.Autostart) { |