diff options
Diffstat (limited to 'server/lib/activitypub/process/process-view.ts')
-rw-r--r-- | server/lib/activitypub/process/process-view.ts | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.ts deleted file mode 100644 index e49506d82..000000000 --- a/server/lib/activitypub/process/process-view.ts +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | import { VideoViewsManager } from '@server/lib/views/video-views-manager' | ||
2 | import { ActivityView } from '../../../../shared/models/activitypub' | ||
3 | import { APProcessorOptions } from '../../../types/activitypub-processor.model' | ||
4 | import { MActorSignature } from '../../../types/models' | ||
5 | import { forwardVideoRelatedActivity } from '../send/shared/send-utils' | ||
6 | import { getOrCreateAPVideo } from '../videos' | ||
7 | |||
8 | async function processViewActivity (options: APProcessorOptions<ActivityView>) { | ||
9 | const { activity, byActor } = options | ||
10 | |||
11 | return processCreateView(activity, byActor) | ||
12 | } | ||
13 | |||
14 | // --------------------------------------------------------------------------- | ||
15 | |||
16 | export { | ||
17 | processViewActivity | ||
18 | } | ||
19 | |||
20 | // --------------------------------------------------------------------------- | ||
21 | |||
22 | async function processCreateView (activity: ActivityView, byActor: MActorSignature) { | ||
23 | const videoObject = activity.object | ||
24 | |||
25 | const { video } = await getOrCreateAPVideo({ | ||
26 | videoObject, | ||
27 | fetchType: 'only-video', | ||
28 | allowRefresh: false | ||
29 | }) | ||
30 | |||
31 | const viewerExpires = activity.expires | ||
32 | ? new Date(activity.expires) | ||
33 | : undefined | ||
34 | |||
35 | await VideoViewsManager.Instance.processRemoteView({ video, viewerId: activity.id, viewerExpires }) | ||
36 | |||
37 | if (video.isOwned()) { | ||
38 | // Forward the view but don't resend the activity to the sender | ||
39 | const exceptions = [ byActor ] | ||
40 | await forwardVideoRelatedActivity(activity, undefined, exceptions, video) | ||
41 | } | ||
42 | } | ||