diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-25 17:30:46 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-25 17:30:56 +0200 |
commit | e0ea4b1d550d20271a74f1b84e7b3babeec9e0b3 (patch) | |
tree | e730ee9b71f72bbbceb9bf38c8c53c1902bf51a6 /server/middlewares | |
parent | 170726f523ff48f89da45473fc53ca54784f43dd (diff) | |
download | PeerTube-e0ea4b1d550d20271a74f1b84e7b3babeec9e0b3.tar.gz PeerTube-e0ea4b1d550d20271a74f1b84e7b3babeec9e0b3.tar.zst PeerTube-e0ea4b1d550d20271a74f1b84e7b3babeec9e0b3.zip |
Implement video channel feeds
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/feeds.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 6a8cfce86..b55190559 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts | |||
@@ -1,11 +1,12 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { param, query } from 'express-validator/check' | 2 | import { param, query } from 'express-validator/check' |
3 | import { isAccountIdExist, isAccountNameValid, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts' | 3 | import { isAccountIdExist, isAccountNameValid } from '../../helpers/custom-validators/accounts' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
7 | import { areValidationErrors } from './utils' | 7 | import { areValidationErrors } from './utils' |
8 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' | 8 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' |
9 | import { isVideoChannelExist } from '../../helpers/custom-validators/video-channels' | ||
9 | 10 | ||
10 | const feedsValidator = [ | 11 | const feedsValidator = [ |
11 | param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'), | 12 | param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'), |
@@ -18,11 +19,8 @@ const feedsValidator = [ | |||
18 | 19 | ||
19 | if (areValidationErrors(req, res)) return | 20 | if (areValidationErrors(req, res)) return |
20 | 21 | ||
21 | if (req.query.accountId) { | 22 | if (req.query.accountId && !await isAccountIdExist(req.query.accountId, res)) return |
22 | if (!await isAccountIdExist(req.query.accountId, res)) return | 23 | if (req.query.videoChannelId && !await isVideoChannelExist(req.query.videoChannelId, res)) return |
23 | } else if (req.query.accountName) { | ||
24 | if (!await isLocalAccountNameExist(req.query.accountName, res)) return | ||
25 | } | ||
26 | 24 | ||
27 | return next() | 25 | return next() |
28 | } | 26 | } |