]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - 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
CommitLineData
d57d6f26
C
1'use strict'
2
3const validator = require('express-validator').validator
4
5const miscValidators = require('./misc')
6
7const podsValidators = {
49abbbbe 8 isEachUniqueHostValid
d57d6f26
C
9}
10
49abbbbe
C
11function 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)
d57d6f26
C
16 })
17}
18
19// ---------------------------------------------------------------------------
20
21module.exports = podsValidators