]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/types/plugins/register-server-option.model.ts
1ca17e4ab88ad2a563436e7558085c398f7af2fa
[github/Chocobozzz/PeerTube.git] / server / types / plugins / register-server-option.model.ts
1 import { Router } from 'express'
2 import { Logger } from 'winston'
3 import { ActorModel } from '@server/models/activitypub/actor'
4 import {
5 PluginPlaylistPrivacyManager,
6 PluginSettingsManager,
7 PluginStorageManager,
8 PluginTranscodingManager,
9 PluginVideoCategoryManager,
10 PluginVideoLanguageManager,
11 PluginVideoLicenceManager,
12 PluginVideoPrivacyManager,
13 RegisterServerHookOptions,
14 RegisterServerSettingOptions,
15 VideoBlacklistCreate
16 } from '@shared/models'
17 import { MVideoThumbnail } from '../models'
18 import {
19 RegisterServerAuthExternalOptions,
20 RegisterServerAuthExternalResult,
21 RegisterServerAuthPassOptions
22 } from './register-server-auth.model'
23
24 export type PeerTubeHelpers = {
25 logger: Logger
26
27 database: {
28 query: Function
29 }
30
31 videos: {
32 loadByUrl: (url: string) => Promise<MVideoThumbnail>
33 loadByIdOrUUID: (id: number | string) => Promise<MVideoThumbnail>
34
35 removeVideo: (videoId: number) => Promise<void>
36 }
37
38 config: {
39 getWebserverUrl: () => string
40 }
41
42 moderation: {
43 blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise<void>
44 unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise<void>
45 blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise<void>
46 unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise<void>
47
48 blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise<void>
49 unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise<void>
50 }
51
52 server: {
53 getServerActor: () => Promise<ActorModel>
54 }
55 }
56
57 export type RegisterServerOptions = {
58 registerHook: (options: RegisterServerHookOptions) => void
59
60 registerSetting: (options: RegisterServerSettingOptions) => void
61
62 settingsManager: PluginSettingsManager
63
64 storageManager: PluginStorageManager
65
66 videoCategoryManager: PluginVideoCategoryManager
67 videoLanguageManager: PluginVideoLanguageManager
68 videoLicenceManager: PluginVideoLicenceManager
69
70 videoPrivacyManager: PluginVideoPrivacyManager
71 playlistPrivacyManager: PluginPlaylistPrivacyManager
72
73 transcodingManager: PluginTranscodingManager
74
75 registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
76 registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
77 unregisterIdAndPassAuth: (authName: string) => void
78 unregisterExternalAuth: (authName: string) => void
79
80 // Get plugin router to create custom routes
81 // Base routes of this router are
82 // * /plugins/:pluginName/:pluginVersion/router/...
83 // * /plugins/:pluginName/router/...
84 getRouter(): Router
85
86 peertubeHelpers: PeerTubeHelpers
87 }