diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index 465cfd5..3f4358c 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -67,43 +67,19 @@ public class AdminController : ControllerBase /// Get current system status and configuration /// [HttpGet("status")] - public async Task GetStatus() + public IActionResult GetStatus() { + // Determine Spotify auth status based on configuration only + // DO NOT call Spotify API here - this endpoint is polled frequently var spotifyAuthStatus = "not_configured"; string? spotifyUser = null; if (_spotifyApiSettings.Enabled && !string.IsNullOrEmpty(_spotifyApiSettings.SessionCookie)) { - try - { - // First check if we can get a valid (non-anonymous) token - var token = await _spotifyClient.GetWebAccessTokenAsync(); - if (!string.IsNullOrEmpty(token)) - { - // Try to get user info (may fail even with valid token due to scope limitations) - var (success, userId, displayName) = await _spotifyClient.GetCurrentUserAsync(); - if (success) - { - spotifyAuthStatus = "authenticated"; - spotifyUser = displayName ?? userId; - } - else - { - // Token is valid but /me endpoint failed - this is normal for TOTP tokens - // which don't have user-read-private scope. Playlists still work fine. - spotifyAuthStatus = "authenticated"; - spotifyUser = "(working - profile scope not available)"; - } - } - else - { - spotifyAuthStatus = "invalid_cookie"; - } - } - catch - { - spotifyAuthStatus = "error"; - } + // If cookie is set, assume it's working until proven otherwise + // Actual validation happens when playlists are fetched + spotifyAuthStatus = "configured"; + spotifyUser = "(cookie set)"; } else if (_spotifyApiSettings.Enabled) { diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index d21aae3..ba67b33 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -938,16 +938,11 @@ const authStatus = document.getElementById('spotify-auth-status'); const cookieAgeEl = document.getElementById('spotify-cookie-age'); - if (data.spotify.authStatus === 'authenticated') { + if (data.spotify.authStatus === 'configured') { statusBadge.className = 'status-badge success'; - statusBadge.innerHTML = 'Spotify Connected'; - authStatus.textContent = 'Authenticated'; + statusBadge.innerHTML = 'Spotify Ready'; + authStatus.textContent = 'Cookie Set'; authStatus.className = 'stat-value success'; - } else if (data.spotify.authStatus === 'invalid_cookie') { - statusBadge.className = 'status-badge error'; - statusBadge.innerHTML = 'Cookie Invalid'; - authStatus.textContent = 'Invalid Cookie'; - authStatus.className = 'stat-value error'; } else if (data.spotify.authStatus === 'missing_cookie') { statusBadge.className = 'status-badge warning'; statusBadge.innerHTML = 'Cookie Missing';