diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-20 16:59:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-20 17:11:38 +0200 |
commit | 1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1 (patch) | |
tree | 1a2601d63152da4906335c6116ba5f1e8992af33 /server/helpers/custom-validators/misc.js | |
parent | e861452fb26553177ad4e32bfb18b4fd8a5b1816 (diff) | |
download | PeerTube-1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1.tar.gz PeerTube-1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1.tar.zst PeerTube-1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1.zip |
Server: make friends urls come from the request instead of the
configuration file
Diffstat (limited to 'server/helpers/custom-validators/misc.js')
-rw-r--r-- | server/helpers/custom-validators/misc.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/misc.js b/server/helpers/custom-validators/misc.js index 782ae3dee..13904ea1b 100644 --- a/server/helpers/custom-validators/misc.js +++ b/server/helpers/custom-validators/misc.js | |||
@@ -1,8 +1,11 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const validator = require('express-validator').validator | ||
4 | |||
3 | const miscValidators = { | 5 | const miscValidators = { |
4 | exists: exists, | 6 | exists: exists, |
5 | isArray: isArray | 7 | isArray: isArray, |
8 | isEachUrl: isEachUrl | ||
6 | } | 9 | } |
7 | 10 | ||
8 | function exists (value) { | 11 | function exists (value) { |
@@ -13,6 +16,12 @@ function isArray (value) { | |||
13 | return Array.isArray(value) | 16 | return Array.isArray(value) |
14 | } | 17 | } |
15 | 18 | ||
19 | function isEachUrl (urls) { | ||
20 | return urls.every(function (url) { | ||
21 | return validator.isURL(url) | ||
22 | }) | ||
23 | } | ||
24 | |||
16 | // --------------------------------------------------------------------------- | 25 | // --------------------------------------------------------------------------- |
17 | 26 | ||
18 | module.exports = miscValidators | 27 | module.exports = miscValidators |