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

Remove stray Log() statements from SpotifyWeb

This commit is contained in:
Chris Cummer 2019-08-02 02:03:44 -07:00
parent a02e2a2247
commit 7234f83073
2 changed files with 4 additions and 8 deletions

View File

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/wtfutil/wtf/logger"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"

View File

@ -4,9 +4,9 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"os"
"github.com/rivo/tview" "github.com/rivo/tview"
"github.com/wtfutil/wtf/logger"
"github.com/wtfutil/wtf/wtf" "github.com/wtfutil/wtf/wtf"
"github.com/zmb3/spotify" "github.com/zmb3/spotify"
) )
@ -43,15 +43,12 @@ var (
) )
func authHandler(w http.ResponseWriter, r *http.Request) { func authHandler(w http.ResponseWriter, r *http.Request) {
logger.Log("[SpotifyWeb] Got an authentication hit!")
tok, err := auth.Token(state, r) tok, err := auth.Token(state, r)
if err != nil { if err != nil {
http.Error(w, "Couldn't get token", http.StatusForbidden) http.Error(w, "Couldn't get token", http.StatusForbidden)
logger.Log(err.Error())
} }
if st := r.FormValue("state"); st != state { if st := r.FormValue("state"); st != state {
http.NotFound(w, r) http.NotFound(w, r)
logger.Log(fmt.Sprintf("State mismatch: %s != %s\n", st, state))
} }
// use the token to get an authenticated client // use the token to get an authenticated client
client := auth.NewClient(tok) client := auth.NewClient(tok)
@ -87,7 +84,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
go func() { go func() {
// wait for auth to complete // wait for auth to complete
logger.Log("[SpotifyWeb] Waiting for authentication... URL: " + authURL)
client = <-tempClientChan client = <-tempClientChan
// use the client to make calls that require authorization // use the client to make calls that require authorization
@ -98,9 +94,10 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
playerState, err = client.PlayerState() playerState, err = client.PlayerState()
if err != nil { if err != nil {
panic(err) fmt.Println(err)
os.Exit(1)
} }
logger.Log("[SpotifyWeb] Authentication complete.")
widget.client = client widget.client = client
widget.playerState = playerState widget.playerState = playerState
widget.Refresh() widget.Refresh()