]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/types/plugins/register-server-option.model.ts
Add ffprobe helper
[github/Chocobozzz/PeerTube.git] / server / types / plugins / register-server-option.model.ts
CommitLineData
7d9ba5c0 1import { Response, Router } from 'express'
80fdaf06 2import { Logger } from 'winston'
7d9ba5c0 3import { ActorModel } from '@server/models/actor/actor'
67ed6552
C
4import {
5 PluginPlaylistPrivacyManager,
6 PluginSettingsManager,
7 PluginStorageManager,
1896bca0 8 PluginTranscodingManager,
67ed6552
C
9 PluginVideoCategoryManager,
10 PluginVideoLanguageManager,
11 PluginVideoLicenceManager,
12 PluginVideoPrivacyManager,
13 RegisterServerHookOptions,
14 RegisterServerSettingOptions,
22820226 15 ServerConfig,
2e9c7877 16 ThumbnailType,
302eba0d 17 UserRole,
67ed6552
C
18 VideoBlacklistCreate
19} from '@shared/models'
20import { MVideoThumbnail } from '../models'
e1c55031
C
21import {
22 RegisterServerAuthExternalOptions,
23 RegisterServerAuthExternalResult,
24 RegisterServerAuthPassOptions
67ed6552 25} from './register-server-auth.model'
bc0d801b
C
26
27export type PeerTubeHelpers = {
28 logger: Logger
1b05d82d
C
29
30 database: {
31 query: Function
32 }
ab3ead3a
C
33
34 videos: {
b49f22d8 35 loadByUrl: (url: string) => Promise<MVideoThumbnail>
6559da28 36 loadByIdOrUUID: (id: number | string) => Promise<MVideoThumbnail>
80fdaf06 37
ab3ead3a 38 removeVideo: (videoId: number) => Promise<void>
2e9c7877 39
754c52b9
C
40 ffprobe: (path: string) => Promise<any>
41
2e9c7877
C
42 getFiles: (id: number | string) => Promise<{
43 webtorrent: {
44 videoFiles: {
45 path: string // Could be null if using remote storage
46 url: string
47 resolution: number
48 size: number
49 fps: number
50 }[]
51 }
52
53 hls: {
54 videoFiles: {
55 path: string // Could be null if using remote storage
56 url: string
57 resolution: number
58 size: number
59 fps: number
60 }[]
61 }
62
63 thumbnails: {
64 type: ThumbnailType
65 path: string
66 }[]
67 }>
ab3ead3a 68 }
5a7eecdd
C
69
70 config: {
71 getWebserverUrl: () => string
22820226
C
72
73 getServerConfig: () => Promise<ServerConfig>
5a7eecdd 74 }
80fdaf06
C
75
76 moderation: {
77 blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise<void>
78 unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise<void>
79 blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise<void>
80 unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise<void>
81
82 blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise<void>
83 unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise<void>
84 }
85
86 server: {
87 getServerActor: () => Promise<ActorModel>
88 }
22820226
C
89
90 plugin: {
096231d0 91 // PeerTube >= 3.2
22820226 92 getBaseStaticRoute: () => string
302eba0d 93
096231d0 94 // PeerTube >= 3.2
302eba0d
C
95 getBaseRouterRoute: () => string
96
096231d0 97 // PeerTube >= 3.2
302eba0d
C
98 getDataDirectoryPath: () => string
99 }
100
101 user: {
096231d0 102 // PeerTube >= 3.2
b31d7262 103 getAuthUser: (response: Response) => Promise<{
302eba0d
C
104 id?: string
105 username: string
106 email: string
107 blocked: boolean
108 role: UserRole
b31d7262 109 } | undefined>
22820226 110 }
bc0d801b 111}
32fe0013 112
9ae88819
C
113export type RegisterServerOptions = {
114 registerHook: (options: RegisterServerHookOptions) => void
32fe0013 115
9ae88819 116 registerSetting: (options: RegisterServerSettingOptions) => void
32fe0013
C
117
118 settingsManager: PluginSettingsManager
119
120 storageManager: PluginStorageManager
121
ee286591
C
122 videoCategoryManager: PluginVideoCategoryManager
123 videoLanguageManager: PluginVideoLanguageManager
124 videoLicenceManager: PluginVideoLicenceManager
125
b3af2601
C
126 videoPrivacyManager: PluginVideoPrivacyManager
127 playlistPrivacyManager: PluginPlaylistPrivacyManager
128
1896bca0
C
129 transcodingManager: PluginTranscodingManager
130
7fed6375
C
131 registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
132 registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
a4995eb7
C
133 unregisterIdAndPassAuth: (authName: string) => void
134 unregisterExternalAuth: (authName: string) => void
7fed6375 135
5e2b2e27
C
136 // Get plugin router to create custom routes
137 // Base routes of this router are
138 // * /plugins/:pluginName/:pluginVersion/router/...
139 // * /plugins/:pluginName/router/...
140 getRouter(): Router
141
bc0d801b 142 peertubeHelpers: PeerTubeHelpers
32fe0013 143}