1 import * as Bluebird from 'bluebird'
2 import { Router } from 'express'
3 import { Logger } from 'winston'
4 import { ActorModel } from '@server/models/activitypub/actor'
5 import { VideoBlacklistCreate } from '@shared/models'
6 import { PluginPlaylistPrivacyManager } from '@shared/models/plugins/plugin-playlist-privacy-manager.model'
7 import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model'
9 RegisterServerAuthExternalOptions,
10 RegisterServerAuthExternalResult,
11 RegisterServerAuthPassOptions
12 } from '@shared/models/plugins/register-server-auth.model'
13 import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model'
14 import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model'
15 import { PluginVideoCategoryManager } from '../../../shared/models/plugins/plugin-video-category-manager.model'
16 import { PluginVideoLanguageManager } from '../../../shared/models/plugins/plugin-video-language-manager.model'
17 import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model'
18 import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model'
19 import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
20 import { MVideoThumbnail } from '../models'
22 export type PeerTubeHelpers = {
30 loadByUrl: (url: string) => Bluebird<MVideoThumbnail>
32 removeVideo: (videoId: number) => Promise<void>
36 getWebserverUrl: () => string
40 blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise<void>
41 unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise<void>
42 blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise<void>
43 unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise<void>
45 blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise<void>
46 unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise<void>
50 getServerActor: () => Promise<ActorModel>
54 export type RegisterServerOptions = {
55 registerHook: (options: RegisterServerHookOptions) => void
57 registerSetting: (options: RegisterServerSettingOptions) => void
59 settingsManager: PluginSettingsManager
61 storageManager: PluginStorageManager
63 videoCategoryManager: PluginVideoCategoryManager
64 videoLanguageManager: PluginVideoLanguageManager
65 videoLicenceManager: PluginVideoLicenceManager
67 videoPrivacyManager: PluginVideoPrivacyManager
68 playlistPrivacyManager: PluginPlaylistPrivacyManager
70 registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
71 registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
72 unregisterIdAndPassAuth: (authName: string) => void
73 unregisterExternalAuth: (authName: string) => void
75 // Get plugin router to create custom routes
76 // Base routes of this router are
77 // * /plugins/:pluginName/:pluginVersion/router/...
78 // * /plugins/:pluginName/router/...
81 peertubeHelpers: PeerTubeHelpers