Fix AP activity validator
This commit is contained in:
parent
f6d2158fd9
commit
f6a7c82ca5
2 changed files with 4 additions and 1 deletions
|
@ -35,6 +35,8 @@ module.exports = function () {
|
||||||
publicPath: '/client/standalone/videos/'
|
publicPath: '/client/standalone/videos/'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// devtool: 'source-map',
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
|
|
||||||
rules: [
|
rules: [
|
||||||
|
|
|
@ -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 } = {
|
||||||
|
|
Loading…
Reference in a new issue