aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/plugin-helpers-builder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/plugins/plugin-helpers-builder.ts')
-rw-r--r--server/lib/plugins/plugin-helpers-builder.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts
index 35945422c..7b1def6e3 100644
--- a/server/lib/plugins/plugin-helpers-builder.ts
+++ b/server/lib/plugins/plugin-helpers-builder.ts
@@ -1,4 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { Server } from 'http'
2import { join } from 'path' 3import { join } from 'path'
3import { ffprobePromise } from '@server/helpers/ffmpeg/ffprobe-utils' 4import { ffprobePromise } from '@server/helpers/ffmpeg/ffprobe-utils'
4import { buildLogger } from '@server/helpers/logger' 5import { buildLogger } from '@server/helpers/logger'
@@ -17,12 +18,12 @@ import { MPlugin, MVideo, UserNotificationModelForApi } from '@server/types/mode
17import { PeerTubeHelpers } from '@server/types/plugins' 18import { PeerTubeHelpers } from '@server/types/plugins'
18import { VideoBlacklistCreate, VideoStorage } from '@shared/models' 19import { VideoBlacklistCreate, VideoStorage } from '@shared/models'
19import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist' 20import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist'
21import { PeerTubeSocket } from '../peertube-socket'
20import { ServerConfigManager } from '../server-config-manager' 22import { ServerConfigManager } from '../server-config-manager'
21import { blacklistVideo, unblacklistVideo } from '../video-blacklist' 23import { blacklistVideo, unblacklistVideo } from '../video-blacklist'
22import { VideoPathManager } from '../video-path-manager' 24import { VideoPathManager } from '../video-path-manager'
23import { PeerTubeSocket } from '../peertube-socket'
24 25
25function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers { 26function buildPluginHelpers (httpServer: Server, pluginModel: MPlugin, npmName: string): PeerTubeHelpers {
26 const logger = buildPluginLogger(npmName) 27 const logger = buildPluginLogger(npmName)
27 28
28 const database = buildDatabaseHelpers() 29 const database = buildDatabaseHelpers()
@@ -30,7 +31,7 @@ function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHel
30 31
31 const config = buildConfigHelpers() 32 const config = buildConfigHelpers()
32 33
33 const server = buildServerHelpers() 34 const server = buildServerHelpers(httpServer)
34 35
35 const moderation = buildModerationHelpers() 36 const moderation = buildModerationHelpers()
36 37
@@ -69,8 +70,10 @@ function buildDatabaseHelpers () {
69 } 70 }
70} 71}
71 72
72function buildServerHelpers () { 73function buildServerHelpers (httpServer: Server) {
73 return { 74 return {
75 getHTTPServer: () => httpServer,
76
74 getServerActor: () => getServerActor() 77 getServerActor: () => getServerActor()
75 } 78 }
76} 79}
@@ -218,6 +221,8 @@ function buildPluginRelatedHelpers (plugin: MPlugin, npmName: string) {
218 221
219 getBaseRouterRoute: () => `/plugins/${plugin.name}/${plugin.version}/router/`, 222 getBaseRouterRoute: () => `/plugins/${plugin.name}/${plugin.version}/router/`,
220 223
224 getBaseWebSocketRoute: () => `/plugins/${plugin.name}/${plugin.version}/ws/`,
225
221 getDataDirectoryPath: () => join(CONFIG.STORAGE.PLUGINS_DIR, 'data', npmName) 226 getDataDirectoryPath: () => join(CONFIG.STORAGE.PLUGINS_DIR, 'data', npmName)
222 } 227 }
223} 228}