2020-04-10 13:07:54 +00:00
|
|
|
import { Router } from 'express'
|
2020-05-07 12:58:24 +00:00
|
|
|
import { Logger } from 'winston'
|
|
|
|
import { ActorModel } from '@server/models/activitypub/actor'
|
2020-06-23 12:10:17 +00:00
|
|
|
import {
|
|
|
|
PluginPlaylistPrivacyManager,
|
|
|
|
PluginSettingsManager,
|
|
|
|
PluginStorageManager,
|
2021-01-28 14:52:44 +00:00
|
|
|
PluginTranscodingManager,
|
2020-06-23 12:10:17 +00:00
|
|
|
PluginVideoCategoryManager,
|
|
|
|
PluginVideoLanguageManager,
|
|
|
|
PluginVideoLicenceManager,
|
|
|
|
PluginVideoPrivacyManager,
|
|
|
|
RegisterServerHookOptions,
|
|
|
|
RegisterServerSettingOptions,
|
2021-04-09 12:51:28 +00:00
|
|
|
ServerConfig,
|
2020-06-23 12:10:17 +00:00
|
|
|
VideoBlacklistCreate
|
|
|
|
} from '@shared/models'
|
|
|
|
import { MVideoThumbnail } from '../models'
|
2020-04-23 09:36:50 +00:00
|
|
|
import {
|
|
|
|
RegisterServerAuthExternalOptions,
|
|
|
|
RegisterServerAuthExternalResult,
|
|
|
|
RegisterServerAuthPassOptions
|
2020-06-23 12:10:17 +00:00
|
|
|
} from './register-server-auth.model'
|
2020-04-09 07:57:32 +00:00
|
|
|
|
|
|
|
export type PeerTubeHelpers = {
|
|
|
|
logger: Logger
|
2020-04-09 09:00:30 +00:00
|
|
|
|
|
|
|
database: {
|
|
|
|
query: Function
|
|
|
|
}
|
2020-04-09 09:35:29 +00:00
|
|
|
|
|
|
|
videos: {
|
2020-12-08 13:30:29 +00:00
|
|
|
loadByUrl: (url: string) => Promise<MVideoThumbnail>
|
2021-02-11 09:23:52 +00:00
|
|
|
loadByIdOrUUID: (id: number | string) => Promise<MVideoThumbnail>
|
2020-05-07 12:58:24 +00:00
|
|
|
|
2020-04-09 09:35:29 +00:00
|
|
|
removeVideo: (videoId: number) => Promise<void>
|
|
|
|
}
|
2020-04-30 06:46:40 +00:00
|
|
|
|
|
|
|
config: {
|
|
|
|
getWebserverUrl: () => string
|
2021-04-09 12:51:28 +00:00
|
|
|
|
|
|
|
getServerConfig: () => Promise<ServerConfig>
|
2020-04-30 06:46:40 +00:00
|
|
|
}
|
2020-05-07 12:58:24 +00:00
|
|
|
|
|
|
|
moderation: {
|
|
|
|
blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise<void>
|
|
|
|
unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise<void>
|
|
|
|
blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise<void>
|
|
|
|
unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise<void>
|
|
|
|
|
|
|
|
blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise<void>
|
|
|
|
unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise<void>
|
|
|
|
}
|
|
|
|
|
|
|
|
server: {
|
|
|
|
getServerActor: () => Promise<ActorModel>
|
|
|
|
}
|
2021-04-09 12:51:28 +00:00
|
|
|
|
|
|
|
plugin: {
|
|
|
|
getBaseStaticRoute: () => string
|
|
|
|
}
|
2020-04-09 07:57:32 +00:00
|
|
|
}
|
2019-07-18 14:43:41 +00:00
|
|
|
|
2019-07-24 09:17:42 +00:00
|
|
|
export type RegisterServerOptions = {
|
|
|
|
registerHook: (options: RegisterServerHookOptions) => void
|
2019-07-18 14:43:41 +00:00
|
|
|
|
2019-07-24 09:17:42 +00:00
|
|
|
registerSetting: (options: RegisterServerSettingOptions) => void
|
2019-07-18 14:43:41 +00:00
|
|
|
|
|
|
|
settingsManager: PluginSettingsManager
|
|
|
|
|
|
|
|
storageManager: PluginStorageManager
|
|
|
|
|
2019-07-26 11:13:39 +00:00
|
|
|
videoCategoryManager: PluginVideoCategoryManager
|
|
|
|
videoLanguageManager: PluginVideoLanguageManager
|
|
|
|
videoLicenceManager: PluginVideoLicenceManager
|
|
|
|
|
2020-04-20 13:32:11 +00:00
|
|
|
videoPrivacyManager: PluginVideoPrivacyManager
|
|
|
|
playlistPrivacyManager: PluginPlaylistPrivacyManager
|
|
|
|
|
2021-01-28 14:52:44 +00:00
|
|
|
transcodingManager: PluginTranscodingManager
|
|
|
|
|
2020-04-22 14:07:04 +00:00
|
|
|
registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
|
|
|
|
registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
|
2020-04-30 08:03:09 +00:00
|
|
|
unregisterIdAndPassAuth: (authName: string) => void
|
|
|
|
unregisterExternalAuth: (authName: string) => void
|
2020-04-22 14:07:04 +00:00
|
|
|
|
2020-04-10 13:07:54 +00:00
|
|
|
// Get plugin router to create custom routes
|
|
|
|
// Base routes of this router are
|
|
|
|
// * /plugins/:pluginName/:pluginVersion/router/...
|
|
|
|
// * /plugins/:pluginName/router/...
|
|
|
|
getRouter(): Router
|
|
|
|
|
2020-04-09 07:57:32 +00:00
|
|
|
peertubeHelpers: PeerTubeHelpers
|
2019-07-18 14:43:41 +00:00
|
|
|
}
|