From 9977c128387f38dddd697b2e9a405dcea52407b7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 May 2019 15:36:50 +0200 Subject: [PATCH] Remove old activities processor --- server/lib/activitypub/actor.ts | 7 +++---- 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' import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub' import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects' import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' -import { isActorObjectValid, normalizeActor } from '../../helpers/custom-validators/activitypub/actor' +import { sanitizeAndCheckActorObject } from '../../helpers/custom-validators/activitypub/actor' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' import { logger } from '../../helpers/logger' @@ -369,10 +369,9 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode?: numbe logger.info('Fetching remote actor %s.', actorUrl) const requestResult = await doRequest(options) - normalizeActor(requestResult.body) - const actorJSON = requestResult.body - if (isActorObjectValid(actorJSON) === false) { + + if (sanitizeAndCheckActorObject(actorJSON) === false) { logger.debug('Remote actor JSON is not valid.', { actorJSON }) return { result: undefined, statusCode: requestResult.response.statusCode } } 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' import { forwardVideoRelatedActivity } from '../send/utils' import { createOrUpdateCacheFile } from '../cache-file' import { Notifier } from '../../notifier' -import { processViewActivity } from './process-view' -import { processDislikeActivity } from './process-dislike' -import { processFlagActivity } from './process-flag' import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' import { createOrUpdateVideoPlaylist } from '../playlist' import { VideoModel } from '../../../models/video/video' @@ -20,18 +17,6 @@ async function processCreateActivity (activity: ActivityCreate, byActor: ActorMo const activityObject = activity.object const activityType = activityObject.type - if (activityType === 'View') { - return processViewActivity(activity, byActor) - } - - if (activityType === 'Dislike') { - return retryTransactionWrapper(processDislikeActivity, activity, byActor) - } - - if (activityType === 'Flag') { - return retryTransactionWrapper(processFlagActivity, activity, byActor) - } - if (activityType === 'Video') { return processCreateVideo(activity) } -- 2.25.1