]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/types/plugins/register-server-option.model.ts
Use 3 tables to represent abuses
[github/Chocobozzz/PeerTube.git] / server / types / plugins / register-server-option.model.ts
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 {
6 PluginPlaylistPrivacyManager,
7 PluginSettingsManager,
8 PluginStorageManager,
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) => Bluebird<MVideoThumbnail>
33
34 removeVideo: (videoId: number) => Promise<void>
35 }
36
37 config: {
38 getWebserverUrl: () => string
39 }
40
41 moderation: {
42 blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise<void>
43 unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise<void>
44 blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise<void>
45 unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise<void>
46
47 blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise<void>
48 unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise<void>
49 }
50
51 server: {
52 getServerActor: () => Promise<ActorModel>
53 }
54 }
55
56 export type RegisterServerOptions = {
57 registerHook: (options: RegisterServerHookOptions) => void
58
59 registerSetting: (options: RegisterServerSettingOptions) => void
60
61 settingsManager: PluginSettingsManager
62
63 storageManager: PluginStorageManager
64
65 videoCategoryManager: PluginVideoCategoryManager
66 videoLanguageManager: PluginVideoLanguageManager
67 videoLicenceManager: PluginVideoLicenceManager
68
69 videoPrivacyManager: PluginVideoPrivacyManager
70 playlistPrivacyManager: PluginPlaylistPrivacyManager
71
72 registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
73 registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
74 unregisterIdAndPassAuth: (authName: string) => void
75 unregisterExternalAuth: (authName: string) => void
76
77 // Get plugin router to create custom routes
78 // Base routes of this router are
79 // * /plugins/:pluginName/:pluginVersion/router/...
80 // * /plugins/:pluginName/router/...
81 getRouter(): Router
82
83 peertubeHelpers: PeerTubeHelpers
84 }