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: {},
|
allStatusesObject: {},
|
||||||
conversationsObject: {},
|
conversationsObject: {},
|
||||||
maxId: 0,
|
maxId: 0,
|
||||||
scrobblesUnsupported: false,
|
|
||||||
favorites: new Set(),
|
favorites: new Set(),
|
||||||
|
pleromaScrobblesAvailable: true, // not reported in nodeinfo
|
||||||
timelines: {
|
timelines: {
|
||||||
mentions: emptyTl(),
|
mentions: emptyTl(),
|
||||||
public: emptyTl(),
|
public: emptyTl(),
|
||||||
|
|
@ -109,16 +109,19 @@ const sortTimeline = (timeline) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLatestScrobble = (state, user) => {
|
const getLatestScrobble = (state, user) => {
|
||||||
|
const scrobbles = state.pleromaScrobblesAvailable
|
||||||
|
if (!scrobbles) return
|
||||||
|
|
||||||
if (state.scrobblesNextFetch[user.id] && state.scrobblesNextFetch[user.id] > Date.now()) {
|
if (state.scrobblesNextFetch[user.id] && state.scrobblesNextFetch[user.id] > Date.now()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.scrobblesUnsupported) return
|
|
||||||
|
|
||||||
state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000
|
state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000
|
||||||
|
if (!scrobbles) return
|
||||||
apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => {
|
apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => {
|
||||||
if (scrobbles?.error?.status === 501) {
|
if (scrobbles?.error?.status === 501) {
|
||||||
state.scrobblesUnsupported = true
|
state.pleromaScrobblesAvailable = false
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrobbles.length > 0) {
|
if (scrobbles.length > 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue