X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fservers.ts;h=94fda05aad258eef563bdc14471043cc534ce05a;hb=b8598d40f650a31fe09a4a5426dcdc2c5c0d566c;hp=adf1ea497e17ae092d73f8e00b74a55868cf7db5;hpb=7cde3b9c2e84ea20bb0aae4544598483cde9e22c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/servers.ts b/server/helpers/custom-validators/servers.ts index adf1ea497..94fda05aa 100644 --- a/server/helpers/custom-validators/servers.ts +++ b/server/helpers/custom-validators/servers.ts @@ -1,7 +1,7 @@ import validator from 'validator' -import { exists, isArray } from './misc' -import { isTestInstance } from '../core-utils' +import { CONFIG } from '@server/initializers/config' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' +import { exists, isArray } from './misc' function isHostValid (host: string) { const isURLOptions = { @@ -10,7 +10,7 @@ function isHostValid (host: string) { } // We validate 'localhost', so we don't have the top level domain - if (isTestInstance()) { + if (CONFIG.WEBSERVER.HOSTNAME === 'localhost') { isURLOptions.require_tld = false } @@ -19,7 +19,6 @@ function isHostValid (host: string) { function isEachUniqueHostValid (hosts: string[]) { return isArray(hosts) && - hosts.length !== 0 && hosts.every(host => { return isHostValid(host) && hosts.indexOf(host) === hosts.lastIndexOf(host) })