From 2737b4f0d0c907fcdab6cdb3fedd18be6cd9ebb4 Mon Sep 17 00:00:00 2001 From: Adam French Date: Sat, 7 Mar 2026 17:46:55 +0000 Subject: [PATCH] Avoid panic on spotify if not authed --- backend/handlers/handle_spotify.go | 6 ++++++ docker-compose.dev.yml | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/backend/handlers/handle_spotify.go b/backend/handlers/handle_spotify.go index c60bc78..852a339 100644 --- a/backend/handlers/handle_spotify.go +++ b/backend/handlers/handle_spotify.go @@ -53,10 +53,16 @@ func (store *Store) ListeningTo(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} if store.RecentSongsFresh() { ctx.JSON(200, *store.RecentSongs) + return } played, err := store.SpotifyClient.PlayerRecentlyPlayedOpt(ctx, &opts) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 516ff64..3e1e0f1 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,9 +1,10 @@ services: - nginx: - environment: - - DEV_MODE=true - ports: - - 80:80 - certbot: - profiles: - - disabled + nginx: + environment: + - DEV_MODE=true + - SEED_DB=true + ports: + - 80:80 + certbot: + profiles: + - disabled