aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/index.ts1
-rw-r--r--server/lib/activitypub/process-add.ts4
-rw-r--r--server/lib/activitypub/process-announce.ts10
-rw-r--r--server/lib/activitypub/process-create.ts2
-rw-r--r--server/lib/activitypub/process-delete.ts2
-rw-r--r--server/lib/activitypub/process-flag.ts17
-rw-r--r--server/lib/activitypub/process-update.ts2
-rw-r--r--server/lib/activitypub/send-request.ts2
8 files changed, 10 insertions, 30 deletions
diff --git a/server/lib/activitypub/index.ts b/server/lib/activitypub/index.ts
index dca446fd4..e08108aac 100644
--- a/server/lib/activitypub/index.ts
+++ b/server/lib/activitypub/index.ts
@@ -3,7 +3,6 @@ export * from './process-add'
3export * from './process-announce' 3export * from './process-announce'
4export * from './process-create' 4export * from './process-create'
5export * from './process-delete' 5export * from './process-delete'
6export * from './process-flag'
7export * from './process-follow' 6export * from './process-follow'
8export * from './process-update' 7export * from './process-update'
9export * from './send-request' 8export * from './send-request'
diff --git a/server/lib/activitypub/process-add.ts b/server/lib/activitypub/process-add.ts
index c83d9e98e..e1769bee8 100644
--- a/server/lib/activitypub/process-add.ts
+++ b/server/lib/activitypub/process-add.ts
@@ -17,7 +17,7 @@ async function processAddActivity (activity: ActivityAdd) {
17 const videoChannelUrl = activity.target 17 const videoChannelUrl = activity.target
18 const videoChannel = await getOrCreateVideoChannel(account, videoChannelUrl) 18 const videoChannel = await getOrCreateVideoChannel(account, videoChannelUrl)
19 19
20 return processAddVideo(account, activity, videoChannel, activityObject as VideoTorrentObject) 20 return processAddVideo(account, activity, videoChannel, activityObject)
21 } 21 }
22 22
23 logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id }) 23 logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id })
@@ -68,7 +68,7 @@ function addRemoteVideo (
68 68
69 const videoCreated = await video.save(sequelizeOptions) 69 const videoCreated = await video.save(sequelizeOptions)
70 70
71 const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData) 71 const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData)
72 if (videoFileAttributes.length === 0) { 72 if (videoFileAttributes.length === 0) {
73 throw new Error('Cannot find valid files for video %s ' + videoToCreateData.url) 73 throw new Error('Cannot find valid files for video %s ' + videoToCreateData.url)
74 } 74 }
diff --git a/server/lib/activitypub/process-announce.ts b/server/lib/activitypub/process-announce.ts
index f9674e095..eb38aecca 100644
--- a/server/lib/activitypub/process-announce.ts
+++ b/server/lib/activitypub/process-announce.ts
@@ -1,13 +1,11 @@
1import { ActivityAnnounce } from '../../../shared/models/activitypub/activity' 1import { ActivityAnnounce } from '../../../shared/models/activitypub/activity'
2import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object' 2import { getOrCreateAccount } from '../../helpers/activitypub'
3import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object'
4import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
5import { processAddActivity } from './process-add'
6import { processCreateActivity } from './process-create'
7import { database as db } from '../../initializers/index' 4import { database as db } from '../../initializers/index'
8import { getOrCreateAccount } from '../../helpers/activitypub'
9import { VideoChannelInstance } from '../../models/video/video-channel-interface'
10import { VideoInstance } from '../../models/index' 5import { VideoInstance } from '../../models/index'
6import { VideoChannelInstance } from '../../models/video/video-channel-interface'
7import { processAddActivity } from './process-add'
8import { processCreateActivity } from './process-create'
11 9
12async function processAnnounceActivity (activity: ActivityAnnounce) { 10async function processAnnounceActivity (activity: ActivityAnnounce) {
13 const announcedActivity = activity.object 11 const announcedActivity = activity.object
diff --git a/server/lib/activitypub/process-create.ts b/server/lib/activitypub/process-create.ts
index faea3f48a..de8e09adf 100644
--- a/server/lib/activitypub/process-create.ts
+++ b/server/lib/activitypub/process-create.ts
@@ -72,7 +72,7 @@ function addRemoteVideoAbuse (account: AccountInstance, videoAbuseToCreateData:
72 const video = await db.Video.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t) 72 const video = await db.Video.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t)
73 if (!video) { 73 if (!video) {
74 logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object) 74 logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object)
75 return 75 return undefined
76 } 76 }
77 77
78 const videoAbuseData = { 78 const videoAbuseData = {
diff --git a/server/lib/activitypub/process-delete.ts b/server/lib/activitypub/process-delete.ts
index d4487d2cc..0d5756e9c 100644
--- a/server/lib/activitypub/process-delete.ts
+++ b/server/lib/activitypub/process-delete.ts
@@ -28,7 +28,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
28 } 28 }
29 } 29 }
30 30
31 return undefined 31 return
32} 32}
33 33
34// --------------------------------------------------------------------------- 34// ---------------------------------------------------------------------------
diff --git a/server/lib/activitypub/process-flag.ts b/server/lib/activitypub/process-flag.ts
deleted file mode 100644
index b562dce4d..000000000
--- a/server/lib/activitypub/process-flag.ts
+++ /dev/null
@@ -1,17 +0,0 @@
1import {
2 ActivityCreate,
3 VideoTorrentObject,
4 VideoChannelObject
5} from '../../../shared'
6
7function processFlagActivity (activity: ActivityCreate) {
8 return Promise.resolve(undefined)
9}
10
11// ---------------------------------------------------------------------------
12
13export {
14 processFlagActivity
15}
16
17// ---------------------------------------------------------------------------
diff --git a/server/lib/activitypub/process-update.ts b/server/lib/activitypub/process-update.ts
index b732fce33..a9aa5eeb4 100644
--- a/server/lib/activitypub/process-update.ts
+++ b/server/lib/activitypub/process-update.ts
@@ -80,7 +80,7 @@ async function updateRemoteVideo (account: AccountInstance, videoAttributesToUpd
80 } 80 }
81 await Promise.all(videoFileDestroyTasks) 81 await Promise.all(videoFileDestroyTasks)
82 82
83 const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate) 83 const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate)
84 const tasks: Bluebird<any>[] = videoFileAttributes.map(f => db.VideoFile.create(f)) 84 const tasks: Bluebird<any>[] = videoFileAttributes.map(f => db.VideoFile.create(f))
85 await Promise.all(tasks) 85 await Promise.all(tasks)
86 86
diff --git a/server/lib/activitypub/send-request.ts b/server/lib/activitypub/send-request.ts
index 68a631a36..261ff04ab 100644
--- a/server/lib/activitypub/send-request.ts
+++ b/server/lib/activitypub/send-request.ts
@@ -147,7 +147,7 @@ async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAc
147 const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds) 147 const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds)
148 if (result.data.length === 0) { 148 if (result.data.length === 0) {
149 logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', ')) 149 logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', '))
150 return 150 return undefined
151 } 151 }
152 152
153 const jobPayload = { 153 const jobPayload = {