aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/redundancy.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-19 10:35:15 +0100
committerChocobozzz <me@florianbigard.com>2019-03-19 10:35:15 +0100
commitdae86118ed5d4026d04acb9d0e36829b9ad8eb4e (patch)
treea5bf9c4487240bf75a9b328cad459a0587f90dea /server/middlewares/validators/redundancy.ts
parente65c0c5b1fab9c3d93f51721b2458cf5cf471f20 (diff)
downloadPeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.gz
PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.zst
PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.zip
Cleanup express locals typings
Diffstat (limited to 'server/middlewares/validators/redundancy.ts')
-rw-r--r--server/middlewares/validators/redundancy.ts10
1 files changed, 3 insertions, 7 deletions
diff --git a/server/middlewares/validators/redundancy.ts b/server/middlewares/validators/redundancy.ts
index 419921928..76cf89c40 100644
--- a/server/middlewares/validators/redundancy.ts
+++ b/server/middlewares/validators/redundancy.ts
@@ -1,16 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import 'express-validator' 2import 'express-validator'
3import { param, body } from 'express-validator/check' 3import { body, param } from 'express-validator/check'
4import { exists, isBooleanValid, isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc' 4import { exists, isBooleanValid, isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc'
5import { doesVideoExist } from '../../helpers/custom-validators/videos' 5import { doesVideoExist } from '../../helpers/custom-validators/videos'
6import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
7import { areValidationErrors } from './utils' 7import { areValidationErrors } from './utils'
8import { VideoModel } from '../../models/video/video'
9import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' 8import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
10import { isHostValid } from '../../helpers/custom-validators/servers' 9import { isHostValid } from '../../helpers/custom-validators/servers'
11import { getServerActor } from '../../helpers/utils'
12import { ActorFollowModel } from '../../models/activitypub/actor-follow'
13import { SERVER_ACTOR_NAME } from '../../initializers'
14import { ServerModel } from '../../models/server/server' 10import { ServerModel } from '../../models/server/server'
15 11
16const videoFileRedundancyGetValidator = [ 12const videoFileRedundancyGetValidator = [
@@ -29,7 +25,7 @@ const videoFileRedundancyGetValidator = [
29 if (areValidationErrors(req, res)) return 25 if (areValidationErrors(req, res)) return
30 if (!await doesVideoExist(req.params.videoId, res)) return 26 if (!await doesVideoExist(req.params.videoId, res)) return
31 27
32 const video: VideoModel = res.locals.video 28 const video = res.locals.video
33 const videoFile = video.VideoFiles.find(f => { 29 const videoFile = video.VideoFiles.find(f => {
34 return f.resolution === req.params.resolution && (!req.params.fps || f.fps === req.params.fps) 30 return f.resolution === req.params.resolution && (!req.params.fps || f.fps === req.params.fps)
35 }) 31 })
@@ -55,7 +51,7 @@ const videoPlaylistRedundancyGetValidator = [
55 if (areValidationErrors(req, res)) return 51 if (areValidationErrors(req, res)) return
56 if (!await doesVideoExist(req.params.videoId, res)) return 52 if (!await doesVideoExist(req.params.videoId, res)) return
57 53
58 const video: VideoModel = res.locals.video 54 const video = res.locals.video
59 const videoStreamingPlaylist = video.VideoStreamingPlaylists.find(p => p === req.params.streamingPlaylistType) 55 const videoStreamingPlaylist = video.VideoStreamingPlaylists.find(p => p === req.params.streamingPlaylistType)
60 56
61 if (!videoStreamingPlaylist) return res.status(404).json({ error: 'Video playlist not found.' }) 57 if (!videoStreamingPlaylist) return res.status(404).json({ error: 'Video playlist not found.' })