From 67ed6552b831df66713bac9e672738796128d33f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 23 Jun 2020 14:10:17 +0200 Subject: Reorganize client shared modules --- .../types/plugins/register-server-option.model.ts | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 server/types/plugins/register-server-option.model.ts (limited to 'server/types/plugins/register-server-option.model.ts') diff --git a/server/types/plugins/register-server-option.model.ts b/server/types/plugins/register-server-option.model.ts new file mode 100644 index 000000000..74303d383 --- /dev/null +++ b/server/types/plugins/register-server-option.model.ts @@ -0,0 +1,84 @@ +import * as Bluebird from 'bluebird' +import { Router } from 'express' +import { Logger } from 'winston' +import { ActorModel } from '@server/models/activitypub/actor' +import { + PluginPlaylistPrivacyManager, + PluginSettingsManager, + PluginStorageManager, + PluginVideoCategoryManager, + PluginVideoLanguageManager, + PluginVideoLicenceManager, + PluginVideoPrivacyManager, + RegisterServerHookOptions, + RegisterServerSettingOptions, + VideoBlacklistCreate +} from '@shared/models' +import { MVideoThumbnail } from '../models' +import { + RegisterServerAuthExternalOptions, + RegisterServerAuthExternalResult, + RegisterServerAuthPassOptions +} from './register-server-auth.model' + +export type PeerTubeHelpers = { + logger: Logger + + database: { + query: Function + } + + videos: { + loadByUrl: (url: string) => Bluebird + + removeVideo: (videoId: number) => Promise + } + + config: { + getWebserverUrl: () => string + } + + moderation: { + blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise + unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise + blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise + unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise + + blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise + unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise + } + + server: { + getServerActor: () => Promise + } +} + +export type RegisterServerOptions = { + registerHook: (options: RegisterServerHookOptions) => void + + registerSetting: (options: RegisterServerSettingOptions) => void + + settingsManager: PluginSettingsManager + + storageManager: PluginStorageManager + + videoCategoryManager: PluginVideoCategoryManager + videoLanguageManager: PluginVideoLanguageManager + videoLicenceManager: PluginVideoLicenceManager + + videoPrivacyManager: PluginVideoPrivacyManager + playlistPrivacyManager: PluginPlaylistPrivacyManager + + registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void + registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult + unregisterIdAndPassAuth: (authName: string) => void + unregisterExternalAuth: (authName: string) => void + + // Get plugin router to create custom routes + // Base routes of this router are + // * /plugins/:pluginName/:pluginVersion/router/... + // * /plugins/:pluginName/router/... + getRouter(): Router + + peertubeHelpers: PeerTubeHelpers +} -- cgit v1.2.3