Fix up spotify API

This commit is contained in:
Daniel Mason 2022-01-05 21:08:39 +13:00
parent 97a6087e42
commit 3f033170e0
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ import (
// updateSpotifyData - Pull data for all users // updateSpotifyData - Pull data for all users
func updateSpotifyData() { func updateSpotifyData() {
// Lets ignore if not configured // Lets ignore if not configured
val, _ := getConfigValue("SPOTIFY_APP_SECRET") val, _ := getConfigValue("SPOTIFY_API_SECRET")
if val == "" { if val == "" {
return return
} }
@ -35,8 +35,8 @@ func updateSpotifyData() {
} }
func getSpotifyAuthHandler() spotify.Authenticator { func getSpotifyAuthHandler() spotify.Authenticator {
appId, _ := getConfigValue("SPOTIFY_APP_ID") appId, _ := getConfigValue("SPOTIFY_API_ID")
appSecret, _ := getConfigValue("SPOTIFY_APP_SECRET") appSecret, _ := getConfigValue("SPOTIFY_API_SECRET")
redirectUrl := os.Getenv("GOSCROBBLE_DOMAIN") + "/api/v1/link/spotify" redirectUrl := os.Getenv("GOSCROBBLE_DOMAIN") + "/api/v1/link/spotify"
if redirectUrl == "http://localhost:3000/api/v1/link/spotify" { if redirectUrl == "http://localhost:3000/api/v1/link/spotify" {
@ -217,7 +217,7 @@ func ParseSpotifyInput(userUUID string, data spotify.RecentlyPlayedItem, client
// updateImageDataFromSpotify update artist/album images from spotify ;D // updateImageDataFromSpotify update artist/album images from spotify ;D
func (user *User) updateImageDataFromSpotify() error { func (user *User) updateImageDataFromSpotify() error {
// Check that data is set before we attempt to pull // Check that data is set before we attempt to pull
val, _ := getConfigValue("SPOTIFY_APP_SECRET") val, _ := getConfigValue("SPOTIFY_API_SECRET")
if val == "" { if val == "" {
return nil return nil
} }

View File

@ -702,7 +702,7 @@ func postSpotifyReponse(w http.ResponseWriter, r *http.Request) {
// getSpotifyClientID - Returns public spotify APP ID // getSpotifyClientID - Returns public spotify APP ID
func getSpotifyClientID(w http.ResponseWriter, r *http.Request, claims CustomClaims, v string) { func getSpotifyClientID(w http.ResponseWriter, r *http.Request, claims CustomClaims, v string) {
key, err := getConfigValue("SPOTIFY_APP_ID") key, err := getConfigValue("SPOTIFY_API_ID")
if err != nil { if err != nil {
throwOkError(w, "Failed to get Spotify ID") throwOkError(w, "Failed to get Spotify ID")
return return