mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Server: fix makefriends validation and tests
This commit is contained in:
parent
6c1a098b41
commit
d57d6f2605
6 changed files with 145 additions and 115 deletions
21
server/helpers/custom-validators/pods.js
Normal file
21
server/helpers/custom-validators/pods.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
'use strict'
|
||||
|
||||
const validator = require('express-validator').validator
|
||||
|
||||
const miscValidators = require('./misc')
|
||||
|
||||
const podsValidators = {
|
||||
isEachUniqueUrlValid: isEachUniqueUrlValid
|
||||
}
|
||||
|
||||
function isEachUniqueUrlValid (urls) {
|
||||
return miscValidators.isArray(urls) &&
|
||||
urls.length !== 0 &&
|
||||
urls.every(function (url) {
|
||||
return validator.isURL(url) && urls.indexOf(url) === urls.lastIndexOf(url)
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = podsValidators
|
Loading…
Add table
Add a link
Reference in a new issue