diff options
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r-- | client/src/app/shared/misc/peertube-web-storage.ts (renamed from client/src/app/shared/misc/peertube-local-storage.ts) | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/app/shared/misc/peertube-local-storage.ts b/client/src/app/shared/misc/peertube-web-storage.ts index fb5c45acf..fff209678 100644 --- a/client/src/app/shared/misc/peertube-local-storage.ts +++ b/client/src/app/shared/misc/peertube-web-storage.ts | |||
@@ -42,12 +42,14 @@ class MemoryStorage { | |||
42 | } | 42 | } |
43 | 43 | ||
44 | let peertubeLocalStorage: Storage | 44 | let peertubeLocalStorage: Storage |
45 | let peertubeSessionStorage: Storage | ||
45 | try { | 46 | try { |
46 | peertubeLocalStorage = localStorage | 47 | peertubeLocalStorage = localStorage |
48 | peertubeSessionStorage = sessionStorage | ||
47 | } catch (err) { | 49 | } catch (err) { |
48 | const instance = new MemoryStorage() | 50 | const instance = new MemoryStorage() |
49 | 51 | ||
50 | peertubeLocalStorage = new Proxy(instance, { | 52 | peertubeLocalStorage = sessionStorage = new Proxy(instance, { |
51 | set: function (obj, prop: string | number, value) { | 53 | set: function (obj, prop: string | number, value) { |
52 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { | 54 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { |
53 | instance[prop] = value | 55 | instance[prop] = value |
@@ -67,4 +69,7 @@ try { | |||
67 | }) | 69 | }) |
68 | } | 70 | } |
69 | 71 | ||
70 | export { peertubeLocalStorage } | 72 | export { |
73 | peertubeLocalStorage, | ||
74 | peertubeSessionStorage | ||
75 | } | ||