aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/redundancy.ts
diff options
context:
space:
mode:
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.' })