]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/helpers/custom-validators/pods.js
Pod URL -> pod host. HTTPS is required to make friends.
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / pods.js
1 'use strict'
2
3 const validator = require('express-validator').validator
4
5 const miscValidators = require('./misc')
6
7 const podsValidators = {
8 isEachUniqueHostValid
9 }
10
11 function isEachUniqueHostValid (hosts) {
12 return miscValidators.isArray(hosts) &&
13 hosts.length !== 0 &&
14 hosts.every(function (host) {
15 return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host)
16 })
17 }
18
19 // ---------------------------------------------------------------------------
20
21 module.exports = podsValidators