1
0
Fork 0

Fix AP activity validator

This commit is contained in:
Chocobozzz 2018-05-29 15:05:03 +02:00
parent f6d2158fd9
commit f6a7c82ca5
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 4 additions and 1 deletions

View file

@ -35,6 +35,8 @@ module.exports = function () {
publicPath: '/client/standalone/videos/' publicPath: '/client/standalone/videos/'
}, },
// devtool: 'source-map',
module: { module: {
rules: [ rules: [

View file

@ -18,7 +18,7 @@ import {
import { isViewActivityValid } from './view' import { isViewActivityValid } from './view'
function isRootActivityValid (activity: any) { function isRootActivityValid (activity: any) {
return Array.isArray(activity['@context']) && return Array.isArray(activity['@context']) && (
( (
(activity.type === 'Collection' || activity.type === 'OrderedCollection') && (activity.type === 'Collection' || activity.type === 'OrderedCollection') &&
validator.isInt(activity.totalItems, { min: 0 }) && validator.isInt(activity.totalItems, { min: 0 }) &&
@ -28,6 +28,7 @@ function isRootActivityValid (activity: any) {
isActivityPubUrlValid(activity.id) && isActivityPubUrlValid(activity.id) &&
(isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id)) (isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id))
) )
)
} }
const activityCheckers: { [ P in ActivityType ]: (activity: Activity) => boolean } = { const activityCheckers: { [ P in ActivityType ]: (activity: Activity) => boolean } = {