Fix broken client when cookies are disabled
This commit is contained in:
parent
572bf73be6
commit
6189b699fb
|
@ -47,9 +47,11 @@ try {
|
||||||
peertubeLocalStorage = localStorage
|
peertubeLocalStorage = localStorage
|
||||||
peertubeSessionStorage = sessionStorage
|
peertubeSessionStorage = sessionStorage
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const instance = new MemoryStorage()
|
const instanceLocalStorage = new MemoryStorage()
|
||||||
|
const instanceSessionStorage = new MemoryStorage()
|
||||||
|
|
||||||
peertubeLocalStorage = sessionStorage = new Proxy(instance, {
|
function proxify (instance: MemoryStorage) {
|
||||||
|
return new Proxy(instance, {
|
||||||
set: function (obj, prop: string | number, value) {
|
set: function (obj, prop: string | number, value) {
|
||||||
if (MemoryStorage.prototype.hasOwnProperty(prop)) {
|
if (MemoryStorage.prototype.hasOwnProperty(prop)) {
|
||||||
instance[prop] = value
|
instance[prop] = value
|
||||||
|
@ -67,6 +69,10 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
peertubeLocalStorage = proxify(instanceLocalStorage)
|
||||||
|
peertubeSessionStorage = proxify(instanceSessionStorage)
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
Loading…
Reference in New Issue