diff options
Diffstat (limited to 'server/middlewares/validators/redundancy.ts')
-rw-r--r-- | server/middlewares/validators/redundancy.ts | 10 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import 'express-validator' | 2 | import 'express-validator' |
3 | import { param, body } from 'express-validator/check' | 3 | import { body, param } from 'express-validator/check' |
4 | import { exists, isBooleanValid, isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc' | 4 | import { exists, isBooleanValid, isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc' |
5 | import { doesVideoExist } from '../../helpers/custom-validators/videos' | 5 | import { doesVideoExist } from '../../helpers/custom-validators/videos' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
7 | import { areValidationErrors } from './utils' | 7 | import { areValidationErrors } from './utils' |
8 | import { VideoModel } from '../../models/video/video' | ||
9 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | 8 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' |
10 | import { isHostValid } from '../../helpers/custom-validators/servers' | 9 | import { isHostValid } from '../../helpers/custom-validators/servers' |
11 | import { getServerActor } from '../../helpers/utils' | ||
12 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' | ||
13 | import { SERVER_ACTOR_NAME } from '../../initializers' | ||
14 | import { ServerModel } from '../../models/server/server' | 10 | import { ServerModel } from '../../models/server/server' |
15 | 11 | ||
16 | const videoFileRedundancyGetValidator = [ | 12 | const 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.' }) |