diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/root-helpers/peertube-web-storage.ts | 16 | ||||
-rw-r--r-- | client/src/standalone/videos/test-embed.ts | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/client/src/root-helpers/peertube-web-storage.ts b/client/src/root-helpers/peertube-web-storage.ts index 68a2462de..0bbe2c9fc 100644 --- a/client/src/root-helpers/peertube-web-storage.ts +++ b/client/src/root-helpers/peertube-web-storage.ts | |||
@@ -6,19 +6,17 @@ function proxify (instance: MemoryStorage) { | |||
6 | return new Proxy(instance, { | 6 | return new Proxy(instance, { |
7 | set: function (obj, prop: string | symbol, value) { | 7 | set: function (obj, prop: string | symbol, value) { |
8 | if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) { | 8 | if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) { |
9 | // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863 | 9 | instance[prop] = value |
10 | instance[prop as any] = value | ||
11 | } else { | 10 | } else { |
12 | instance.setItem(prop, value) | 11 | instance.setItem(prop, value) |
13 | } | 12 | } |
13 | |||
14 | return true | 14 | return true |
15 | }, | 15 | }, |
16 | get: function (target, name: string | symbol | number) { | 16 | get: function (target, name: string | symbol | number) { |
17 | if (Object.prototype.hasOwnProperty.call(MemoryStorage, name)) { | 17 | if (typeof instance[name] === 'function') { |
18 | // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863 | 18 | return instance[name] |
19 | return instance[name as any] | 19 | } else if (valuesMap.has(name)) { |
20 | } | ||
21 | if (valuesMap.has(name)) { | ||
22 | return instance.getItem(name) | 20 | return instance.getItem(name) |
23 | } | 21 | } |
24 | } | 22 | } |
@@ -26,7 +24,7 @@ function proxify (instance: MemoryStorage) { | |||
26 | } | 24 | } |
27 | 25 | ||
28 | class MemoryStorage implements Storage { | 26 | class MemoryStorage implements Storage { |
29 | [key: string]: any | 27 | [key: string | symbol]: any |
30 | 28 | ||
31 | getItem (key: any) { | 29 | getItem (key: any) { |
32 | const stringKey = String(key) | 30 | const stringKey = String(key) |
@@ -83,7 +81,7 @@ try { | |||
83 | } | 81 | } |
84 | 82 | ||
85 | // support Brave and other browsers using null rather than an exception | 83 | // support Brave and other browsers using null rather than an exception |
86 | if (peertubeLocalStorage === null || peertubeSessionStorage === null) { | 84 | if (!peertubeLocalStorage || !peertubeSessionStorage) { |
87 | reinitStorage() | 85 | reinitStorage() |
88 | } | 86 | } |
89 | 87 | ||
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts index 301c95d7b..a28a83cc1 100644 --- a/client/src/standalone/videos/test-embed.ts +++ b/client/src/standalone/videos/test-embed.ts | |||
@@ -15,6 +15,8 @@ window.addEventListener('load', async () => { | |||
15 | ? `/video-playlists/embed/${elementId}?api=1` | 15 | ? `/video-playlists/embed/${elementId}?api=1` |
16 | : `/videos/embed/${elementId}?api=1` | 16 | : `/videos/embed/${elementId}?api=1` |
17 | 17 | ||
18 | iframe.sandbox.add('allow-same-origin', 'allow-scripts', 'allow-popups') | ||
19 | |||
18 | const mainElement = document.querySelector('#host') | 20 | const mainElement = document.querySelector('#host') |
19 | mainElement.appendChild(iframe) | 21 | mainElement.appendChild(iframe) |
20 | 22 | ||