aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-20 16:59:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-20 17:11:38 +0200
commit1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1 (patch)
tree1a2601d63152da4906335c6116ba5f1e8992af33 /server/helpers
parente861452fb26553177ad4e32bfb18b4fd8a5b1816 (diff)
downloadPeerTube-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')
-rw-r--r--server/helpers/custom-validators/misc.js11
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
3const validator = require('express-validator').validator
4
3const miscValidators = { 5const miscValidators = {
4 exists: exists, 6 exists: exists,
5 isArray: isArray 7 isArray: isArray,
8 isEachUrl: isEachUrl
6} 9}
7 10
8function exists (value) { 11function exists (value) {
@@ -13,6 +16,12 @@ function isArray (value) {
13 return Array.isArray(value) 16 return Array.isArray(value)
14} 17}
15 18
19function isEachUrl (urls) {
20 return urls.every(function (url) {
21 return validator.isURL(url)
22 })
23}
24
16// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
17 26
18module.exports = miscValidators 27module.exports = miscValidators