1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Constantize the defaultFocus value for each module

This commit is contained in:
Chris Cummer
2019-09-18 20:34:53 -07:00
parent d6208b4730
commit bf877f5fa7
120 changed files with 421 additions and 255 deletions

View File

@@ -7,7 +7,10 @@ import (
"github.com/wtfutil/wtf/cfg"
)
const defaultTitle = "Spotify Web"
const (
defaultFocusable = true
defaultTitle = "Spotify Web"
)
type Settings struct {
common *cfg.Common
@@ -20,7 +23,7 @@ type Settings struct {
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
callbackPort: ymlConfig.UString("callbackPort", "8080"),
clientID: ymlConfig.UString("clientID", os.Getenv("SPOTIFY_ID")),

View File

@@ -12,6 +12,15 @@ import (
"github.com/zmb3/spotify"
)
var (
auth spotify.Authenticator
tempClientChan = make(chan *spotify.Client)
state = "wtfSpotifyWebStateString"
authURL string
callbackPort string
redirectURI string
)
// Info is the struct that contains all the information the Spotify player displays to the user
type Info struct {
Artists string
@@ -34,15 +43,6 @@ type Widget struct {
settings *Settings
}
var (
auth spotify.Authenticator
tempClientChan = make(chan *spotify.Client)
state = "wtfSpotifyWebStateString"
authURL string
callbackPort string
redirectURI string
)
func authHandler(w http.ResponseWriter, r *http.Request) {
tok, err := auth.Token(state, r)
if err != nil {
@@ -70,7 +70,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common),
Info: Info{},