mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 19:50:37 +03:00
clear the ServiceWorker cache on logout (#854)
* Update authProvider.js This fixes https://github.com/navidrome/navidrome/issues/613 : clears the ServiceWorker cache on logout. Based on this code: https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage/keys . Seems to work on macOS and iOS, but please test on other platforms. * Format code with `prettier` Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
9fb55d4025
commit
1ea3d005e8
@ -59,6 +59,7 @@ const authProvider = {
|
||||
logout: () => {
|
||||
stopEventStream()
|
||||
removeItems()
|
||||
clearServiceWorkerCache()
|
||||
return Promise.resolve()
|
||||
},
|
||||
|
||||
@ -97,6 +98,12 @@ const removeItems = () => {
|
||||
localStorage.removeItem('subsonic-token')
|
||||
}
|
||||
|
||||
const clearServiceWorkerCache = () => {
|
||||
caches.keys().then(function (keyList) {
|
||||
for (let key of keyList) caches.delete(key)
|
||||
})
|
||||
}
|
||||
|
||||
const generateSubsonicSalt = () => {
|
||||
const h = md5(uuidv4())
|
||||
return h.slice(0, 6)
|
||||
|
Loading…
x
Reference in New Issue
Block a user