aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-24 11:17:42 +0200
committerChocobozzz <me@florianbigard.com>2019-07-24 11:17:42 +0200
commit9ae88819c202a6ce4a36b56506f508a5603e8eab (patch)
tree4936990dff918ceabe835dfa7192e5e4c6211dc6 /server
parent5f189c9c85449951254646ddf6cd6c84bc4c06ff (diff)
downloadPeerTube-9ae88819c202a6ce4a36b56506f508a5603e8eab.tar.gz
PeerTube-9ae88819c202a6ce4a36b56506f508a5603e8eab.tar.zst
PeerTube-9ae88819c202a6ce4a36b56506f508a5603e8eab.zip
Change plugin models names
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/plugins.ts4
-rw-r--r--server/lib/plugins/plugin-manager.ts14
-rw-r--r--server/tests/api/server/plugins.ts4
-rw-r--r--server/typings/plugins/index.d.ts2
-rw-r--r--server/typings/plugins/plugin-library.model.ts4
-rw-r--r--server/typings/plugins/register-server-option.model.ts (renamed from server/typings/plugins/register-options.model.ts)10
6 files changed, 19 insertions, 19 deletions
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts
index de58a7350..86384ee27 100644
--- a/server/controllers/api/plugins.ts
+++ b/server/controllers/api/plugins.ts
@@ -25,7 +25,7 @@ import { ManagePlugin } from '../../../shared/models/plugins/manage-plugin.model
25import { logger } from '../../helpers/logger' 25import { logger } from '../../helpers/logger'
26import { listAvailablePluginsFromIndex } from '../../lib/plugins/plugin-index' 26import { listAvailablePluginsFromIndex } from '../../lib/plugins/plugin-index'
27import { PeertubePluginIndexList } from '../../../shared/models/plugins/peertube-plugin-index-list.model' 27import { PeertubePluginIndexList } from '../../../shared/models/plugins/peertube-plugin-index-list.model'
28import { RegisteredSettings } from '../../../shared/models/plugins/register-setting.model' 28import { RegisteredServerSettings } from '../../../shared/models/plugins/register-server-setting.model'
29 29
30const pluginRouter = express.Router() 30const pluginRouter = express.Router()
31 31
@@ -164,7 +164,7 @@ async function uninstallPlugin (req: express.Request, res: express.Response) {
164function getPluginRegisteredSettings (req: express.Request, res: express.Response) { 164function getPluginRegisteredSettings (req: express.Request, res: express.Response) {
165 const settings = PluginManager.Instance.getRegisteredSettings(req.params.npmName) 165 const settings = PluginManager.Instance.getRegisteredSettings(req.params.npmName)
166 166
167 const json: RegisteredSettings = { settings } 167 const json: RegisteredServerSettings = { settings }
168 168
169 return res.json(json) 169 return res.json(json)
170} 170}
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index a87d02c56..381a89473 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -9,15 +9,15 @@ import { PLUGIN_GLOBAL_CSS_PATH } from '../../initializers/constants'
9import { PluginType } from '../../../shared/models/plugins/plugin.type' 9import { PluginType } from '../../../shared/models/plugins/plugin.type'
10import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' 10import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn'
11import { outputFile, readJSON } from 'fs-extra' 11import { outputFile, readJSON } from 'fs-extra'
12import { RegisterSettingOptions } from '../../../shared/models/plugins/register-setting.model'
13import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model'
14import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' 12import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model'
15import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' 13import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model'
16import { ServerHook, ServerHookName, serverHookObject } from '../../../shared/models/plugins/server-hook.model' 14import { ServerHook, ServerHookName, serverHookObject } from '../../../shared/models/plugins/server-hook.model'
17import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' 15import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks'
18import { RegisterOptions } from '../../typings/plugins/register-options.model' 16import { RegisterServerOptions } from '../../typings/plugins/register-server-option.model'
19import { PluginLibrary } from '../../typings/plugins' 17import { PluginLibrary } from '../../typings/plugins'
20import { ClientHtml } from '../client-html' 18import { ClientHtml } from '../client-html'
19import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model'
20import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
21 21
22export interface RegisteredPlugin { 22export interface RegisteredPlugin {
23 npmName: string 23 npmName: string
@@ -51,7 +51,7 @@ export class PluginManager implements ServerHook {
51 private static instance: PluginManager 51 private static instance: PluginManager
52 52
53 private registeredPlugins: { [ name: string ]: RegisteredPlugin } = {} 53 private registeredPlugins: { [ name: string ]: RegisteredPlugin } = {}
54 private settings: { [ name: string ]: RegisterSettingOptions[] } = {} 54 private settings: { [ name: string ]: RegisterServerSettingOptions[] } = {}
55 private hooks: { [ name: string ]: HookInformationValue[] } = {} 55 private hooks: { [ name: string ]: HookInformationValue[] } = {}
56 56
57 private constructor () { 57 private constructor () {
@@ -391,8 +391,8 @@ export class PluginManager implements ServerHook {
391 391
392 // ###################### Generate register helpers ###################### 392 // ###################### Generate register helpers ######################
393 393
394 private getRegisterHelpers (npmName: string, plugin: PluginModel): RegisterOptions { 394 private getRegisterHelpers (npmName: string, plugin: PluginModel): RegisterServerOptions {
395 const registerHook = (options: RegisterHookOptions) => { 395 const registerHook = (options: RegisterServerHookOptions) => {
396 if (serverHookObject[options.target] !== true) { 396 if (serverHookObject[options.target] !== true) {
397 logger.warn('Unknown hook %s of plugin %s. Skipping.', options.target, npmName) 397 logger.warn('Unknown hook %s of plugin %s. Skipping.', options.target, npmName)
398 return 398 return
@@ -408,7 +408,7 @@ export class PluginManager implements ServerHook {
408 }) 408 })
409 } 409 }
410 410
411 const registerSetting = (options: RegisterSettingOptions) => { 411 const registerSetting = (options: RegisterServerSettingOptions) => {
412 if (!this.settings[npmName]) this.settings[npmName] = [] 412 if (!this.settings[npmName]) this.settings[npmName] = []
413 413
414 this.settings[npmName].push(options) 414 this.settings[npmName].push(options)
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index b3d003f45..f8b2d78c9 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -23,10 +23,10 @@ import {
23import { PluginType } from '../../../../shared/models/plugins/plugin.type' 23import { PluginType } from '../../../../shared/models/plugins/plugin.type'
24import { PeerTubePluginIndex } from '../../../../shared/models/plugins/peertube-plugin-index.model' 24import { PeerTubePluginIndex } from '../../../../shared/models/plugins/peertube-plugin-index.model'
25import { ServerConfig } from '../../../../shared/models/server' 25import { ServerConfig } from '../../../../shared/models/server'
26import { RegisteredSettings } from '../../../../shared/models/plugins/register-setting.model'
27import { PeerTubePlugin } from '../../../../shared/models/plugins/peertube-plugin.model' 26import { PeerTubePlugin } from '../../../../shared/models/plugins/peertube-plugin.model'
28import { User } from '../../../../shared/models/users' 27import { User } from '../../../../shared/models/users'
29import { PluginPackageJson } from '../../../../shared/models/plugins/plugin-package-json.model' 28import { PluginPackageJson } from '../../../../shared/models/plugins/plugin-package-json.model'
29import { RegisteredServerSettings } from '../../../../shared/models/plugins/register-server-setting.model'
30 30
31const expect = chai.expect 31const expect = chai.expect
32 32
@@ -217,7 +217,7 @@ describe('Test plugins', function () {
217 npmName: 'peertube-plugin-hello-world' 217 npmName: 'peertube-plugin-hello-world'
218 }) 218 })
219 219
220 const settings = (res.body as RegisteredSettings).settings 220 const settings = (res.body as RegisteredServerSettings).settings
221 221
222 expect(settings).to.have.length.at.least(1) 222 expect(settings).to.have.length.at.least(1)
223 223
diff --git a/server/typings/plugins/index.d.ts b/server/typings/plugins/index.d.ts
index bddb3089e..9570579ef 100644
--- a/server/typings/plugins/index.d.ts
+++ b/server/typings/plugins/index.d.ts
@@ -1,2 +1,2 @@
1export * from './register-options.model' 1export * from './register-server-option.model'
2export * from './plugin-library.model' 2export * from './plugin-library.model'
diff --git a/server/typings/plugins/plugin-library.model.ts b/server/typings/plugins/plugin-library.model.ts
index fd90a3b46..5b517ee9f 100644
--- a/server/typings/plugins/plugin-library.model.ts
+++ b/server/typings/plugins/plugin-library.model.ts
@@ -1,7 +1,7 @@
1import { RegisterOptions } from './register-options.model' 1import { RegisterServerOptions } from './register-server-option.model'
2 2
3export interface PluginLibrary { 3export interface PluginLibrary {
4 register: (options: RegisterOptions) => Promise<any> 4 register: (options: RegisterServerOptions) => Promise<any>
5 5
6 unregister: () => Promise<any> 6 unregister: () => Promise<any>
7} 7}
diff --git a/server/typings/plugins/register-options.model.ts b/server/typings/plugins/register-server-option.model.ts
index 007ef5e1b..91a06a7c5 100644
--- a/server/typings/plugins/register-options.model.ts
+++ b/server/typings/plugins/register-server-option.model.ts
@@ -1,13 +1,13 @@
1import { logger } from '../../helpers/logger' 1import { logger } from '../../helpers/logger'
2import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model'
3import { RegisterSettingOptions } from '../../../shared/models/plugins/register-setting.model'
4import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' 2import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model'
5import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' 3import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model'
4import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model'
5import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
6 6
7export type RegisterOptions = { 7export type RegisterServerOptions = {
8 registerHook: (options: RegisterHookOptions) => void 8 registerHook: (options: RegisterServerHookOptions) => void
9 9
10 registerSetting: (options: RegisterSettingOptions) => void 10 registerSetting: (options: RegisterServerSettingOptions) => void
11 11
12 settingsManager: PluginSettingsManager 12 settingsManager: PluginSettingsManager
13 13