aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-31 15:36:50 +0200
committerChocobozzz <me@florianbigard.com>2019-05-31 15:36:50 +0200
commit9977c128387f38dddd697b2e9a405dcea52407b7 (patch)
treeb439da0e84f62688cdf69b449c81a0ba2ed3f3a1 /server/lib/activitypub
parentee79b60e4e500a1dc7db8bcee560d9a4a1a5d17a (diff)
downloadPeerTube-9977c128387f38dddd697b2e9a405dcea52407b7.tar.gz
PeerTube-9977c128387f38dddd697b2e9a405dcea52407b7.tar.zst
PeerTube-9977c128387f38dddd697b2e9a405dcea52407b7.zip
Remove old activities processor
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/actor.ts7
-rw-r--r--server/lib/activitypub/process/process-create.ts15
2 files changed, 3 insertions, 19 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index e0cb986bd..38eb87d1e 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -5,7 +5,7 @@ import * as uuidv4 from 'uuid/v4'
5import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub' 5import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
6import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects' 6import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'
7import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' 7import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
8import { isActorObjectValid, normalizeActor } from '../../helpers/custom-validators/activitypub/actor' 8import { sanitizeAndCheckActorObject } from '../../helpers/custom-validators/activitypub/actor'
9import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 9import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
10import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' 10import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils'
11import { logger } from '../../helpers/logger' 11import { logger } from '../../helpers/logger'
@@ -369,10 +369,9 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode?: numbe
369 logger.info('Fetching remote actor %s.', actorUrl) 369 logger.info('Fetching remote actor %s.', actorUrl)
370 370
371 const requestResult = await doRequest<ActivityPubActor>(options) 371 const requestResult = await doRequest<ActivityPubActor>(options)
372 normalizeActor(requestResult.body)
373
374 const actorJSON = requestResult.body 372 const actorJSON = requestResult.body
375 if (isActorObjectValid(actorJSON) === false) { 373
374 if (sanitizeAndCheckActorObject(actorJSON) === false) {
376 logger.debug('Remote actor JSON is not valid.', { actorJSON }) 375 logger.debug('Remote actor JSON is not valid.', { actorJSON })
377 return { result: undefined, statusCode: requestResult.response.statusCode } 376 return { result: undefined, statusCode: requestResult.response.statusCode }
378 } 377 }
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index e4c173e99..3b6eb45c4 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -9,9 +9,6 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
9import { forwardVideoRelatedActivity } from '../send/utils' 9import { forwardVideoRelatedActivity } from '../send/utils'
10import { createOrUpdateCacheFile } from '../cache-file' 10import { createOrUpdateCacheFile } from '../cache-file'
11import { Notifier } from '../../notifier' 11import { Notifier } from '../../notifier'
12import { processViewActivity } from './process-view'
13import { processDislikeActivity } from './process-dislike'
14import { processFlagActivity } from './process-flag'
15import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' 12import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
16import { createOrUpdateVideoPlaylist } from '../playlist' 13import { createOrUpdateVideoPlaylist } from '../playlist'
17import { VideoModel } from '../../../models/video/video' 14import { VideoModel } from '../../../models/video/video'
@@ -20,18 +17,6 @@ async function processCreateActivity (activity: ActivityCreate, byActor: ActorMo
20 const activityObject = activity.object 17 const activityObject = activity.object
21 const activityType = activityObject.type 18 const activityType = activityObject.type
22 19
23 if (activityType === 'View') {
24 return processViewActivity(activity, byActor)
25 }
26
27 if (activityType === 'Dislike') {
28 return retryTransactionWrapper(processDislikeActivity, activity, byActor)
29 }
30
31 if (activityType === 'Flag') {
32 return retryTransactionWrapper(processFlagActivity, activity, byActor)
33 }
34
35 if (activityType === 'Video') { 20 if (activityType === 'Video') {
36 return processCreateVideo(activity) 21 return processCreateVideo(activity)
37 } 22 }