kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Cleanup indexedDB when queue clears and when instance changes
rodzic
5616c9f066
commit
eba18cede3
|
@ -3,7 +3,7 @@ import type { Track, Upload } from '~/types'
|
||||||
import { createGlobalState, useNow, useStorage, useTimeAgo, whenever } from '@vueuse/core'
|
import { createGlobalState, useNow, useStorage, useTimeAgo, whenever } from '@vueuse/core'
|
||||||
import { shuffle as shuffleArray, sum } from 'lodash-es'
|
import { shuffle as shuffleArray, sum } from 'lodash-es'
|
||||||
import { computed, ref, shallowReactive, watchEffect } from 'vue'
|
import { computed, ref, shallowReactive, watchEffect } from 'vue'
|
||||||
import { getMany, setMany } from 'idb-keyval'
|
import { delMany, getMany, setMany } from 'idb-keyval'
|
||||||
import { useClamp } from '@vueuse/math'
|
import { useClamp } from '@vueuse/math'
|
||||||
|
|
||||||
import { looping, LoopingMode, isPlaying } from '~/composables/audio/player'
|
import { looping, LoopingMode, isPlaying } from '~/composables/audio/player'
|
||||||
|
@ -277,8 +277,12 @@ export const useQueue = createGlobalState(() => {
|
||||||
currentSound.value?.pause()
|
currentSound.value?.pause()
|
||||||
currentSound.value?.seekTo(0)
|
currentSound.value?.seekTo(0)
|
||||||
currentSound.value?.dispose()
|
currentSound.value?.dispose()
|
||||||
|
|
||||||
clearRadio.value = true
|
clearRadio.value = true
|
||||||
|
|
||||||
|
const lastTracks = [...tracks.value]
|
||||||
tracks.value.length = 0
|
tracks.value.length = 0
|
||||||
|
await delMany(lastTracks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Radio queue populating
|
// Radio queue populating
|
||||||
|
|
|
@ -4,6 +4,7 @@ import type { RootState } from '~/store/index'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { merge } from 'lodash-es'
|
import { merge } from 'lodash-es'
|
||||||
import useLogger from '~/composables/useLogger'
|
import useLogger from '~/composables/useLogger'
|
||||||
|
import { useQueue } from '~/composables/audio/queue'
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
frontSettings: FrontendSettings
|
frontSettings: FrontendSettings
|
||||||
|
@ -162,6 +163,9 @@ const store: Module<State, RootState> = {
|
||||||
modules.forEach(m => {
|
modules.forEach(m => {
|
||||||
commit(`${m}/reset`, null, { root: true })
|
commit(`${m}/reset`, null, { root: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { clear } = useQueue()
|
||||||
|
return clear()
|
||||||
},
|
},
|
||||||
async fetchSettings ({ commit }) {
|
async fetchSettings ({ commit }) {
|
||||||
const response = await axios.get('instance/settings/')
|
const response = await axios.get('instance/settings/')
|
||||||
|
|
Ładowanie…
Reference in New Issue