PeerTube/server/helpers/custom-validators/activitypub/announce.ts

14 lines
343 B
TypeScript
Raw Normal View History

2017-12-19 10:07:58 -06:00
import { isActivityPubUrlValid, isBaseActivityValid } from './misc'
2017-11-20 02:43:39 -06:00
2017-11-23 07:19:55 -06:00
function isAnnounceActivityValid (activity: any) {
2017-11-20 02:43:39 -06:00
return isBaseActivityValid(activity, 'Announce') &&
(
2018-01-26 05:02:18 -06:00
isActivityPubUrlValid(activity.object) ||
(activity.object && isActivityPubUrlValid(activity.object.id))
2017-11-20 02:43:39 -06:00
)
}
export {
2017-11-23 07:19:55 -06:00
isAnnounceActivityValid
2017-11-20 02:43:39 -06:00
}