aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/plugins')
-rw-r--r--server/lib/plugins/plugin-helpers-builder.ts17
-rw-r--r--server/lib/plugins/register-helpers.ts2
2 files changed, 17 insertions, 2 deletions
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts
index dac6b3185..cbd849742 100644
--- a/server/lib/plugins/plugin-helpers-builder.ts
+++ b/server/lib/plugins/plugin-helpers-builder.ts
@@ -12,8 +12,10 @@ import { VideoBlacklistCreate } from '@shared/models'
12import { blacklistVideo, unblacklistVideo } from '../video-blacklist' 12import { blacklistVideo, unblacklistVideo } from '../video-blacklist'
13import { VideoBlacklistModel } from '@server/models/video/video-blacklist' 13import { VideoBlacklistModel } from '@server/models/video/video-blacklist'
14import { AccountBlocklistModel } from '@server/models/account/account-blocklist' 14import { AccountBlocklistModel } from '@server/models/account/account-blocklist'
15import { getServerConfig } from '../config'
16import { MPlugin } from '@server/types/models'
15 17
16function buildPluginHelpers (npmName: string): PeerTubeHelpers { 18function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers {
17 const logger = buildPluginLogger(npmName) 19 const logger = buildPluginLogger(npmName)
18 20
19 const database = buildDatabaseHelpers() 21 const database = buildDatabaseHelpers()
@@ -25,12 +27,15 @@ function buildPluginHelpers (npmName: string): PeerTubeHelpers {
25 27
26 const moderation = buildModerationHelpers() 28 const moderation = buildModerationHelpers()
27 29
30 const plugin = buildPluginRelatedHelpers(pluginModel)
31
28 return { 32 return {
29 logger, 33 logger,
30 database, 34 database,
31 videos, 35 videos,
32 config, 36 config,
33 moderation, 37 moderation,
38 plugin,
34 server 39 server
35 } 40 }
36} 41}
@@ -132,6 +137,16 @@ function buildConfigHelpers () {
132 return { 137 return {
133 getWebserverUrl () { 138 getWebserverUrl () {
134 return WEBSERVER.URL 139 return WEBSERVER.URL
140 },
141
142 getServerConfig () {
143 return getServerConfig()
135 } 144 }
136 } 145 }
137} 146}
147
148function buildPluginRelatedHelpers (plugin: MPlugin) {
149 return {
150 getBaseStaticRoute: () => `/plugins/${plugin.name}/${plugin.version}/static/`
151 }
152}
diff --git a/server/lib/plugins/register-helpers.ts b/server/lib/plugins/register-helpers.ts
index 9b5e1a546..c018e54a8 100644
--- a/server/lib/plugins/register-helpers.ts
+++ b/server/lib/plugins/register-helpers.ts
@@ -109,7 +109,7 @@ export class RegisterHelpers {
109 const unregisterIdAndPassAuth = this.buildUnregisterIdAndPassAuth() 109 const unregisterIdAndPassAuth = this.buildUnregisterIdAndPassAuth()
110 const unregisterExternalAuth = this.buildUnregisterExternalAuth() 110 const unregisterExternalAuth = this.buildUnregisterExternalAuth()
111 111
112 const peertubeHelpers = buildPluginHelpers(this.npmName) 112 const peertubeHelpers = buildPluginHelpers(this.plugin, this.npmName)
113 113
114 return { 114 return {
115 registerHook, 115 registerHook,