1
0
Fork 0
peertube/server/types/plugins/register-server-option.mode...

147 lines
3.8 KiB
TypeScript
Raw Normal View History

2021-05-11 09:15:29 +00:00
import { Response, Router } from 'express'
2020-05-07 12:58:24 +00:00
import { Logger } from 'winston'
2021-05-11 09:15:29 +00:00
import { ActorModel } from '@server/models/actor/actor'
2020-06-23 12:10:17 +00:00
import {
PluginPlaylistPrivacyManager,
PluginSettingsManager,
PluginStorageManager,
PluginTranscodingManager,
2020-06-23 12:10:17 +00:00
PluginVideoCategoryManager,
PluginVideoLanguageManager,
PluginVideoLicenceManager,
PluginVideoPrivacyManager,
RegisterServerHookOptions,
RegisterServerSettingOptions,
2021-04-09 12:51:28 +00:00
ServerConfig,
2021-12-16 15:49:43 +00:00
ThumbnailType,
UserRole,
2020-06-23 12:10:17 +00:00
VideoBlacklistCreate
} from '@shared/models'
import { MVideoThumbnail } from '../models'
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
}
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
removeVideo: (videoId: number) => Promise<void>
2021-12-16 15:49:43 +00:00
2021-12-16 16:00:46 +00:00
ffprobe: (path: string) => Promise<any>
2021-12-16 15:49:43 +00:00
getFiles: (id: number | string) => Promise<{
webtorrent: {
videoFiles: {
path: string // Could be null if using remote storage
url: string
resolution: number
size: number
fps: number
}[]
}
hls: {
videoFiles: {
path: string // Could be null if using remote storage
url: string
resolution: number
size: number
fps: number
}[]
}
thumbnails: {
type: ThumbnailType
path: string
}[]
}>
}
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: {
2021-04-22 09:42:51 +00:00
// PeerTube >= 3.2
2021-04-09 12:51:28 +00:00
getBaseStaticRoute: () => string
2021-04-22 09:42:51 +00:00
// PeerTube >= 3.2
getBaseRouterRoute: () => string
2021-04-22 09:42:51 +00:00
// PeerTube >= 3.2
getDataDirectoryPath: () => string
}
user: {
2021-04-22 09:42:51 +00:00
// PeerTube >= 3.2
getAuthUser: (response: Response) => Promise<{
id?: string
username: string
email: string
blocked: boolean
role: UserRole
Account: {
name: string
}
} | undefined>
2021-04-09 12:51:28 +00:00
}
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
videoCategoryManager: PluginVideoCategoryManager
videoLanguageManager: PluginVideoLanguageManager
videoLicenceManager: PluginVideoLicenceManager
videoPrivacyManager: PluginVideoPrivacyManager
playlistPrivacyManager: PluginPlaylistPrivacyManager
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
// 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
}