1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Fix issues on server start

This commit is contained in:
Chocobozzz 2017-11-14 10:57:56 +01:00
parent 1e1265b36c
commit e34c85e527
No known key found for this signature in database
GPG key ID: 583A612D890159BE
14 changed files with 96 additions and 65 deletions

View file

@ -1,4 +1,7 @@
import * as validator from 'validator'
import { exists } from '../misc'
import { isTestInstance } from '../../core-utils'
import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
function isActivityPubUrlValid (url: string) {
const isURLOptions = {
@ -9,7 +12,12 @@ function isActivityPubUrlValid (url: string) {
protocols: [ 'http', 'https' ]
}
return exists(url) && validator.isURL(url, isURLOptions)
// We validate 'localhost', so we don't have the top level domain
if (isTestInstance()) {
isURLOptions.require_tld = false
}
return exists(url) && validator.isURL(url, isURLOptions) && validator.isLength(url, CONSTRAINTS_FIELDS.ACCOUNTS.URL)
}
function isBaseActivityValid (activity: any, type: string) {