diff --git a/.all-contributorsrc b/.all-contributorsrc index 8a739c70..04952bfb 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -287,6 +287,13 @@ "name": "ReadmeCritic", "avatar_url": "https://avatars3.githubusercontent.com/u/15367484?v=4", "profile": "https://twitter.com/ReadmeCritic", + "contributions": [] + }, + { + "login": "jdevelop", + "name": "Eugene", + "avatar_url": "https://avatars0.githubusercontent.com/u/141402?v=4", + "profile": "https://github.com/jdevelop", "contributions": [ ] }, diff --git a/README.md b/README.md index 73110bc3..2065fd2a 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Thanks goes to these wonderful people: | [
flw](http://flw.tools/)
| [
David Barda](https://github.com/davebarda)
| [
Geoff Lee](https://github.com/matrinox)
| [
George Opritescu](http://international.github.io)
| [
Grazfather](https://twitter.com/Grazfather)
| [
Michael Cordell](http://www.mikecordell.com/)
| [
Patrick José Pereira](http://patrick.ibexcps.com)
| | [
sherod taylor](https://github.com/sherodtaylor)
| [
Andrew Scott](http://cogentia.io)
| [
Anand Sudhir Prayaga](https://github.com/anandsudhir)
| [
Lassi Piironen](https://github.com/lsipii)
| [
BlackWebWolf](https://github.com/BlackWebWolf)
| [
andrewzolotukhin](https://github.com/andrewzolotukhin)
| [
Leon Stigter](https://retgits.github.io)
| | [
Amr Tamimi](https://tamimi.se)
| [
Jagdeep Singh](https://jagdeep.me)
| [
Lineu Felipe](https://github.com/darkSasori)
| [
Konstantin](https://github.com/kvj)
| [
Brendan O'Leary](http://www.brendanoleary.com)
| [
bertl4398](https://github.com/bertl4398)
| [
Ferenc-](https://github.com/Ferenc-)
| -| [
Rohan Verma](http://rohanverma.net)
| [
Tim Fitzgerald](https://github.com/fimtitzgerald)
| [
Federico Ruggi](https://github.com/ruggi)
| [
Craig Woodward](https://github.com/ctwoodward)
| [
ReadmeCritic](https://twitter.com/ReadmeCritic)
| +| [
Rohan Verma](http://rohanverma.net)
| [
Tim Fitzgerald](https://github.com/fimtitzgerald)
| [
Federico Ruggi](https://github.com/ruggi)
| [
Craig Woodward](https://github.com/ctwoodward)
| [
ReadmeCritic](https://twitter.com/ReadmeCritic)
| [
Eugene](https://github.com/jdevelop)
| This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/cryptoexchanges/cryptolive/price/widget.go b/cryptoexchanges/cryptolive/price/widget.go index 85c5deb0..e7db0dc6 100644 --- a/cryptoexchanges/cryptolive/price/widget.go +++ b/cryptoexchanges/cryptolive/price/widget.go @@ -7,12 +7,9 @@ import ( "sync" "time" - "github.com/olebedev/config" + "github.com/senorprogrammer/wtf/wtf" ) -// Config is a pointer to the global config object -var Config *config.Config - var baseURL = "https://min-api.cryptocompare.com/data/price" var ok = true @@ -35,12 +32,12 @@ func NewWidget() *Widget { } func (widget *Widget) setList() { - currenciesMap, _ := Config.Map("wtf.mods.cryptolive.currencies") + currenciesMap, _ := wtf.Config.Map("wtf.mods.cryptolive.currencies") widget.list = &list{} for currency := range currenciesMap { - displayName, _ := Config.String("wtf.mods.cryptolive.currencies." + currency + ".displayName") + displayName, _ := wtf.Config.String("wtf.mods.cryptolive.currencies." + currency + ".displayName") toList := getToList(currency) widget.list.addItem(currency, displayName, toList) } @@ -70,10 +67,10 @@ func (widget *Widget) Refresh(wg *sync.WaitGroup) { func (widget *Widget) display() { str := "" var ( - fromNameColor = Config.UString("wtf.mods.cryptolive.colors.from.name", "coral") - fromDisplayNameColor = Config.UString("wtf.mods.cryptolive.colors.from.displayName", "grey") - toNameColor = Config.UString("wtf.mods.cryptolive.colors.to.name", "white") - toPriceColor = Config.UString("wtf.mods.cryptolive.colors.to.price", "green") + fromNameColor = wtf.Config.UString("wtf.mods.cryptolive.colors.from.name", "coral") + fromDisplayNameColor = wtf.Config.UString("wtf.mods.cryptolive.colors.from.displayName", "grey") + toNameColor = wtf.Config.UString("wtf.mods.cryptolive.colors.to.name", "white") + toPriceColor = wtf.Config.UString("wtf.mods.cryptolive.colors.to.price", "green") ) for _, item := range widget.list.items { str += fmt.Sprintf(" [%s]%s[%s] (%s)\n", fromNameColor, item.displayName, fromDisplayNameColor, item.name) @@ -87,7 +84,7 @@ func (widget *Widget) display() { } func getToList(fromName string) []*toCurrency { - toNames, _ := Config.List("wtf.mods.cryptolive.currencies." + fromName + ".to") + toNames, _ := wtf.Config.List("wtf.mods.cryptolive.currencies." + fromName + ".to") var toList []*toCurrency diff --git a/cryptoexchanges/cryptolive/toplist/widget.go b/cryptoexchanges/cryptolive/toplist/widget.go index feb95332..a9aeafae 100644 --- a/cryptoexchanges/cryptolive/toplist/widget.go +++ b/cryptoexchanges/cryptolive/toplist/widget.go @@ -8,11 +8,9 @@ import ( "sync" "time" - "github.com/olebedev/config" + "github.com/senorprogrammer/wtf/wtf" ) -// Config is a pointer to the global config object -var Config *config.Config var baseURL = "https://min-api.cryptocompare.com/data/top/exchanges" type textColors struct { @@ -50,17 +48,17 @@ func NewWidget() *Widget { } func (widget *Widget) setList() { - currenciesMap, _ := Config.Map("wtf.mods.cryptolive.top") + currenciesMap, _ := wtf.Config.Map("wtf.mods.cryptolive.top") for fromCurrency := range currenciesMap { - displayName := Config.UString("wtf.mods.cryptolive.top."+fromCurrency+".displayName", "") - limit := Config.UInt("wtf.mods.cryptolive.top."+fromCurrency+".limit", 1) + displayName := wtf.Config.UString("wtf.mods.cryptolive.top."+fromCurrency+".displayName", "") + limit := wtf.Config.UInt("wtf.mods.cryptolive.top."+fromCurrency+".limit", 1) widget.list.addItem(fromCurrency, displayName, limit, makeToList(fromCurrency, limit)) } } func makeToList(fCurrencyName string, limit int) (list []*tCurrency) { - toList, _ := Config.List("wtf.mods.cryptolive.top." + fCurrencyName + ".to") + toList, _ := wtf.Config.List("wtf.mods.cryptolive.top." + fCurrencyName + ".to") for _, toCurrency := range toList { list = append(list, &tCurrency{ @@ -74,11 +72,11 @@ func makeToList(fCurrencyName string, limit int) (list []*tCurrency) { func (widget *Widget) config() { // set colors - widget.colors.from.name = Config.UString("wtf.mods.cryptolive.colors.top.from.name", "coral") - widget.colors.from.displayName = Config.UString("wtf.mods.cryptolive.colors.top.from.displayName", "grey") - widget.colors.to.name = Config.UString("wtf.mods.cryptolive.colors.top.to.name", "red") - widget.colors.to.field = Config.UString("wtf.mods.cryptolive.colors.top.to.field", "white") - widget.colors.to.value = Config.UString("wtf.mods.cryptolive.colors.top.to.value", "value") + widget.colors.from.name = wtf.Config.UString("wtf.mods.cryptolive.colors.top.from.name", "coral") + widget.colors.from.displayName = wtf.Config.UString("wtf.mods.cryptolive.colors.top.from.displayName", "grey") + widget.colors.to.name = wtf.Config.UString("wtf.mods.cryptolive.colors.top.to.name", "red") + widget.colors.to.field = wtf.Config.UString("wtf.mods.cryptolive.colors.top.to.field", "white") + widget.colors.to.value = wtf.Config.UString("wtf.mods.cryptolive.colors.top.to.value", "value") } /* -------------------- Exported Functions -------------------- */ diff --git a/cryptoexchanges/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go index 150b4ed7..07331a83 100644 --- a/cryptoexchanges/cryptolive/widget.go +++ b/cryptoexchanges/cryptolive/widget.go @@ -4,15 +4,11 @@ import ( "fmt" "sync" - "github.com/olebedev/config" "github.com/senorprogrammer/wtf/cryptoexchanges/cryptolive/price" "github.com/senorprogrammer/wtf/cryptoexchanges/cryptolive/toplist" "github.com/senorprogrammer/wtf/wtf" ) -// Config is a pointer to the global config object -var Config *config.Config - // Widget define wtf widget to register widget later type Widget struct { wtf.TextWidget @@ -22,9 +18,6 @@ type Widget struct { // NewWidget Make new instance of widget func NewWidget() *Widget { - price.Config = Config - toplist.Config = Config - widget := Widget{ TextWidget: wtf.NewTextWidget(" CryptoLive ", "cryptolive", false), priceWidget: price.NewWidget(),