aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/root-helpers
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/root-helpers')
-rw-r--r--client/src/root-helpers/peertube-web-storage.ts13
-rw-r--r--client/src/root-helpers/plugins.ts7
2 files changed, 11 insertions, 9 deletions
diff --git a/client/src/root-helpers/peertube-web-storage.ts b/client/src/root-helpers/peertube-web-storage.ts
index f29845443..d4cad8a20 100644
--- a/client/src/root-helpers/peertube-web-storage.ts
+++ b/client/src/root-helpers/peertube-web-storage.ts
@@ -4,17 +4,19 @@ const valuesMap = new Map()
4 4
5function proxify (instance: MemoryStorage) { 5function proxify (instance: MemoryStorage) {
6 return new Proxy(instance, { 6 return new Proxy(instance, {
7 set: function (obj, prop: string | number, value) { 7 set: function (obj, prop: string | symbol, value) {
8 if (MemoryStorage.prototype.hasOwnProperty(prop)) { 8 if (MemoryStorage.prototype.hasOwnProperty(prop)) {
9 instance[prop] = value 9 // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863
10 instance[prop as any] = value
10 } else { 11 } else {
11 instance.setItem(prop, value) 12 instance.setItem(prop, value)
12 } 13 }
13 return true 14 return true
14 }, 15 },
15 get: function (target, name: string | number) { 16 get: function (target, name: string | symbol | number) {
16 if (MemoryStorage.prototype.hasOwnProperty(name)) { 17 if (MemoryStorage.prototype.hasOwnProperty(name)) {
17 return instance[name] 18 // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863
19 return instance[name as any]
18 } 20 }
19 if (valuesMap.has(name)) { 21 if (valuesMap.has(name)) {
20 return instance.getItem(name) 22 return instance.getItem(name)
@@ -23,9 +25,8 @@ function proxify (instance: MemoryStorage) {
23 }) 25 })
24} 26}
25 27
26class MemoryStorage { 28class MemoryStorage implements Storage {
27 [key: string]: any 29 [key: string]: any
28 [index: number]: string
29 30
30 getItem (key: any) { 31 getItem (key: any) {
31 const stringKey = String(key) 32 const stringKey = String(key)
diff --git a/client/src/root-helpers/plugins.ts b/client/src/root-helpers/plugins.ts
index 5344c0468..8c1c858b7 100644
--- a/client/src/root-helpers/plugins.ts
+++ b/client/src/root-helpers/plugins.ts
@@ -1,14 +1,15 @@
1import { RegisterClientHelpers } from 'src/types/register-client-option.model' 1import { RegisterClientHelpers } from 'src/types/register-client-option.model'
2import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' 2import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'
3import { RegisterClientFormFieldOptions, RegisterClientVideoFieldOptions } from '@shared/models/plugins/register-client-form-field.model'
4import { 3import {
5 ClientHookName, 4 ClientHookName,
6 clientHookObject, 5 clientHookObject,
7 ClientScript, 6 ClientScript,
8 PluginType, 7 PluginType,
8 RegisterClientFormFieldOptions,
9 RegisterClientHookOptions, 9 RegisterClientHookOptions,
10 ServerConfigPlugin, 10 RegisterClientSettingsScript,
11 RegisterClientSettingsScript 11 RegisterClientVideoFieldOptions,
12 ServerConfigPlugin
12} from '../../../shared/models' 13} from '../../../shared/models'
13import { ClientScript as ClientScriptModule } from '../types/client-script.model' 14import { ClientScript as ClientScriptModule } from '../types/client-script.model'
14import { importModule } from './utils' 15import { importModule } from './utils'