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