parent
a5c9fa1051
commit
61379e4311
|
@ -64,10 +64,8 @@ class MemoryStorage {
|
||||||
|
|
||||||
let peertubeLocalStorage: Storage
|
let peertubeLocalStorage: Storage
|
||||||
let peertubeSessionStorage: Storage
|
let peertubeSessionStorage: Storage
|
||||||
try {
|
|
||||||
peertubeLocalStorage = localStorage
|
function reinitStorage () {
|
||||||
peertubeSessionStorage = sessionStorage
|
|
||||||
} catch (err) {
|
|
||||||
const instanceLocalStorage = new MemoryStorage()
|
const instanceLocalStorage = new MemoryStorage()
|
||||||
const instanceSessionStorage = new MemoryStorage()
|
const instanceSessionStorage = new MemoryStorage()
|
||||||
|
|
||||||
|
@ -75,6 +73,19 @@ try {
|
||||||
peertubeSessionStorage = proxify(instanceSessionStorage)
|
peertubeSessionStorage = proxify(instanceSessionStorage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
peertubeLocalStorage = localStorage
|
||||||
|
peertubeSessionStorage = sessionStorage
|
||||||
|
} catch (err) {
|
||||||
|
// support Firefox and other browsers using an exception rather than null
|
||||||
|
reinitStorage()
|
||||||
|
}
|
||||||
|
|
||||||
|
// support Brave and other browsers using null rather than an exception
|
||||||
|
if (peertubeLocalStorage === null || peertubeSessionStorage === null) {
|
||||||
|
reinitStorage()
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
peertubeLocalStorage,
|
peertubeLocalStorage,
|
||||||
peertubeSessionStorage
|
peertubeSessionStorage
|
||||||
|
|
Loading…
Reference in New Issue