mirror of https://github.com/Chocobozzz/PeerTube
Add config helper for plugins
parent
ebefc902f5
commit
5a7eecdd56
|
@ -2,6 +2,7 @@ import { PeerTubeHelpers } from '@server/typings/plugins'
|
||||||
import { sequelizeTypescript } from '@server/initializers/database'
|
import { sequelizeTypescript } from '@server/initializers/database'
|
||||||
import { buildLogger } from '@server/helpers/logger'
|
import { buildLogger } from '@server/helpers/logger'
|
||||||
import { VideoModel } from '@server/models/video/video'
|
import { VideoModel } from '@server/models/video/video'
|
||||||
|
import { WEBSERVER } from '@server/initializers/constants'
|
||||||
|
|
||||||
function buildPluginHelpers (npmName: string): PeerTubeHelpers {
|
function buildPluginHelpers (npmName: string): PeerTubeHelpers {
|
||||||
const logger = buildPluginLogger(npmName)
|
const logger = buildPluginLogger(npmName)
|
||||||
|
@ -9,10 +10,13 @@ function buildPluginHelpers (npmName: string): PeerTubeHelpers {
|
||||||
const database = buildDatabaseHelpers()
|
const database = buildDatabaseHelpers()
|
||||||
const videos = buildVideosHelpers()
|
const videos = buildVideosHelpers()
|
||||||
|
|
||||||
|
const config = buildConfigHelpers()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
logger,
|
logger,
|
||||||
database,
|
database,
|
||||||
videos
|
videos,
|
||||||
|
config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,3 +47,11 @@ function buildVideosHelpers () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildConfigHelpers () {
|
||||||
|
return {
|
||||||
|
getWebserverUrl () {
|
||||||
|
return WEBSERVER.URL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@ export type PeerTubeHelpers = {
|
||||||
videos: {
|
videos: {
|
||||||
removeVideo: (videoId: number) => Promise<void>
|
removeVideo: (videoId: number) => Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config: {
|
||||||
|
getWebserverUrl: () => string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RegisterServerOptions = {
|
export type RegisterServerOptions = {
|
||||||
|
|
Loading…
Reference in New Issue