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 --- shared/models/actors/index.ts | 1 + shared/models/index.ts | 3 +- shared/models/plugins/index.ts | 24 +++++++++ .../plugin-playlist-privacy-manager.model.ts | 2 +- .../plugins/plugin-video-privacy-manager.model.ts | 2 +- .../models/plugins/register-server-auth.model.ts | 52 ------------------ shared/models/search/index.ts | 1 + shared/models/server/index.ts | 1 + shared/models/users/index.ts | 10 ++-- shared/models/videos/abuse/index.ts | 5 ++ shared/models/videos/blacklist/index.ts | 3 ++ shared/models/videos/caption/index.ts | 2 + shared/models/videos/channel/index.ts | 3 ++ shared/models/videos/import/index.ts | 3 ++ shared/models/videos/index.ts | 63 +++++++++++----------- shared/models/videos/playlist/index.ts | 10 ++++ shared/models/videos/rate/index.ts | 5 ++ shared/models/videos/video-file-metadata.ts | 4 +- shared/models/videos/video-sort-field.type.ts | 8 +++ 19 files changed, 108 insertions(+), 94 deletions(-) create mode 100644 shared/models/plugins/index.ts delete mode 100644 shared/models/plugins/register-server-auth.model.ts create mode 100644 shared/models/videos/abuse/index.ts create mode 100644 shared/models/videos/blacklist/index.ts create mode 100644 shared/models/videos/caption/index.ts create mode 100644 shared/models/videos/channel/index.ts create mode 100644 shared/models/videos/import/index.ts create mode 100644 shared/models/videos/playlist/index.ts create mode 100644 shared/models/videos/rate/index.ts create mode 100644 shared/models/videos/video-sort-field.type.ts (limited to 'shared/models') diff --git a/shared/models/actors/index.ts b/shared/models/actors/index.ts index 8fe437b81..c7a92399d 100644 --- a/shared/models/actors/index.ts +++ b/shared/models/actors/index.ts @@ -1,2 +1,3 @@ export * from './account.model' +export * from './actor.model' export * from './follow.model' diff --git a/shared/models/index.ts b/shared/models/index.ts index b562e04a3..3d4bdedde 100644 --- a/shared/models/index.ts +++ b/shared/models/index.ts @@ -9,8 +9,9 @@ export * from './videos' export * from './feeds' export * from './i18n' export * from './overviews' +export * from './plugins' export * from './search' -export * from './server/job.model' +export * from './server' export * from './oauth-client-local.model' export * from './result-list.model' export * from './server/server-config.model' diff --git a/shared/models/plugins/index.ts b/shared/models/plugins/index.ts new file mode 100644 index 000000000..209fca791 --- /dev/null +++ b/shared/models/plugins/index.ts @@ -0,0 +1,24 @@ +export * from './client-hook.model' +export * from './hook-type.enum' +export * from './install-plugin.model' +export * from './manage-plugin.model' +export * from './peertube-plugin-index-list.model' +export * from './peertube-plugin-index.model' +export * from './peertube-plugin-latest-version.model' +export * from './peertube-plugin.model' +export * from './plugin-client-scope.type' +export * from './plugin-package-json.model' +export * from './plugin-playlist-privacy-manager.model' +export * from './plugin-settings-manager.model' +export * from './plugin-storage-manager.model' +export * from './plugin-translation.model' +export * from './plugin-video-category-manager.model' +export * from './plugin-video-language-manager.model' +export * from './plugin-video-licence-manager.model' +export * from './plugin-video-privacy-manager.model' +export * from './plugin.type' +export * from './public-server.setting' +export * from './register-client-hook.model' +export * from './register-server-hook.model' +export * from './register-server-setting.model' +export * from './server-hook.model' diff --git a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts b/shared/models/plugins/plugin-playlist-privacy-manager.model.ts index f9630c77f..d1823ef4e 100644 --- a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts +++ b/shared/models/plugins/plugin-playlist-privacy-manager.model.ts @@ -1,4 +1,4 @@ -import { VideoPlaylistPrivacy } from '@shared/models' +import { VideoPlaylistPrivacy } from '../videos/playlist/video-playlist-privacy.model' export interface PluginPlaylistPrivacyManager { // PUBLIC = 1, diff --git a/shared/models/plugins/plugin-video-privacy-manager.model.ts b/shared/models/plugins/plugin-video-privacy-manager.model.ts index d602ba297..c0e8117b5 100644 --- a/shared/models/plugins/plugin-video-privacy-manager.model.ts +++ b/shared/models/plugins/plugin-video-privacy-manager.model.ts @@ -1,4 +1,4 @@ -import { VideoPrivacy } from '@shared/models' +import { VideoPrivacy } from '@shared/models/videos/video-privacy.enum' export interface PluginVideoPrivacyManager { // PUBLIC = 1 diff --git a/shared/models/plugins/register-server-auth.model.ts b/shared/models/plugins/register-server-auth.model.ts deleted file mode 100644 index fc6f0f258..000000000 --- a/shared/models/plugins/register-server-auth.model.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { UserRole } from '@shared/models' -import { MOAuthToken, MUser } from '@server/types/models' -import * as express from 'express' - -export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions - -export interface RegisterServerAuthenticatedResult { - username: string - email: string - role?: UserRole - displayName?: string -} - -export interface RegisterServerExternalAuthenticatedResult extends RegisterServerAuthenticatedResult { - req: express.Request - res: express.Response -} - -interface RegisterServerAuthBase { - // Authentication name (a plugin can register multiple auth strategies) - authName: string - - // Called by PeerTube when a user from your plugin logged out - onLogout?(user: MUser): void - - // Your plugin can hook PeerTube access/refresh token validity - // So you can control for your plugin the user session lifetime - hookTokenValidity?(options: { token: MOAuthToken, type: 'access' | 'refresh' }): Promise<{ valid: boolean }> -} - -export interface RegisterServerAuthPassOptions extends RegisterServerAuthBase { - // Weight of this authentication so PeerTube tries the auth methods in DESC weight order - getWeight(): number - - // Used by PeerTube to login a user - // Returns null if the login failed, or { username, email } on success - login(body: { - id: string - password: string - }): Promise -} - -export interface RegisterServerAuthExternalOptions extends RegisterServerAuthBase { - // Will be displayed in a block next to the login form - authDisplayName: () => string - - onAuthRequest: (req: express.Request, res: express.Response) => void -} - -export interface RegisterServerAuthExternalResult { - userAuthenticated (options: RegisterServerExternalAuthenticatedResult): void -} diff --git a/shared/models/search/index.ts b/shared/models/search/index.ts index 28dd95443..e2d0ab620 100644 --- a/shared/models/search/index.ts +++ b/shared/models/search/index.ts @@ -1,3 +1,4 @@ export * from './nsfw-query.model' +export * from './search-target-query.model' export * from './videos-search-query.model' export * from './video-channels-search-query.model' diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts index 2bb443d46..b079bc9a0 100644 --- a/shared/models/server/index.ts +++ b/shared/models/server/index.ts @@ -5,5 +5,6 @@ export * from './custom-config.model' export * from './debug.model' export * from './emailer.model' export * from './job.model' +export * from './log-level.type' export * from './server-config.model' export * from './server-stats.model' diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts index cd07cf320..a9d578054 100644 --- a/shared/models/users/index.ts +++ b/shared/models/users/index.ts @@ -1,12 +1,14 @@ -export * from './user.model' export * from './user-create.model' +export * from './user-flag.model' export * from './user-login.model' -export * from './user-notification.model' export * from './user-notification-setting.model' +export * from './user-notification.model' export * from './user-refresh-token.model' -export * from './user-update.model' -export * from './user-update-me.model' +export * from './user-register.model' export * from './user-right.enum' export * from './user-role' +export * from './user-update-me.model' +export * from './user-update.model' export * from './user-video-quota.model' export * from './user-watching-video.model' +export * from './user.model' diff --git a/shared/models/videos/abuse/index.ts b/shared/models/videos/abuse/index.ts new file mode 100644 index 000000000..bdeef1dad --- /dev/null +++ b/shared/models/videos/abuse/index.ts @@ -0,0 +1,5 @@ +export * from './video-abuse-create.model' +export * from './video-abuse-state.model' +export * from './video-abuse-update.model' +export * from './video-abuse-video-is.type' +export * from './video-abuse.model' diff --git a/shared/models/videos/blacklist/index.ts b/shared/models/videos/blacklist/index.ts new file mode 100644 index 000000000..66082be34 --- /dev/null +++ b/shared/models/videos/blacklist/index.ts @@ -0,0 +1,3 @@ +export * from './video-blacklist.model' +export * from './video-blacklist-create.model' +export * from './video-blacklist-update.model' diff --git a/shared/models/videos/caption/index.ts b/shared/models/videos/caption/index.ts new file mode 100644 index 000000000..2a5ff512d --- /dev/null +++ b/shared/models/videos/caption/index.ts @@ -0,0 +1,2 @@ +export * from './video-caption.model' +export * from './video-caption-update.model' diff --git a/shared/models/videos/channel/index.ts b/shared/models/videos/channel/index.ts new file mode 100644 index 000000000..9dbaa42da --- /dev/null +++ b/shared/models/videos/channel/index.ts @@ -0,0 +1,3 @@ +export * from './video-channel-create.model' +export * from './video-channel-update.model' +export * from './video-channel.model' diff --git a/shared/models/videos/import/index.ts b/shared/models/videos/import/index.ts new file mode 100644 index 000000000..8884ee8f2 --- /dev/null +++ b/shared/models/videos/import/index.ts @@ -0,0 +1,3 @@ +export * from './video-import-create.model' +export * from './video-import-state.enum' +export * from './video-import.model' diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 58bd1ebd7..e1d96b40a 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -1,41 +1,38 @@ -export * from './rate/user-video-rate-update.model' -export * from './rate/user-video-rate.model' -export * from './rate/account-video-rate.model' -export * from './rate/user-video-rate.type' -export * from './abuse/video-abuse-state.model' -export * from './abuse/video-abuse-create.model' -export * from './abuse/video-abuse-reason.model' -export * from './abuse/video-abuse.model' -export * from './abuse/video-abuse-update.model' -export * from './blacklist/video-blacklist.model' -export * from './blacklist/video-blacklist-create.model' -export * from './blacklist/video-blacklist-update.model' -export * from './channel/video-channel-create.model' -export * from './channel/video-channel-update.model' -export * from './channel/video-channel.model' -export * from './playlist/video-playlist-create.model' -export * from './playlist/video-playlist-element-create.model' -export * from './playlist/video-playlist-element-update.model' -export * from './playlist/video-playlist-privacy.model' -export * from './playlist/video-playlist-type.model' -export * from './playlist/video-playlist-update.model' -export * from './playlist/video-playlist.model' -export * from './playlist/video-playlist-element.model' -export * from './video-change-ownership.model' +export * from './abuse' +export * from './blacklist' +export * from './caption' +export * from './channel' +export * from './import' +export * from './playlist' +export * from './rate' + +export * from './nsfw-policy.type' + +export * from './thumbnail.type' + +export * from './video-change-ownership-accept.model' export * from './video-change-ownership-create.model' +export * from './video-change-ownership.model' + +export * from './video-comment.model' +export * from './video-constant.model' export * from './video-create.model' +export * from './video-file-metadata' export * from './video-file.model' + export * from './video-privacy.enum' +export * from './video-query.type' export * from './video-rate.type' export * from './video-resolution.enum' -export * from './video-update.model' -export * from './video.model' -export * from './video-query.type' + +export * from './video-schedule-update.model' +export * from './video-sort-field.type' export * from './video-state.enum' + +export * from './video-streaming-playlist.model' +export * from './video-streaming-playlist.type' + export * from './video-transcoding-fps.model' -export * from './caption/video-caption.model' -export * from './caption/video-caption-update.model' -export * from './import/video-import-create.model' -export * from './import/video-import-state.enum' -export * from './import/video-import.model' -export * from './video-constant.model' + +export * from './video-update.model' +export * from './video.model' diff --git a/shared/models/videos/playlist/index.ts b/shared/models/videos/playlist/index.ts new file mode 100644 index 000000000..99f7e9bab --- /dev/null +++ b/shared/models/videos/playlist/index.ts @@ -0,0 +1,10 @@ +export * from './video-exist-in-playlist.model' +export * from './video-playlist-create.model' +export * from './video-playlist-element-create.model' +export * from './video-playlist-element-update.model' +export * from './video-playlist-element.model' +export * from './video-playlist-privacy.model' +export * from './video-playlist-reorder.model' +export * from './video-playlist-type.model' +export * from './video-playlist-update.model' +export * from './video-playlist.model' diff --git a/shared/models/videos/rate/index.ts b/shared/models/videos/rate/index.ts new file mode 100644 index 000000000..06aa691bd --- /dev/null +++ b/shared/models/videos/rate/index.ts @@ -0,0 +1,5 @@ + +export * from './user-video-rate-update.model' +export * from './user-video-rate.model' +export * from './account-video-rate.model' +export * from './user-video-rate.type' diff --git a/shared/models/videos/video-file-metadata.ts b/shared/models/videos/video-file-metadata.ts index 15683cacf..010bf7cf5 100644 --- a/shared/models/videos/video-file-metadata.ts +++ b/shared/models/videos/video-file-metadata.ts @@ -1,5 +1,5 @@ -import { FfprobeData } from "fluent-ffmpeg" -import { DeepOmit } from "@server/models/utils" +import { FfprobeData } from 'fluent-ffmpeg' +import { DeepOmit } from '../../core-utils' export type VideoFileMetadataModel = DeepOmit diff --git a/shared/models/videos/video-sort-field.type.ts b/shared/models/videos/video-sort-field.type.ts new file mode 100644 index 000000000..f2e70f5fa --- /dev/null +++ b/shared/models/videos/video-sort-field.type.ts @@ -0,0 +1,8 @@ +export type VideoSortField = + 'name' | '-name' | + 'duration' | '-duration' | + 'publishedAt' | '-publishedAt' | + 'createdAt' | '-createdAt' | + 'views' | '-views' | + 'likes' | '-likes' | + 'trending' | '-trending' -- cgit v1.2.3