Avoid panic on spotify if not authed
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m35s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m35s
This commit is contained in:
@@ -53,10 +53,16 @@ func (store *Store) ListeningTo(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (store *Store) RecentlyPlayed(ctx *gin.Context) {
|
func (store *Store) RecentlyPlayed(ctx *gin.Context) {
|
||||||
|
if store.SpotifyClient == nil {
|
||||||
|
ctx.JSON(500, gin.H{"error": "Spotify not authenticated"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
opts := spotify.RecentlyPlayedOptions{Limit: 3}
|
opts := spotify.RecentlyPlayedOptions{Limit: 3}
|
||||||
|
|
||||||
if store.RecentSongsFresh() {
|
if store.RecentSongsFresh() {
|
||||||
ctx.JSON(200, *store.RecentSongs)
|
ctx.JSON(200, *store.RecentSongs)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
played, err := store.SpotifyClient.PlayerRecentlyPlayedOpt(ctx, &opts)
|
played, err := store.SpotifyClient.PlayerRecentlyPlayedOpt(ctx, &opts)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ services:
|
|||||||
nginx:
|
nginx:
|
||||||
environment:
|
environment:
|
||||||
- DEV_MODE=true
|
- DEV_MODE=true
|
||||||
|
- SEED_DB=true
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
certbot:
|
certbot:
|
||||||
|
|||||||
Reference in New Issue
Block a user