mirror of https://github.com/Chocobozzz/PeerTube
Remove old activities processor
parent
ee79b60e4e
commit
9977c12838
|
@ -5,7 +5,7 @@ import * as uuidv4 from 'uuid/v4'
|
||||||
import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
|
import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
|
||||||
import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'
|
import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'
|
||||||
import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
|
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 { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
|
||||||
import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils'
|
import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils'
|
||||||
import { logger } from '../../helpers/logger'
|
import { logger } from '../../helpers/logger'
|
||||||
|
@ -369,10 +369,9 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode?: numbe
|
||||||
logger.info('Fetching remote actor %s.', actorUrl)
|
logger.info('Fetching remote actor %s.', actorUrl)
|
||||||
|
|
||||||
const requestResult = await doRequest<ActivityPubActor>(options)
|
const requestResult = await doRequest<ActivityPubActor>(options)
|
||||||
normalizeActor(requestResult.body)
|
|
||||||
|
|
||||||
const actorJSON = requestResult.body
|
const actorJSON = requestResult.body
|
||||||
if (isActorObjectValid(actorJSON) === false) {
|
|
||||||
|
if (sanitizeAndCheckActorObject(actorJSON) === false) {
|
||||||
logger.debug('Remote actor JSON is not valid.', { actorJSON })
|
logger.debug('Remote actor JSON is not valid.', { actorJSON })
|
||||||
return { result: undefined, statusCode: requestResult.response.statusCode }
|
return { result: undefined, statusCode: requestResult.response.statusCode }
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,6 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
|
||||||
import { forwardVideoRelatedActivity } from '../send/utils'
|
import { forwardVideoRelatedActivity } from '../send/utils'
|
||||||
import { createOrUpdateCacheFile } from '../cache-file'
|
import { createOrUpdateCacheFile } from '../cache-file'
|
||||||
import { Notifier } from '../../notifier'
|
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 { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
|
||||||
import { createOrUpdateVideoPlaylist } from '../playlist'
|
import { createOrUpdateVideoPlaylist } from '../playlist'
|
||||||
import { VideoModel } from '../../../models/video/video'
|
import { VideoModel } from '../../../models/video/video'
|
||||||
|
@ -20,18 +17,6 @@ async function processCreateActivity (activity: ActivityCreate, byActor: ActorMo
|
||||||
const activityObject = activity.object
|
const activityObject = activity.object
|
||||||
const activityType = activityObject.type
|
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') {
|
if (activityType === 'Video') {
|
||||||
return processCreateVideo(activity)
|
return processCreateVideo(activity)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue