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.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts
index d57c69ef0..8487672ba 100644
--- a/server/lib/plugins/plugin-helpers-builder.ts
+++ b/server/lib/plugins/plugin-helpers-builder.ts
@@ -15,8 +15,9 @@ import { MPlugin } from '@server/types/models'
15import { PeerTubeHelpers } from '@server/types/plugins' 15import { PeerTubeHelpers } from '@server/types/plugins'
16import { VideoBlacklistCreate } from '@shared/models' 16import { VideoBlacklistCreate } from '@shared/models'
17import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist' 17import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist'
18import { getServerConfig } from '../config' 18import { ServerConfigManager } from '../server-config-manager'
19import { blacklistVideo, unblacklistVideo } from '../video-blacklist' 19import { blacklistVideo, unblacklistVideo } from '../video-blacklist'
20import { UserModel } from '@server/models/user/user'
20 21
21function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers { 22function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers {
22 const logger = buildPluginLogger(npmName) 23 const logger = buildPluginLogger(npmName)
@@ -146,7 +147,7 @@ function buildConfigHelpers () {
146 }, 147 },
147 148
148 getServerConfig () { 149 getServerConfig () {
149 return getServerConfig() 150 return ServerConfigManager.Instance.getServerConfig()
150 } 151 }
151 } 152 }
152} 153}
@@ -163,6 +164,11 @@ function buildPluginRelatedHelpers (plugin: MPlugin, npmName: string) {
163 164
164function buildUserHelpers () { 165function buildUserHelpers () {
165 return { 166 return {
166 getAuthUser: (res: express.Response) => res.locals.oauth?.token?.User 167 getAuthUser: (res: express.Response) => {
168 const user = res.locals.oauth?.token?.User
169 if (!user) return undefined
170
171 return UserModel.loadByIdFull(user.id)
172 }
167 } 173 }
168} 174}