diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/actors/get.ts | 8 | ||||
-rw-r--r-- | server/lib/activitypub/actors/refresh.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/videos/get.ts | 8 | ||||
-rw-r--r-- | server/lib/activitypub/videos/refresh.ts | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/server/lib/activitypub/actors/get.ts b/server/lib/activitypub/actors/get.ts index e7e87a967..c7b49d6e4 100644 --- a/server/lib/activitypub/actors/get.ts +++ b/server/lib/activitypub/actors/get.ts | |||
@@ -3,7 +3,7 @@ import { checkUrlsSameHost, getAPId } from '@server/helpers/activitypub' | |||
3 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | 3 | import { retryTransactionWrapper } from '@server/helpers/database-utils' |
4 | import { logger } from '@server/helpers/logger' | 4 | import { logger } from '@server/helpers/logger' |
5 | import { JobQueue } from '@server/lib/job-queue' | 5 | import { JobQueue } from '@server/lib/job-queue' |
6 | import { ActorFetchByUrlType, fetchActorByUrl } from '@server/lib/model-loaders' | 6 | import { ActorLoadByUrlType, loadActorByUrl } from '@server/lib/model-loaders' |
7 | import { MActor, MActorAccountChannelId, MActorAccountChannelIdActor, MActorAccountId, MActorFullActor } from '@server/types/models' | 7 | import { MActor, MActorAccountChannelId, MActorAccountChannelIdActor, MActorAccountId, MActorFullActor } from '@server/types/models' |
8 | import { ActivityPubActor } from '@shared/models' | 8 | import { ActivityPubActor } from '@shared/models' |
9 | import { refreshActorIfNeeded } from './refresh' | 9 | import { refreshActorIfNeeded } from './refresh' |
@@ -25,7 +25,7 @@ function getOrCreateAPActor ( | |||
25 | 25 | ||
26 | async function getOrCreateAPActor ( | 26 | async function getOrCreateAPActor ( |
27 | activityActor: string | ActivityPubActor, | 27 | activityActor: string | ActivityPubActor, |
28 | fetchType: ActorFetchByUrlType = 'association-ids', | 28 | fetchType: ActorLoadByUrlType = 'association-ids', |
29 | recurseIfNeeded = true, | 29 | recurseIfNeeded = true, |
30 | updateCollections = false | 30 | updateCollections = false |
31 | ): Promise<MActorFullActor | MActorAccountChannelId> { | 31 | ): Promise<MActorFullActor | MActorAccountChannelId> { |
@@ -73,8 +73,8 @@ export { | |||
73 | 73 | ||
74 | // --------------------------------------------------------------------------- | 74 | // --------------------------------------------------------------------------- |
75 | 75 | ||
76 | async function loadActorFromDB (actorUrl: string, fetchType: ActorFetchByUrlType) { | 76 | async function loadActorFromDB (actorUrl: string, fetchType: ActorLoadByUrlType) { |
77 | let actor = await fetchActorByUrl(actorUrl, fetchType) | 77 | let actor = await loadActorByUrl(actorUrl, fetchType) |
78 | 78 | ||
79 | // Orphan actor (not associated to an account of channel) so recreate it | 79 | // Orphan actor (not associated to an account of channel) so recreate it |
80 | if (actor && (!actor.Account && !actor.VideoChannel)) { | 80 | if (actor && (!actor.Account && !actor.VideoChannel)) { |
diff --git a/server/lib/activitypub/actors/refresh.ts b/server/lib/activitypub/actors/refresh.ts index 9f2289bfa..9758649a5 100644 --- a/server/lib/activitypub/actors/refresh.ts +++ b/server/lib/activitypub/actors/refresh.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { logger } from '@server/helpers/logger' | 1 | import { logger } from '@server/helpers/logger' |
2 | import { PeerTubeRequestError } from '@server/helpers/requests' | 2 | import { PeerTubeRequestError } from '@server/helpers/requests' |
3 | import { ActorFetchByUrlType } from '@server/lib/model-loaders' | 3 | import { ActorLoadByUrlType } from '@server/lib/model-loaders' |
4 | import { ActorModel } from '@server/models/actor/actor' | 4 | import { ActorModel } from '@server/models/actor/actor' |
5 | import { MActorAccountChannelId, MActorFull } from '@server/types/models' | 5 | import { MActorAccountChannelId, MActorFull } from '@server/types/models' |
6 | import { HttpStatusCode } from '@shared/core-utils' | 6 | import { HttpStatusCode } from '@shared/core-utils' |
@@ -10,7 +10,7 @@ import { getUrlFromWebfinger } from './webfinger' | |||
10 | 10 | ||
11 | async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannelId> ( | 11 | async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannelId> ( |
12 | actorArg: T, | 12 | actorArg: T, |
13 | fetchedType: ActorFetchByUrlType | 13 | fetchedType: ActorLoadByUrlType |
14 | ): Promise<{ actor: T | MActorFull, refreshed: boolean }> { | 14 | ): Promise<{ actor: T | MActorFull, refreshed: boolean }> { |
15 | if (!actorArg.isOutdated()) return { actor: actorArg, refreshed: false } | 15 | if (!actorArg.isOutdated()) return { actor: actorArg, refreshed: false } |
16 | 16 | ||
diff --git a/server/lib/activitypub/videos/get.ts b/server/lib/activitypub/videos/get.ts index 38ba4978c..5d1f92bba 100644 --- a/server/lib/activitypub/videos/get.ts +++ b/server/lib/activitypub/videos/get.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { getAPId } from '@server/helpers/activitypub' | 1 | import { getAPId } from '@server/helpers/activitypub' |
2 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | 2 | import { retryTransactionWrapper } from '@server/helpers/database-utils' |
3 | import { JobQueue } from '@server/lib/job-queue' | 3 | import { JobQueue } from '@server/lib/job-queue' |
4 | import { fetchVideoByUrl, VideoFetchByUrlType } from '@server/lib/model-loaders' | 4 | import { loadVideoByUrl, VideoLoadByUrlType } from '@server/lib/model-loaders' |
5 | import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models' | 5 | import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models' |
6 | import { refreshVideoIfNeeded } from './refresh' | 6 | import { refreshVideoIfNeeded } from './refresh' |
7 | import { APVideoCreator, fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' | 7 | import { APVideoCreator, fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' |
@@ -47,7 +47,7 @@ async function getOrCreateAPVideo ( | |||
47 | 47 | ||
48 | // Get video url | 48 | // Get video url |
49 | const videoUrl = getAPId(options.videoObject) | 49 | const videoUrl = getAPId(options.videoObject) |
50 | let videoFromDatabase = await fetchVideoByUrl(videoUrl, fetchType) | 50 | let videoFromDatabase = await loadVideoByUrl(videoUrl, fetchType) |
51 | 51 | ||
52 | if (videoFromDatabase) { | 52 | if (videoFromDatabase) { |
53 | if (allowRefresh === true) { | 53 | if (allowRefresh === true) { |
@@ -71,7 +71,7 @@ async function getOrCreateAPVideo ( | |||
71 | } catch (err) { | 71 | } catch (err) { |
72 | // Maybe a concurrent getOrCreateAPVideo call created this video | 72 | // Maybe a concurrent getOrCreateAPVideo call created this video |
73 | if (err.name === 'SequelizeUniqueConstraintError') { | 73 | if (err.name === 'SequelizeUniqueConstraintError') { |
74 | const alreadyCreatedVideo = await fetchVideoByUrl(videoUrl, fetchType) | 74 | const alreadyCreatedVideo = await loadVideoByUrl(videoUrl, fetchType) |
75 | if (alreadyCreatedVideo) return { video: alreadyCreatedVideo, created: false } | 75 | if (alreadyCreatedVideo) return { video: alreadyCreatedVideo, created: false } |
76 | } | 76 | } |
77 | 77 | ||
@@ -87,7 +87,7 @@ export { | |||
87 | 87 | ||
88 | // --------------------------------------------------------------------------- | 88 | // --------------------------------------------------------------------------- |
89 | 89 | ||
90 | async function scheduleRefresh (video: MVideoThumbnail, fetchType: VideoFetchByUrlType, syncParam: SyncParam) { | 90 | async function scheduleRefresh (video: MVideoThumbnail, fetchType: VideoLoadByUrlType, syncParam: SyncParam) { |
91 | if (!video.isOutdated()) return video | 91 | if (!video.isOutdated()) return video |
92 | 92 | ||
93 | const refreshOptions = { | 93 | const refreshOptions = { |
diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.ts index f1a3a6fac..82b3b13bf 100644 --- a/server/lib/activitypub/videos/refresh.ts +++ b/server/lib/activitypub/videos/refresh.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 1 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
2 | import { PeerTubeRequestError } from '@server/helpers/requests' | 2 | import { PeerTubeRequestError } from '@server/helpers/requests' |
3 | import { ActorFollowScoreCache } from '@server/lib/files-cache' | 3 | import { ActorFollowScoreCache } from '@server/lib/files-cache' |
4 | import { VideoFetchByUrlType } from '@server/lib/model-loaders' | 4 | import { VideoLoadByUrlType } from '@server/lib/model-loaders' |
5 | import { VideoModel } from '@server/models/video/video' | 5 | import { VideoModel } from '@server/models/video/video' |
6 | import { MVideoAccountLightBlacklistAllFiles, MVideoThumbnail } from '@server/types/models' | 6 | import { MVideoAccountLightBlacklistAllFiles, MVideoThumbnail } from '@server/types/models' |
7 | import { HttpStatusCode } from '@shared/core-utils' | 7 | import { HttpStatusCode } from '@shared/core-utils' |
@@ -10,7 +10,7 @@ import { APVideoUpdater } from './updater' | |||
10 | 10 | ||
11 | async function refreshVideoIfNeeded (options: { | 11 | async function refreshVideoIfNeeded (options: { |
12 | video: MVideoThumbnail | 12 | video: MVideoThumbnail |
13 | fetchedType: VideoFetchByUrlType | 13 | fetchedType: VideoLoadByUrlType |
14 | syncParam: SyncParam | 14 | syncParam: SyncParam |
15 | }): Promise<MVideoThumbnail> { | 15 | }): Promise<MVideoThumbnail> { |
16 | if (!options.video.isOutdated()) return options.video | 16 | if (!options.video.isOutdated()) return options.video |