diff options
Diffstat (limited to 'server/lib/plugins/plugin-helpers-builder.ts')
-rw-r--r-- | server/lib/plugins/plugin-helpers-builder.ts | 13 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { Server } from 'http' | ||
2 | import { join } from 'path' | 3 | import { join } from 'path' |
3 | import { ffprobePromise } from '@server/helpers/ffmpeg/ffprobe-utils' | 4 | import { ffprobePromise } from '@server/helpers/ffmpeg/ffprobe-utils' |
4 | import { buildLogger } from '@server/helpers/logger' | 5 | import { buildLogger } from '@server/helpers/logger' |
@@ -17,12 +18,12 @@ import { MPlugin, MVideo, UserNotificationModelForApi } from '@server/types/mode | |||
17 | import { PeerTubeHelpers } from '@server/types/plugins' | 18 | import { PeerTubeHelpers } from '@server/types/plugins' |
18 | import { VideoBlacklistCreate, VideoStorage } from '@shared/models' | 19 | import { VideoBlacklistCreate, VideoStorage } from '@shared/models' |
19 | import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist' | 20 | import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist' |
21 | import { PeerTubeSocket } from '../peertube-socket' | ||
20 | import { ServerConfigManager } from '../server-config-manager' | 22 | import { ServerConfigManager } from '../server-config-manager' |
21 | import { blacklistVideo, unblacklistVideo } from '../video-blacklist' | 23 | import { blacklistVideo, unblacklistVideo } from '../video-blacklist' |
22 | import { VideoPathManager } from '../video-path-manager' | 24 | import { VideoPathManager } from '../video-path-manager' |
23 | import { PeerTubeSocket } from '../peertube-socket' | ||
24 | 25 | ||
25 | function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers { | 26 | function 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 | ||
72 | function buildServerHelpers () { | 73 | function 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 | } |