scrobbles
This commit is contained in:
parent
ac8519c166
commit
b5fd56c790
1 changed files with 7 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue