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:
parent
1e1265b36c
commit
e34c85e527
14 changed files with 96 additions and 65 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue