mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Federate video views
This commit is contained in:
parent
c46edbc2f6
commit
40ff57078e
19 changed files with 188 additions and 44 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
isVideoTorrentDeleteActivityValid,
|
||||
isVideoTorrentUpdateActivityValid
|
||||
} from './videos'
|
||||
import { isViewActivityValid } from './view'
|
||||
|
||||
function isRootActivityValid (activity: any) {
|
||||
return Array.isArray(activity['@context']) &&
|
||||
|
@ -55,7 +56,8 @@ export {
|
|||
|
||||
function checkCreateActivity (activity: any) {
|
||||
return isVideoChannelCreateActivityValid(activity) ||
|
||||
isVideoFlagValid(activity)
|
||||
isVideoFlagValid(activity) ||
|
||||
isViewActivityValid(activity)
|
||||
}
|
||||
|
||||
function checkAddActivity (activity: any) {
|
||||
|
|
|
@ -5,3 +5,4 @@ export * from './signature'
|
|||
export * from './undo'
|
||||
export * from './video-channels'
|
||||
export * from './videos'
|
||||
export * from './view'
|
||||
|
|
|
@ -52,7 +52,7 @@ function isVideoTorrentObjectValid (video: any) {
|
|||
setValidRemoteTags(video) &&
|
||||
isRemoteIdentifierValid(video.category) &&
|
||||
isRemoteIdentifierValid(video.licence) &&
|
||||
isRemoteIdentifierValid(video.language) &&
|
||||
(!video.language || isRemoteIdentifierValid(video.language)) &&
|
||||
isVideoViewsValid(video.views) &&
|
||||
isVideoNSFWValid(video.nsfw) &&
|
||||
isDateValid(video.published) &&
|
||||
|
|
13
server/helpers/custom-validators/activitypub/view.ts
Normal file
13
server/helpers/custom-validators/activitypub/view.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { isActivityPubUrlValid, isBaseActivityValid } from './misc'
|
||||
|
||||
function isViewActivityValid (activity: any) {
|
||||
return isBaseActivityValid(activity, 'Create') &&
|
||||
activity.object.type === 'View' &&
|
||||
isActivityPubUrlValid(activity.object.actor) &&
|
||||
isActivityPubUrlValid(activity.object.object)
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isViewActivityValid
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue