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 --- server/typings/express/index.d.ts | 28 +++++--- server/typings/plugins/index.d.ts | 2 - server/typings/plugins/plugin-library.model.ts | 7 -- .../plugins/register-server-option.model.ts | 82 ---------------------- 4 files changed, 17 insertions(+), 102 deletions(-) delete mode 100644 server/typings/plugins/index.d.ts delete mode 100644 server/typings/plugins/plugin-library.model.ts delete mode 100644 server/typings/plugins/register-server-option.model.ts (limited to 'server/typings') diff --git a/server/typings/express/index.d.ts b/server/typings/express/index.d.ts index ad3212340..cac801e55 100644 --- a/server/typings/express/index.d.ts +++ b/server/typings/express/index.d.ts @@ -1,3 +1,20 @@ +import { RegisterServerAuthExternalOptions } from '@server/types' +import { + MAccountBlocklist, + MActorUrl, + MStreamingPlaylist, + MVideoChangeOwnershipFull, + MVideoFile, + MVideoImmutable, + MVideoPlaylistFull, + MVideoPlaylistFullSummary +} from '@server/types/models' +import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' +import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server' +import { MVideoImportDefault } from '@server/types/models/video/video-import' +import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' +import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' +import { UserRole } from '@shared/models' import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' import { MAccountDefault, @@ -19,17 +36,6 @@ import { MVideoThumbnail, MVideoWithRights } from '../../types/models' -import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from '../../types/models/video/video-playlist' -import { MVideoImportDefault } from '@server/types/models/video/video-import' -import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/types/models' -import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' -import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' -import { MVideoChangeOwnershipFull } from '../../types/models/video/video-change-ownership' -import { MPlugin, MServer } from '@server/types/models/server' -import { MServerBlocklist } from '../../types/models/server/server-blocklist' -import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' -import { UserRole } from '@shared/models' -import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' declare module 'express' { export interface Request { diff --git a/server/typings/plugins/index.d.ts b/server/typings/plugins/index.d.ts deleted file mode 100644 index 9570579ef..000000000 --- a/server/typings/plugins/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './register-server-option.model' -export * from './plugin-library.model' diff --git a/server/typings/plugins/plugin-library.model.ts b/server/typings/plugins/plugin-library.model.ts deleted file mode 100644 index 5b517ee9f..000000000 --- a/server/typings/plugins/plugin-library.model.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { RegisterServerOptions } from './register-server-option.model' - -export interface PluginLibrary { - register: (options: RegisterServerOptions) => Promise - - unregister: () => Promise -} diff --git a/server/typings/plugins/register-server-option.model.ts b/server/typings/plugins/register-server-option.model.ts deleted file mode 100644 index b4594c6cd..000000000 --- a/server/typings/plugins/register-server-option.model.ts +++ /dev/null @@ -1,82 +0,0 @@ -import * as Bluebird from 'bluebird' -import { Router } from 'express' -import { Logger } from 'winston' -import { ActorModel } from '@server/models/activitypub/actor' -import { VideoBlacklistCreate } from '@shared/models' -import { PluginPlaylistPrivacyManager } from '@shared/models/plugins/plugin-playlist-privacy-manager.model' -import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model' -import { - RegisterServerAuthExternalOptions, - RegisterServerAuthExternalResult, - RegisterServerAuthPassOptions -} from '@shared/models/plugins/register-server-auth.model' -import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' -import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' -import { PluginVideoCategoryManager } from '../../../shared/models/plugins/plugin-video-category-manager.model' -import { PluginVideoLanguageManager } from '../../../shared/models/plugins/plugin-video-language-manager.model' -import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model' -import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model' -import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model' -import { MVideoThumbnail } from '../../types/models' - -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