]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/video.ts
Add peertube applications links in about page
[github/Chocobozzz/PeerTube.git] / server / helpers / video.ts
index 26a72ac5c593162361bac2a6b9776460b9c9a3fa..5b9c026b1e2b0357aaf2d0026551a24d8262dd8d 100644 (file)
@@ -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<MVideoAccountAllFiles>
+function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountLightBlacklistAllFiles>
 function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail>
-function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountAllFiles> | Bluebird<MVideoThumbnail>
-function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountAllFiles> | Bluebird<MVideoThumbnail> {
+function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail>
+function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail> {
   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
 }