Spotify unauthenticated: throttled log + admin reconnect on Listening widget
Deploy with Docker Compose / deploy (push) Successful in 40s
Deploy with Docker Compose / deploy (push) Successful in 40s
- 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]>
This commit is contained in:
@@ -22,6 +22,12 @@ const song_template = {
|
||||
export const useSongsStore = defineStore("songs", () => {
|
||||
const songs = ref([song_template]);
|
||||
|
||||
// signalEnglish (see below) plus an admin-only "needs Spotify re-auth"
|
||||
// flag, fetched alongside the songs. The widget uses it to offer the
|
||||
// reconnect link; non-admins also get the field (false) because the query
|
||||
// is public and the resolver simply gates it.
|
||||
const needsReauth = ref(false);
|
||||
|
||||
const songsCount = computed(() => songs.value.length);
|
||||
|
||||
const homeData = useHomeDataStore();
|
||||
@@ -52,8 +58,10 @@ export const useSongsStore = defineStore("songs", () => {
|
||||
}
|
||||
playedAt
|
||||
}
|
||||
spotifyNeedsReauth
|
||||
}
|
||||
`);
|
||||
needsReauth.value = !!data.spotifyNeedsReauth;
|
||||
if (Array.isArray(data.spotifyRecent) && data.spotifyRecent.length > 0) {
|
||||
songs.value = data.spotifyRecent;
|
||||
}
|
||||
@@ -67,6 +75,8 @@ export const useSongsStore = defineStore("songs", () => {
|
||||
|
||||
songsCount,
|
||||
|
||||
needsReauth,
|
||||
|
||||
fetchSongs,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user