From d7a25329f9e607894d29ab342b9cb66638b56dc0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Nov 2019 15:06:03 +0100 Subject: Add ability to disable webtorrent In favour of HLS --- server/typings/models/account/account.ts | 2 +- server/typings/models/account/actor-follow.ts | 5 ++--- server/typings/models/account/index.d.ts | 5 ----- server/typings/models/account/index.ts | 5 +++++ server/typings/models/index.d.ts | 5 ----- server/typings/models/index.ts | 5 +++++ server/typings/models/oauth/index.d.ts | 2 -- server/typings/models/oauth/index.ts | 2 ++ server/typings/models/oauth/oauth-token.ts | 2 +- server/typings/models/server/index.d.ts | 3 --- server/typings/models/server/index.ts | 3 +++ server/typings/models/server/server-blocklist.ts | 3 ++- server/typings/models/user/index.d.ts | 4 ---- server/typings/models/user/index.ts | 4 ++++ server/typings/models/user/user.ts | 2 +- server/typings/models/video/index.d.ts | 18 ------------------ server/typings/models/video/index.ts | 18 ++++++++++++++++++ server/typings/models/video/schedule-video-update.ts | 9 +++++++++ server/typings/models/video/video-blacklist.ts | 2 +- server/typings/models/video/video-caption.ts | 2 +- server/typings/models/video/video-change-ownership.ts | 5 +++-- server/typings/models/video/video-comment.ts | 2 +- server/typings/models/video/video-file.ts | 17 ++++++++++++++++- server/typings/models/video/video-import.ts | 3 ++- server/typings/models/video/video-playlist-element.ts | 3 ++- server/typings/models/video/video-rate.ts | 3 ++- server/typings/models/video/video-redundancy.ts | 6 +++--- .../typings/models/video/video-streaming-playlist.ts | 18 ++++++++++++++++-- server/typings/models/video/video.ts | 18 ++++++++++-------- 29 files changed, 110 insertions(+), 66 deletions(-) delete mode 100644 server/typings/models/account/index.d.ts create mode 100644 server/typings/models/account/index.ts delete mode 100644 server/typings/models/index.d.ts create mode 100644 server/typings/models/index.ts delete mode 100644 server/typings/models/oauth/index.d.ts create mode 100644 server/typings/models/oauth/index.ts delete mode 100644 server/typings/models/server/index.d.ts create mode 100644 server/typings/models/server/index.ts delete mode 100644 server/typings/models/user/index.d.ts create mode 100644 server/typings/models/user/index.ts delete mode 100644 server/typings/models/video/index.d.ts create mode 100644 server/typings/models/video/index.ts (limited to 'server/typings') diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index ec78fece8..adb1f3689 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts @@ -15,7 +15,7 @@ import { } from './actor' import { FunctionProperties, PickWith } from '../../utils' import { MAccountBlocklistId } from './account-blocklist' -import { MChannelDefault } from '@server/typings/models' +import { MChannelDefault } from '../video/video-channels' type Use = PickWith diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts index 1c66eb0a0..f44157eba 100644 --- a/server/typings/models/account/actor-follow.ts +++ b/server/typings/models/account/actor-follow.ts @@ -1,17 +1,16 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { MActor, - MActorAccount, - MActorDefaultAccountChannel, MActorChannelAccountActor, MActorDefault, + MActorDefaultAccountChannel, MActorFormattable, MActorHost, MActorUsername } from './actor' import { PickWith } from '../../utils' import { ActorModel } from '@server/models/activitypub/actor' -import { MChannelDefault } from '@server/typings/models' +import { MChannelDefault } from '../video/video-channels' type Use = PickWith diff --git a/server/typings/models/account/index.d.ts b/server/typings/models/account/index.d.ts deleted file mode 100644 index 513c09c40..000000000 --- a/server/typings/models/account/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './account' -export * from './account-blocklist' -export * from './actor' -export * from './actor-follow' -export * from './avatar' diff --git a/server/typings/models/account/index.ts b/server/typings/models/account/index.ts new file mode 100644 index 000000000..513c09c40 --- /dev/null +++ b/server/typings/models/account/index.ts @@ -0,0 +1,5 @@ +export * from './account' +export * from './account-blocklist' +export * from './actor' +export * from './actor-follow' +export * from './avatar' diff --git a/server/typings/models/index.d.ts b/server/typings/models/index.d.ts deleted file mode 100644 index 78b4948ce..000000000 --- a/server/typings/models/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './account' -export * from './oauth' -export * from './server' -export * from './user' -export * from './video' diff --git a/server/typings/models/index.ts b/server/typings/models/index.ts new file mode 100644 index 000000000..78b4948ce --- /dev/null +++ b/server/typings/models/index.ts @@ -0,0 +1,5 @@ +export * from './account' +export * from './oauth' +export * from './server' +export * from './user' +export * from './video' diff --git a/server/typings/models/oauth/index.d.ts b/server/typings/models/oauth/index.d.ts deleted file mode 100644 index 36b7ea8ca..000000000 --- a/server/typings/models/oauth/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './oauth-client' -export * from './oauth-token' diff --git a/server/typings/models/oauth/index.ts b/server/typings/models/oauth/index.ts new file mode 100644 index 000000000..36b7ea8ca --- /dev/null +++ b/server/typings/models/oauth/index.ts @@ -0,0 +1,2 @@ +export * from './oauth-client' +export * from './oauth-token' diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.ts index af3412925..8ef042d4e 100644 --- a/server/typings/models/oauth/oauth-token.ts +++ b/server/typings/models/oauth/oauth-token.ts @@ -1,6 +1,6 @@ import { OAuthTokenModel } from '@server/models/oauth/oauth-token' import { PickWith } from '@server/typings/utils' -import { MUserAccountUrl } from '@server/typings/models' +import { MUserAccountUrl } from '../user/user' type Use = PickWith diff --git a/server/typings/models/server/index.d.ts b/server/typings/models/server/index.d.ts deleted file mode 100644 index c853795ad..000000000 --- a/server/typings/models/server/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './plugin' -export * from './server' -export * from './server-blocklist' diff --git a/server/typings/models/server/index.ts b/server/typings/models/server/index.ts new file mode 100644 index 000000000..c853795ad --- /dev/null +++ b/server/typings/models/server/index.ts @@ -0,0 +1,3 @@ +export * from './plugin' +export * from './server' +export * from './server-blocklist' diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts index c81f604f5..c3e6230f2 100644 --- a/server/typings/models/server/server-blocklist.ts +++ b/server/typings/models/server/server-blocklist.ts @@ -1,6 +1,7 @@ import { ServerBlocklistModel } from '@server/models/server/server-blocklist' import { PickWith } from '@server/typings/utils' -import { MAccountDefault, MAccountFormattable, MServer, MServerFormattable } from '@server/typings/models' +import { MAccountDefault, MAccountFormattable } from '../account/account' +import { MServer, MServerFormattable } from './server' type Use = PickWith diff --git a/server/typings/models/user/index.d.ts b/server/typings/models/user/index.d.ts deleted file mode 100644 index 6657b2128..000000000 --- a/server/typings/models/user/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './user' -export * from './user-notification' -export * from './user-notification-setting' -export * from './user-video-history' diff --git a/server/typings/models/user/index.ts b/server/typings/models/user/index.ts new file mode 100644 index 000000000..6657b2128 --- /dev/null +++ b/server/typings/models/user/index.ts @@ -0,0 +1,4 @@ +export * from './user' +export * from './user-notification' +export * from './user-notification-setting' +export * from './user-video-history' diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts index 52d6d4a05..a2750adc7 100644 --- a/server/typings/models/user/user.ts +++ b/server/typings/models/user/user.ts @@ -11,7 +11,7 @@ import { } from '../account' import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting' import { AccountModel } from '@server/models/account/account' -import { MChannelFormattable } from '@server/typings/models' +import { MChannelFormattable } from '../video/video-channels' type Use = PickWith diff --git a/server/typings/models/video/index.d.ts b/server/typings/models/video/index.d.ts deleted file mode 100644 index bd69c8a4b..000000000 --- a/server/typings/models/video/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export * from './schedule-video-update' -export * from './tag' -export * from './thumbnail' -export * from './video' -export * from './video-abuse' -export * from './video-blacklist' -export * from './video-caption' -export * from './video-change-ownership' -export * from './video-channels' -export * from './video-comment' -export * from './video-file' -export * from './video-import' -export * from './video-playlist' -export * from './video-playlist-element' -export * from './video-rate' -export * from './video-redundancy' -export * from './video-share' -export * from './video-streaming-playlist' diff --git a/server/typings/models/video/index.ts b/server/typings/models/video/index.ts new file mode 100644 index 000000000..bd69c8a4b --- /dev/null +++ b/server/typings/models/video/index.ts @@ -0,0 +1,18 @@ +export * from './schedule-video-update' +export * from './tag' +export * from './thumbnail' +export * from './video' +export * from './video-abuse' +export * from './video-blacklist' +export * from './video-caption' +export * from './video-change-ownership' +export * from './video-channels' +export * from './video-comment' +export * from './video-file' +export * from './video-import' +export * from './video-playlist' +export * from './video-playlist-element' +export * from './video-rate' +export * from './video-redundancy' +export * from './video-share' +export * from './video-streaming-playlist' diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts index ada9af06e..e6f478cdf 100644 --- a/server/typings/models/video/schedule-video-update.ts +++ b/server/typings/models/video/schedule-video-update.ts @@ -1,9 +1,18 @@ import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' +import { PickWith } from '@server/typings/utils' +import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' + +type Use = PickWith + +// ############################################################################ export type MScheduleVideoUpdate = Omit // ############################################################################ +export type MScheduleVideoUpdateVideoAll = MScheduleVideoUpdate & + Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight> + // Format for API or AP object export type MScheduleVideoUpdateFormattable = Pick diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts index e12880454..7122a9dc0 100644 --- a/server/typings/models/video/video-blacklist.ts +++ b/server/typings/models/video/video-blacklist.ts @@ -1,6 +1,6 @@ import { VideoBlacklistModel } from '../../../models/video/video-blacklist' import { PickWith } from '@server/typings/utils' -import { MVideo, MVideoFormattable } from '@server/typings/models' +import { MVideo, MVideoFormattable } from './video' type Use = PickWith diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts index 7cb2a2ad3..ffa56f544 100644 --- a/server/typings/models/video/video-caption.ts +++ b/server/typings/models/video/video-caption.ts @@ -1,6 +1,6 @@ import { VideoCaptionModel } from '../../../models/video/video-caption' import { FunctionProperties, PickWith } from '@server/typings/utils' -import { MVideo, MVideoUUID } from '@server/typings/models' +import { MVideo, MVideoUUID } from './video' type Use = PickWith diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts index 72634cdb2..e5b5bbc1d 100644 --- a/server/typings/models/video/video-change-ownership.ts +++ b/server/typings/models/video/video-change-ownership.ts @@ -1,6 +1,7 @@ import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' import { PickWith } from '@server/typings/utils' -import { MAccountDefault, MAccountFormattable, MVideo, MVideoWithFileThumbnail } from '@server/typings/models' +import { MAccountDefault, MAccountFormattable } from '../account/account' +import { MVideo, MVideoWithAllFiles } from './video' type Use = PickWith @@ -11,7 +12,7 @@ export type MVideoChangeOwnership = Omit & Use<'NextOwner', MAccountDefault> & - Use<'Video', MVideoWithFileThumbnail> + Use<'Video', MVideoWithAllFiles> // ############################################################################ diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts index 4fd1c29e8..d693f9186 100644 --- a/server/typings/models/video/video-comment.ts +++ b/server/typings/models/video/video-comment.ts @@ -1,6 +1,6 @@ import { VideoCommentModel } from '../../../models/video/video-comment' import { PickWith, PickWithOpt } from '../../utils' -import { MAccountDefault, MAccountFormattable, MAccountUrl, MActorUrl } from '../account' +import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account' import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' type Use = PickWith diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts index 484351a8d..352fe3d32 100644 --- a/server/typings/models/video/video-file.ts +++ b/server/typings/models/video/video-file.ts @@ -2,18 +2,33 @@ import { VideoFileModel } from '../../../models/video/video-file' import { PickWith, PickWithOpt } from '../../utils' import { MVideo, MVideoUUID } from './video' import { MVideoRedundancyFileUrl } from './video-redundancy' +import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist' type Use = PickWith // ############################################################################ -export type MVideoFile = Omit +export type MVideoFile = Omit export type MVideoFileVideo = MVideoFile & Use<'Video', MVideo> +export type MVideoFileStreamingPlaylist = MVideoFile & + Use<'VideoStreamingPlaylist', MStreamingPlaylist> + +export type MVideoFileStreamingPlaylistVideo = MVideoFile & + Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> + export type MVideoFileVideoUUID = MVideoFile & Use<'Video', MVideoUUID> export type MVideoFileRedundanciesOpt = MVideoFile & PickWithOpt + +export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { + return !!file.videoStreamingPlaylistId +} + +export function isWebtorrentFile (file: any): file is MVideoFileVideo { + return !!file.videoId +} diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts index c6a1c5b66..e119f17f9 100644 --- a/server/typings/models/video/video-import.ts +++ b/server/typings/models/video/video-import.ts @@ -1,6 +1,7 @@ import { VideoImportModel } from '@server/models/video/video-import' import { PickWith, PickWithOpt } from '@server/typings/utils' -import { MUser, MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' +import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video' +import { MUser } from '../user/user' type Use = PickWith diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts index 7b1b993ce..1aeff78d8 100644 --- a/server/typings/models/video/video-playlist-element.ts +++ b/server/typings/models/video/video-playlist-element.ts @@ -1,6 +1,7 @@ import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' import { PickWith } from '@server/typings/utils' -import { MVideoFormattable, MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' +import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video' +import { MVideoPlaylistPrivacy } from './video-playlist' type Use = PickWith diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts index 2ff8a625b..f6bb527fc 100644 --- a/server/typings/models/video/video-rate.ts +++ b/server/typings/models/video/video-rate.ts @@ -1,6 +1,7 @@ import { AccountVideoRateModel } from '@server/models/account/account-video-rate' import { PickWith } from '@server/typings/utils' -import { MAccountAudience, MAccountUrl, MVideo, MVideoFormattable } from '..' +import { MAccountAudience, MAccountUrl } from '../account/account' +import { MVideo, MVideoFormattable } from './video' type Use = PickWith diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts index f3846afd7..25bdac057 100644 --- a/server/typings/models/video/video-redundancy.ts +++ b/server/typings/models/video/video-redundancy.ts @@ -1,10 +1,10 @@ import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' import { PickWith, PickWithOpt } from '@server/typings/utils' -import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo, MVideoUrl } from '@server/typings/models' -import { VideoStreamingPlaylist } from '../../../../shared/models/videos/video-streaming-playlist.model' import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' -import { VideoFile } from '../../../../shared/models/videos' import { VideoFileModel } from '@server/models/video/video-file' +import { MVideoFile, MVideoFileVideo } from './video-file' +import { MStreamingPlaylistVideo } from './video-streaming-playlist' +import { MVideoUrl } from './video' type Use = PickWith diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts index 79696bcff..436c0c072 100644 --- a/server/typings/models/video/video-streaming-playlist.ts +++ b/server/typings/models/video/video-streaming-playlist.ts @@ -1,19 +1,33 @@ import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' import { PickWith, PickWithOpt } from '../../utils' import { MVideoRedundancyFileUrl } from './video-redundancy' -import { MVideo, MVideoUrl } from '@server/typings/models' +import { MVideo } from './video' +import { MVideoFile } from './video-file' type Use = PickWith // ############################################################################ -export type MStreamingPlaylist = Omit +export type MStreamingPlaylist = Omit + +export type MStreamingPlaylistFiles = MStreamingPlaylist & + Use<'VideoFiles', MVideoFile[]> export type MStreamingPlaylistVideo = MStreamingPlaylist & Use<'Video', MVideo> +export type MStreamingPlaylistFilesVideo = MStreamingPlaylist & + Use<'VideoFiles', MVideoFile[]> & + Use<'Video', MVideo> + export type MStreamingPlaylistRedundancies = MStreamingPlaylist & + Use<'VideoFiles', MVideoFile[]> & Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist & + Use<'VideoFiles', MVideoFile[]> & PickWithOpt + +export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo { + return !!(value as MStreamingPlaylist).playlistUrl +} diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts index 9a53bd337..7f69a91de 100644 --- a/server/typings/models/video/video.ts +++ b/server/typings/models/video/video.ts @@ -10,7 +10,7 @@ import { } from './video-channels' import { MTag } from './tag' import { MVideoCaptionLanguage } from './video-caption' -import { MStreamingPlaylist, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist' +import { MStreamingPlaylistFiles, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist' import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' import { MThumbnail } from './thumbnail' import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' @@ -40,7 +40,8 @@ export type MVideoFeed = Pick // "With" to not confuse with the VideoFile model export type MVideoWithFile = MVideo & - Use<'VideoFiles', MVideoFile[]> + Use<'VideoFiles', MVideoFile[]> & + Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> export type MVideoThumbnail = MVideo & Use<'Thumbnails', MThumbnail[]> @@ -66,7 +67,7 @@ export type MVideoWithCaptions = MVideo & Use<'VideoCaptions', MVideoCaptionLanguage[]> export type MVideoWithStreamingPlaylist = MVideo & - Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> + Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> // ############################################################################ @@ -93,12 +94,12 @@ export type MVideoWithRights = MVideo & export type MVideoWithAllFiles = MVideo & Use<'VideoFiles', MVideoFile[]> & Use<'Thumbnails', MThumbnail[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> + Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> export type MVideoAccountLightBlacklistAllFiles = MVideo & Use<'VideoFiles', MVideoFile[]> & Use<'Thumbnails', MThumbnail[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> & + Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & Use<'VideoChannel', MChannelAccountLight> & Use<'VideoBlacklist', MVideoBlacklistLight> @@ -124,7 +125,7 @@ export type MVideoFullLight = MVideo & Use<'UserVideoHistories', MUserVideoHistoryTime[]> & Use<'VideoFiles', MVideoFile[]> & Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & - Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> + Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> // ############################################################################ @@ -133,10 +134,11 @@ export type MVideoFullLight = MVideo & export type MVideoAP = MVideo & Use<'Tags', MTag[]> & Use<'VideoChannel', MChannelAccountLight> & - Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> & + Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & Use<'VideoCaptions', MVideoCaptionLanguage[]> & Use<'VideoBlacklist', MVideoBlacklistUnfederated> & - Use<'VideoFiles', MVideoFileRedundanciesOpt[]> + Use<'VideoFiles', MVideoFileRedundanciesOpt[]> & + Use<'Thumbnails', MThumbnail[]> export type MVideoAPWithoutCaption = Omit -- cgit v1.2.3