1 import { exists } from '../misc'
3 function isActivityPubUrlValid (url: string) {
7 require_protocol: true,
8 require_valid_protocol: true,
9 protocols: [ 'http', 'https' ]
12 return exists(url) && validator.isURL(url, isURLOptions)
15 function isBaseActivityValid (activity: any, type: string) {
16 return Array.isArray(activity['@context']) &&
17 activity.type === type &&
18 validator.isURL(activity.id) &&
19 validator.isURL(activity.actor) &&
20 Array.isArray(activity.to) &&
21 activity.to.every(t => validator.isURL(t))
25 isActivityPubUrlValid,