diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-05 13:54:32 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 345da516fae80f24c90c2196e96393b489af2243 (patch) | |
tree | 64d72d25a531626c1d4a6337460dae4e32386f2a /shared | |
parent | 297067399db2bf7505561d67667ca0d559a8e42b (diff) | |
download | PeerTube-345da516fae80f24c90c2196e96393b489af2243.tar.gz PeerTube-345da516fae80f24c90c2196e96393b489af2243.tar.zst PeerTube-345da516fae80f24c90c2196e96393b489af2243.zip |
WIP plugins: add ability to register plugins
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/plugins/plugin-library.model.ts | 6 | ||||
-rw-r--r-- | shared/models/plugins/plugin-package-json.model.ts | 15 | ||||
-rw-r--r-- | shared/models/plugins/plugin.type.ts | 4 | ||||
-rw-r--r-- | shared/models/plugins/register-options.type.ts | 5 | ||||
-rw-r--r-- | shared/models/plugins/register.model.ts | 5 |
5 files changed, 35 insertions, 0 deletions
diff --git a/shared/models/plugins/plugin-library.model.ts b/shared/models/plugins/plugin-library.model.ts new file mode 100644 index 000000000..8eb18d720 --- /dev/null +++ b/shared/models/plugins/plugin-library.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | import { RegisterOptions } from './register-options.type' | ||
2 | |||
3 | export interface PluginLibrary { | ||
4 | register: (options: RegisterOptions) => void | ||
5 | unregister: () => Promise<any> | ||
6 | } | ||
diff --git a/shared/models/plugins/plugin-package-json.model.ts b/shared/models/plugins/plugin-package-json.model.ts new file mode 100644 index 000000000..4520ee181 --- /dev/null +++ b/shared/models/plugins/plugin-package-json.model.ts | |||
@@ -0,0 +1,15 @@ | |||
1 | export type PluginPackageJson = { | ||
2 | name: string | ||
3 | description: string | ||
4 | engine: { peertube: string }, | ||
5 | |||
6 | homepage: string, | ||
7 | author: string, | ||
8 | bugs: string, | ||
9 | library: string, | ||
10 | |||
11 | staticDirs: { [ name: string ]: string } | ||
12 | css: string[] | ||
13 | |||
14 | clientScripts: { script: string, scopes: string[] }[] | ||
15 | } | ||
diff --git a/shared/models/plugins/plugin.type.ts b/shared/models/plugins/plugin.type.ts new file mode 100644 index 000000000..b6766821a --- /dev/null +++ b/shared/models/plugins/plugin.type.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export enum PluginType { | ||
2 | PLUGIN = 1, | ||
3 | THEME = 2 | ||
4 | } | ||
diff --git a/shared/models/plugins/register-options.type.ts b/shared/models/plugins/register-options.type.ts new file mode 100644 index 000000000..a074f3931 --- /dev/null +++ b/shared/models/plugins/register-options.type.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | import { RegisterHookOptions } from './register.model' | ||
2 | |||
3 | export type RegisterOptions = { | ||
4 | registerHook: (options: RegisterHookOptions) => void | ||
5 | } | ||
diff --git a/shared/models/plugins/register.model.ts b/shared/models/plugins/register.model.ts new file mode 100644 index 000000000..3817007ae --- /dev/null +++ b/shared/models/plugins/register.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export type RegisterHookOptions = { | ||
2 | target: string | ||
3 | handler: Function | ||
4 | priority?: number | ||
5 | } | ||