From cefe22cf7c5286af1eb0e7a19937e741e2c2f58a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 5 Jun 2023 15:51:16 +0200 Subject: Fetch remote AP objects if only id is specified --- server/lib/activitypub/activity.ts | 14 +++++- server/lib/activitypub/playlists/get.ts | 4 +- server/lib/activitypub/process/process-create.ts | 58 +++++++++++++++-------- server/lib/activitypub/process/process-dislike.ts | 11 ++--- server/lib/activitypub/process/process-flag.ts | 8 ++-- server/lib/activitypub/process/process-undo.ts | 43 ++++++++++------- server/lib/activitypub/process/process-update.ts | 36 +++++++------- server/lib/activitypub/send/send-create.ts | 23 +++++++-- server/lib/activitypub/send/send-undo.ts | 19 ++------ server/lib/activitypub/send/send-update.ts | 9 +++- server/lib/activitypub/videos/get.ts | 8 ++-- 11 files changed, 141 insertions(+), 92 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/activity.ts b/server/lib/activitypub/activity.ts index 1f6ec221e..0fed3e8fd 100644 --- a/server/lib/activitypub/activity.ts +++ b/server/lib/activitypub/activity.ts @@ -1,4 +1,5 @@ -import { ActivityType } from '@shared/models' +import { doJSONRequest } from '@server/helpers/requests' +import { APObjectId, ActivityObject, ActivityPubActor, ActivityType } from '@shared/models' function getAPId (object: string | { id: string }) { if (typeof object === 'string') return object @@ -32,8 +33,19 @@ function buildAvailableActivities (): ActivityType[] { ] } +async function fetchAPObject (object: APObjectId) { + if (typeof object === 'string') { + const { body } = await doJSONRequest>(object, { activityPub: true }) + + return body + } + + return object as Exclude +} + export { getAPId, + fetchAPObject, getActivityStreamDuration, buildAvailableActivities, getDurationFromActivityStream diff --git a/server/lib/activitypub/playlists/get.ts b/server/lib/activitypub/playlists/get.ts index bfaf52cc9..c34554d69 100644 --- a/server/lib/activitypub/playlists/get.ts +++ b/server/lib/activitypub/playlists/get.ts @@ -1,12 +1,12 @@ import { VideoPlaylistModel } from '@server/models/video/video-playlist' import { MVideoPlaylistFullSummary } from '@server/types/models' -import { APObject } from '@shared/models' +import { APObjectId } from '@shared/models' import { getAPId } from '../activity' import { createOrUpdateVideoPlaylist } from './create-update' import { scheduleRefreshIfNeeded } from './refresh' import { fetchRemoteVideoPlaylist } from './shared' -async function getOrCreateAPVideoPlaylist (playlistObjectArg: APObject): Promise { +async function getOrCreateAPVideoPlaylist (playlistObjectArg: APObjectId): Promise { const playlistUrl = getAPId(playlistObjectArg) const playlistFromDatabase = await VideoPlaylistModel.loadByUrlWithAccountAndChannelSummary(playlistUrl) diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 1e6e8956c..e89d1ab45 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts @@ -1,13 +1,24 @@ import { isBlockedByServerOrAccount } from '@server/lib/blocklist' import { isRedundancyAccepted } from '@server/lib/redundancy' import { VideoModel } from '@server/models/video/video' -import { ActivityCreate, CacheFileObject, PlaylistObject, VideoCommentObject, VideoObject, WatchActionObject } from '@shared/models' +import { + AbuseObject, + ActivityCreate, + ActivityCreateObject, + ActivityObject, + CacheFileObject, + PlaylistObject, + VideoCommentObject, + VideoObject, + WatchActionObject +} from '@shared/models' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { logger } from '../../../helpers/logger' import { sequelizeTypescript } from '../../../initializers/database' import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../types/models' import { Notifier } from '../../notifier' +import { fetchAPObject } from '../activity' import { createOrUpdateCacheFile } from '../cache-file' import { createOrUpdateLocalVideoViewer } from '../local-video-viewer' import { createOrUpdateVideoPlaylist } from '../playlists' @@ -15,35 +26,35 @@ import { forwardVideoRelatedActivity } from '../send/shared/send-utils' import { resolveThread } from '../video-comments' import { getOrCreateAPVideo } from '../videos' -async function processCreateActivity (options: APProcessorOptions) { +async function processCreateActivity (options: APProcessorOptions>) { const { activity, byActor } = options // Only notify if it is not from a fetcher job const notify = options.fromFetch !== true - const activityObject = activity.object + const activityObject = await fetchAPObject>(activity.object) const activityType = activityObject.type if (activityType === 'Video') { - return processCreateVideo(activity, notify) + return processCreateVideo(activityObject, notify) } if (activityType === 'Note') { // Comments will be fetched from videos if (options.fromFetch) return - return retryTransactionWrapper(processCreateVideoComment, activity, byActor, notify) + return retryTransactionWrapper(processCreateVideoComment, activity, activityObject, byActor, notify) } if (activityType === 'WatchAction') { - return retryTransactionWrapper(processCreateWatchAction, activity) + return retryTransactionWrapper(processCreateWatchAction, activityObject) } if (activityType === 'CacheFile') { - return retryTransactionWrapper(processCreateCacheFile, activity, byActor) + return retryTransactionWrapper(processCreateCacheFile, activity, activityObject, byActor) } if (activityType === 'Playlist') { - return retryTransactionWrapper(processCreatePlaylist, activity, byActor) + return retryTransactionWrapper(processCreatePlaylist, activity, activityObject, byActor) } logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id }) @@ -58,9 +69,7 @@ export { // --------------------------------------------------------------------------- -async function processCreateVideo (activity: ActivityCreate, notify: boolean) { - const videoToCreateData = activity.object as VideoObject - +async function processCreateVideo (videoToCreateData: VideoObject, notify: boolean) { const syncParam = { rates: false, shares: false, comments: false, thumbnail: true, refreshVideo: false } const { video, created } = await getOrCreateAPVideo({ videoObject: videoToCreateData, syncParam }) @@ -69,11 +78,13 @@ async function processCreateVideo (activity: ActivityCreate, notify: boolean) { return video } -async function processCreateCacheFile (activity: ActivityCreate, byActor: MActorSignature) { +async function processCreateCacheFile ( + activity: ActivityCreate, + cacheFile: CacheFileObject, + byActor: MActorSignature +) { if (await isRedundancyAccepted(activity, byActor) !== true) return - const cacheFile = activity.object as CacheFileObject - const { video } = await getOrCreateAPVideo({ videoObject: cacheFile.object }) await sequelizeTypescript.transaction(async t => { @@ -87,9 +98,7 @@ async function processCreateCacheFile (activity: ActivityCreate, byActor: MActor } } -async function processCreateWatchAction (activity: ActivityCreate) { - const watchAction = activity.object as WatchActionObject - +async function processCreateWatchAction (watchAction: WatchActionObject) { if (watchAction.actionStatus !== 'CompletedActionStatus') return const video = await VideoModel.loadByUrl(watchAction.object) @@ -100,8 +109,12 @@ async function processCreateWatchAction (activity: ActivityCreate) { }) } -async function processCreateVideoComment (activity: ActivityCreate, byActor: MActorSignature, notify: boolean) { - const commentObject = activity.object as VideoCommentObject +async function processCreateVideoComment ( + activity: ActivityCreate, + commentObject: VideoCommentObject, + byActor: MActorSignature, + notify: boolean +) { const byAccount = byActor.Account if (!byAccount) throw new Error('Cannot create video comment with the non account actor ' + byActor.url) @@ -144,8 +157,11 @@ async function processCreateVideoComment (activity: ActivityCreate, byActor: MAc if (created && notify) Notifier.Instance.notifyOnNewComment(comment) } -async function processCreatePlaylist (activity: ActivityCreate, byActor: MActorSignature) { - const playlistObject = activity.object as PlaylistObject +async function processCreatePlaylist ( + activity: ActivityCreate, + playlistObject: PlaylistObject, + byActor: MActorSignature +) { const byAccount = byActor.Account if (!byAccount) throw new Error('Cannot create video playlist with the non account actor ' + byActor.url) diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts index 44e349b22..4e270f917 100644 --- a/server/lib/activitypub/process/process-dislike.ts +++ b/server/lib/activitypub/process/process-dislike.ts @@ -1,5 +1,5 @@ import { VideoModel } from '@server/models/video/video' -import { ActivityCreate, ActivityDislike, DislikeObject } from '@shared/models' +import { ActivityDislike } from '@shared/models' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { sequelizeTypescript } from '../../../initializers/database' import { AccountVideoRateModel } from '../../../models/account/account-video-rate' @@ -7,7 +7,7 @@ import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { MActorSignature } from '../../../types/models' import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos' -async function processDislikeActivity (options: APProcessorOptions) { +async function processDislikeActivity (options: APProcessorOptions) { const { activity, byActor } = options return retryTransactionWrapper(processDislike, activity, byActor) } @@ -20,11 +20,8 @@ export { // --------------------------------------------------------------------------- -async function processDislike (activity: ActivityCreate | ActivityDislike, byActor: MActorSignature) { - const dislikeObject = activity.type === 'Dislike' - ? activity.object - : (activity.object as DislikeObject).object - +async function processDislike (activity: ActivityDislike, byActor: MActorSignature) { + const dislikeObject = activity.object const byAccount = byActor.Account if (!byAccount) throw new Error('Cannot create dislike with the non account actor ' + byActor.url) diff --git a/server/lib/activitypub/process/process-flag.ts b/server/lib/activitypub/process/process-flag.ts index 10f58ef27..bea285670 100644 --- a/server/lib/activitypub/process/process-flag.ts +++ b/server/lib/activitypub/process/process-flag.ts @@ -3,7 +3,7 @@ import { AccountModel } from '@server/models/account/account' import { VideoModel } from '@server/models/video/video' import { VideoCommentModel } from '@server/models/video/video-comment' import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' -import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '@shared/models' +import { AbuseState, ActivityFlag } from '@shared/models' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { logger } from '../../../helpers/logger' import { sequelizeTypescript } from '../../../initializers/database' @@ -11,7 +11,7 @@ import { getAPId } from '../../../lib/activitypub/activity' import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { MAccountDefault, MActorSignature, MCommentOwnerVideo } from '../../../types/models' -async function processFlagActivity (options: APProcessorOptions) { +async function processFlagActivity (options: APProcessorOptions) { const { activity, byActor } = options return retryTransactionWrapper(processCreateAbuse, activity, byActor) @@ -25,9 +25,7 @@ export { // --------------------------------------------------------------------------- -async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byActor: MActorSignature) { - const flag = activity.type === 'Flag' ? activity : (activity.object as AbuseObject) - +async function processCreateAbuse (flag: ActivityFlag, byActor: MActorSignature) { const account = byActor.Account if (!account) throw new Error('Cannot create abuse with the non account actor ' + byActor.url) diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts index 99423a72b..25f68724d 100644 --- a/server/lib/activitypub/process/process-undo.ts +++ b/server/lib/activitypub/process/process-undo.ts @@ -1,6 +1,14 @@ import { VideoModel } from '@server/models/video/video' -import { ActivityAnnounce, ActivityFollow, ActivityLike, ActivityUndo, CacheFileObject } from '../../../../shared/models/activitypub' -import { DislikeObject } from '../../../../shared/models/activitypub/objects' +import { + ActivityAnnounce, + ActivityCreate, + ActivityDislike, + ActivityFollow, + ActivityLike, + ActivityUndo, + ActivityUndoObject, + CacheFileObject +} from '../../../../shared/models/activitypub' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { logger } from '../../../helpers/logger' import { sequelizeTypescript } from '../../../initializers/database' @@ -11,10 +19,11 @@ import { VideoRedundancyModel } from '../../../models/redundancy/video-redundanc import { VideoShareModel } from '../../../models/video/video-share' import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { MActorSignature } from '../../../types/models' +import { fetchAPObject } from '../activity' import { forwardVideoRelatedActivity } from '../send/shared/send-utils' import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos' -async function processUndoActivity (options: APProcessorOptions) { +async function processUndoActivity (options: APProcessorOptions>) { const { activity, byActor } = options const activityToUndo = activity.object @@ -23,8 +32,10 @@ async function processUndoActivity (options: APProcessorOptions) { } if (activityToUndo.type === 'Create') { - if (activityToUndo.object.type === 'CacheFile') { - return retryTransactionWrapper(processUndoCacheFile, byActor, activity) + const objectToUndo = await fetchAPObject(activityToUndo.object) + + if (objectToUndo.type === 'CacheFile') { + return retryTransactionWrapper(processUndoCacheFile, byActor, activity, objectToUndo) } } @@ -53,8 +64,8 @@ export { // --------------------------------------------------------------------------- -async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo) { - const likeActivity = activity.object as ActivityLike +async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo) { + const likeActivity = activity.object const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: likeActivity.object }) // We don't care about likes of remote videos @@ -78,12 +89,10 @@ async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo }) } -async function processUndoDislike (byActor: MActorSignature, activity: ActivityUndo) { - const dislike = activity.object.type === 'Dislike' - ? activity.object - : activity.object.object as DislikeObject +async function processUndoDislike (byActor: MActorSignature, activity: ActivityUndo) { + const dislikeActivity = activity.object - const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: dislike.object }) + const { video: onlyVideo } = await getOrCreateAPVideo({ videoObject: dislikeActivity.object }) // We don't care about likes of remote videos if (!onlyVideo.isOwned()) return @@ -91,7 +100,7 @@ async function processUndoDislike (byActor: MActorSignature, activity: ActivityU if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) const video = await VideoModel.loadFull(onlyVideo.id, t) - const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) + const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislikeActivity.id, t) if (!rate || rate.type !== 'dislike') { logger.warn(`Unknown dislike by account %d for video %d.`, byActor.Account.id, video.id) return @@ -107,9 +116,11 @@ async function processUndoDislike (byActor: MActorSignature, activity: ActivityU // --------------------------------------------------------------------------- -async function processUndoCacheFile (byActor: MActorSignature, activity: ActivityUndo) { - const cacheFileObject = activity.object.object as CacheFileObject - +async function processUndoCacheFile ( + byActor: MActorSignature, + activity: ActivityUndo>, + cacheFileObject: CacheFileObject +) { const { video } = await getOrCreateAPVideo({ videoObject: cacheFileObject.object }) return sequelizeTypescript.transaction(async t => { diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 4afdbd430..9caa74e04 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts @@ -1,5 +1,5 @@ import { isRedundancyAccepted } from '@server/lib/redundancy' -import { ActivityUpdate, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub' +import { ActivityUpdate, ActivityUpdateObject, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub' import { ActivityPubActor } from '../../../../shared/models/activitypub/activitypub-actor' import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file' @@ -10,16 +10,18 @@ import { sequelizeTypescript } from '../../../initializers/database' import { ActorModel } from '../../../models/actor/actor' import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { MActorFull, MActorSignature } from '../../../types/models' +import { fetchAPObject } from '../activity' import { APActorUpdater } from '../actors/updater' import { createOrUpdateCacheFile } from '../cache-file' import { createOrUpdateVideoPlaylist } from '../playlists' import { forwardVideoRelatedActivity } from '../send/shared/send-utils' import { APVideoUpdater, getOrCreateAPVideo } from '../videos' -async function processUpdateActivity (options: APProcessorOptions) { +async function processUpdateActivity (options: APProcessorOptions>) { const { activity, byActor } = options - const objectType = activity.object.type + const object = await fetchAPObject(activity.object) + const objectType = object.type if (objectType === 'Video') { return retryTransactionWrapper(processUpdateVideo, activity) @@ -28,17 +30,17 @@ async function processUpdateActivity (options: APProcessorOptions) { const videoObject = activity.object as VideoObject if (sanitizeAndCheckVideoTorrentObject(videoObject) === false) { @@ -72,11 +74,13 @@ async function processUpdateVideo (activity: ActivityUpdate) { return updater.update(activity.to) } -async function processUpdateCacheFile (byActor: MActorSignature, activity: ActivityUpdate) { +async function processUpdateCacheFile ( + byActor: MActorSignature, + activity: ActivityUpdate, + cacheFileObject: CacheFileObject +) { if (await isRedundancyAccepted(activity, byActor) !== true) return - const cacheFileObject = activity.object as CacheFileObject - if (!isCacheFileObjectValid(cacheFileObject)) { logger.debug('Cache file object sent by update is not valid.', { cacheFileObject }) return undefined @@ -96,19 +100,19 @@ async function processUpdateCacheFile (byActor: MActorSignature, activity: Activ } } -async function processUpdateActor (actor: MActorFull, activity: ActivityUpdate) { - const actorObject = activity.object as ActivityPubActor - +async function processUpdateActor (actor: MActorFull, actorObject: ActivityPubActor) { logger.debug('Updating remote account "%s".', actorObject.url) const updater = new APActorUpdater(actorObject, actor) return updater.update() } -async function processUpdatePlaylist (byActor: MActorSignature, activity: ActivityUpdate) { - const playlistObject = activity.object as PlaylistObject +async function processUpdatePlaylist ( + byActor: MActorSignature, + activity: ActivityUpdate, + playlistObject: PlaylistObject +) { const byAccount = byActor.Account - if (!byAccount) throw new Error('Cannot update video playlist with the non account actor ' + byActor.url) await createOrUpdateVideoPlaylist(playlistObject, activity.to) diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts index 0e996ab80..2cd4db14d 100644 --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts @@ -1,6 +1,14 @@ import { Transaction } from 'sequelize' import { getServerActor } from '@server/models/application/application' -import { ActivityAudience, ActivityCreate, ContextType, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' +import { + ActivityAudience, + ActivityCreate, + ActivityCreateObject, + ContextType, + VideoCommentObject, + VideoPlaylistPrivacy, + VideoPrivacy +} from '@shared/models' import { logger, loggerTagsFactory } from '../../../helpers/logger' import { VideoCommentModel } from '../../../models/video/video-comment' import { @@ -107,7 +115,7 @@ async function sendCreateVideoComment (comment: MCommentOwnerVideo, transaction: const byActor = comment.Account.Actor const threadParentComments = await VideoCommentModel.listThreadParentComments(comment, transaction) - const commentObject = comment.toActivityPubObject(threadParentComments) + const commentObject = comment.toActivityPubObject(threadParentComments) as VideoCommentObject const actorsInvolvedInComment = await getActorsInvolvedInVideo(comment.Video, transaction) // Add the actor that commented too @@ -168,7 +176,12 @@ async function sendCreateVideoComment (comment: MCommentOwnerVideo, transaction: }) } -function buildCreateActivity (url: string, byActor: MActorLight, object: any, audience?: ActivityAudience): ActivityCreate { +function buildCreateActivity ( + url: string, + byActor: MActorLight, + object: T, + audience?: ActivityAudience +): ActivityCreate { if (!audience) audience = getAudience(byActor) return audiencify( @@ -176,7 +189,9 @@ function buildCreateActivity (url: string, byActor: MActorLight, object: any, au type: 'Create' as 'Create', id: url + '/activity', actor: byActor.url, - object: audiencify(object, audience) + object: typeof object === 'string' + ? object + : audiencify(object, audience) }, audience ) diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index b8eb47ff6..b0b48c9c4 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts @@ -1,14 +1,5 @@ import { Transaction } from 'sequelize' -import { - ActivityAnnounce, - ActivityAudience, - ActivityCreate, - ActivityDislike, - ActivityFollow, - ActivityLike, - ActivityUndo, - ContextType -} from '@shared/models' +import { ActivityAudience, ActivityDislike, ActivityLike, ActivityUndo, ActivityUndoObject, ContextType } from '@shared/models' import { logger } from '../../../helpers/logger' import { VideoModel } from '../../../models/video/video' import { @@ -128,12 +119,12 @@ export { // --------------------------------------------------------------------------- -function undoActivityData ( +function undoActivityData ( url: string, byActor: MActorAudience, - object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce, + object: T, audience?: ActivityAudience -): ActivityUndo { +): ActivityUndo { if (!audience) audience = getAudience(byActor) return audiencify( @@ -151,7 +142,7 @@ async function sendUndoVideoRelatedActivity (options: { byActor: MActor video: MVideoAccountLight url: string - activity: ActivityFollow | ActivityCreate | ActivityAnnounce + activity: ActivityUndoObject contextType: ContextType transaction: Transaction }) { diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 3d2b437e4..f3fb741c6 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts @@ -1,6 +1,6 @@ import { Transaction } from 'sequelize' import { getServerActor } from '@server/models/application/application' -import { ActivityAudience, ActivityUpdate, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' +import { ActivityAudience, ActivityUpdate, ActivityUpdateObject, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' import { logger } from '../../../helpers/logger' import { AccountModel } from '../../../models/account/account' import { VideoModel } from '../../../models/video/video' @@ -137,7 +137,12 @@ export { // --------------------------------------------------------------------------- -function buildUpdateActivity (url: string, byActor: MActorLight, object: any, audience?: ActivityAudience): ActivityUpdate { +function buildUpdateActivity ( + url: string, + byActor: MActorLight, + object: ActivityUpdateObject, + audience?: ActivityAudience +): ActivityUpdate { if (!audience) audience = getAudience(byActor) return audiencify( diff --git a/server/lib/activitypub/videos/get.ts b/server/lib/activitypub/videos/get.ts index 14ba55034..92387c5d4 100644 --- a/server/lib/activitypub/videos/get.ts +++ b/server/lib/activitypub/videos/get.ts @@ -3,7 +3,7 @@ import { logger } from '@server/helpers/logger' import { JobQueue } from '@server/lib/job-queue' import { loadVideoByUrl, VideoLoadByUrlType } from '@server/lib/model-loaders' import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models' -import { APObject } from '@shared/models' +import { APObjectId } from '@shared/models' import { getAPId } from '../activity' import { refreshVideoIfNeeded } from './refresh' import { APVideoCreator, fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' @@ -15,21 +15,21 @@ type GetVideoResult = Promise<{ }> type GetVideoParamAll = { - videoObject: APObject + videoObject: APObjectId syncParam?: SyncParam fetchType?: 'all' allowRefresh?: boolean } type GetVideoParamImmutable = { - videoObject: APObject + videoObject: APObjectId syncParam?: SyncParam fetchType: 'only-immutable-attributes' allowRefresh: false } type GetVideoParamOther = { - videoObject: APObject + videoObject: APObjectId syncParam?: SyncParam fetchType?: 'all' | 'only-video' allowRefresh?: boolean -- cgit v1.2.3