From b5fd56c7909ae40bf7ef7a7a0d6fa1522040b15e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 16 Jun 2025 15:31:43 +0300 Subject: [PATCH] scrobbles --- src/modules/statuses.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 8b09263e0..fc922337e 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -38,8 +38,8 @@ export const defaultState = () => ({ allStatusesObject: {}, conversationsObject: {}, maxId: 0, - scrobblesUnsupported: false, favorites: new Set(), + pleromaScrobblesAvailable: true, // not reported in nodeinfo timelines: { mentions: emptyTl(), public: emptyTl(), @@ -109,16 +109,19 @@ const sortTimeline = (timeline) => { } const getLatestScrobble = (state, user) => { + const scrobbles = state.pleromaScrobblesAvailable + if (!scrobbles) return + if (state.scrobblesNextFetch[user.id] && state.scrobblesNextFetch[user.id] > Date.now()) { return } - if (state.scrobblesUnsupported) return - state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000 + if (!scrobbles) return apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => { if (scrobbles?.error?.status === 501) { - state.scrobblesUnsupported = true + state.pleromaScrobblesAvailable = false + return } if (scrobbles.length > 0) {