diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-31 15:36:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-31 15:36:50 +0200 |
commit | 9977c128387f38dddd697b2e9a405dcea52407b7 (patch) | |
tree | b439da0e84f62688cdf69b449c81a0ba2ed3f3a1 /server/lib | |
parent | ee79b60e4e500a1dc7db8bcee560d9a4a1a5d17a (diff) | |
download | PeerTube-9977c128387f38dddd697b2e9a405dcea52407b7.tar.gz PeerTube-9977c128387f38dddd697b2e9a405dcea52407b7.tar.zst PeerTube-9977c128387f38dddd697b2e9a405dcea52407b7.zip |
Remove old activities processor
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/actor.ts | 7 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 15 |
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' | |||
5 | import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub' | 5 | import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub' |
6 | import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects' | 6 | import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects' |
7 | import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' | 7 | import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' |
8 | import { isActorObjectValid, normalizeActor } from '../../helpers/custom-validators/activitypub/actor' | 8 | import { sanitizeAndCheckActorObject } from '../../helpers/custom-validators/activitypub/actor' |
9 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 9 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
10 | import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' | 10 | import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' |
11 | import { logger } from '../../helpers/logger' | 11 | import { 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' | |||
9 | import { forwardVideoRelatedActivity } from '../send/utils' | 9 | import { forwardVideoRelatedActivity } from '../send/utils' |
10 | import { createOrUpdateCacheFile } from '../cache-file' | 10 | import { createOrUpdateCacheFile } from '../cache-file' |
11 | import { Notifier } from '../../notifier' | 11 | import { Notifier } from '../../notifier' |
12 | import { processViewActivity } from './process-view' | ||
13 | import { processDislikeActivity } from './process-dislike' | ||
14 | import { processFlagActivity } from './process-flag' | ||
15 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' | 12 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' |
16 | import { createOrUpdateVideoPlaylist } from '../playlist' | 13 | import { createOrUpdateVideoPlaylist } from '../playlist' |
17 | import { VideoModel } from '../../../models/video/video' | 14 | import { 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 | } |