Files
stpweb/backend/graph/schema/spotify.graphql
adamfandClaude Code ff186f04a7
Deploy with Docker Compose / deploy (push) Successful in 40s
Spotify unauthenticated: throttled log + admin reconnect on Listening widget
- Backend logs a rate-limited (1/h) "not authenticated" line when a resolver
  finds the Spotify client nil instead of silently degrading to null.
- New public-but-gated spotifyNeedsReauth query: false for everyone except
  an admin session whose backend has no client.
- The /stp Listening widget offers admins a "Reconnect Spotify" button that
  hits /api/spotify/auth and navigates to the returned authorisation URL;
  non-admins still see the widget degrade as before.

Co-Authored-By: Claude Code <[email protected]>
2026-09-22 22:54:48 +01:00

42 lines
922 B
GraphQL

# Spotify "now playing" / "recently played" for the home page. Both resolve to
# null / an empty list when the backend has never completed the Spotify OAuth
# flow, so the page degrades rather than erroring.
type SpotifyArtist {
name: String!
}
type SpotifyImage {
url: String!
}
type SpotifyAlbum {
name: String!
images: [SpotifyImage!]!
}
type SpotifyTrack {
name: String!
artists: [SpotifyArtist!]!
album: SpotifyAlbum!
}
type SpotifyPlaying {
playing: Boolean!
track: SpotifyTrack
}
type SpotifyRecentItem {
track: SpotifyTrack!
playedAt: Time!
}
extend type Query {
spotifyListening: SpotifyPlaying
spotifyRecent: [SpotifyRecentItem!]
# True only for an admin session while the backend lacks a Spotify client
# (OAuth never completed or the token was revoked), used by the Listening
# widget to offer a reconnect link. Everyone else gets false.
spotifyNeedsReauth: Boolean!
}