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