X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fvideo.ts;h=5b9c026b1e2b0357aaf2d0026551a24d8262dd8d;hb=06bcfbd9f715055f2f00bb66149b1dba926d007a;hp=26a72ac5c593162361bac2a6b9776460b9c9a3fa;hpb=453e83ea5d81d203ba34bc43cd5c2c750ba40568;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/video.ts b/server/helpers/video.ts index 26a72ac5c..5b9c026b1 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts @@ -1,6 +1,12 @@ import { VideoModel } from '../models/video/video' import * as Bluebird from 'bluebird' -import { MVideoAccountAllFiles, MVideoFullLight, MVideoThumbnail, MVideoWithRights, MVideoIdThumbnail } from '@server/typings/models' +import { + MVideoAccountLightBlacklistAllFiles, + MVideoFullLight, + MVideoIdThumbnail, + MVideoThumbnail, + MVideoWithRights +} from '@server/typings/models' import { Response } from 'express' type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' @@ -30,23 +36,23 @@ function fetchVideo ( type VideoFetchByUrlType = 'all' | 'only-video' -function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird +function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird -function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird | Bluebird -function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird | Bluebird { +function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird +function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird { if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) if (fetchType === 'only-video') return VideoModel.loadByUrl(url) } -function getVideo (res: Response) { - return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights || res.locals.videoId +function getVideoWithAttributes (res: Response) { + return res.locals.videoAll || res.locals.onlyVideo || res.locals.onlyVideoWithRights } export { VideoFetchType, VideoFetchByUrlType, fetchVideo, - getVideo, + getVideoWithAttributes, fetchVideoByUrl }