diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-03 18:10:56 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-03 18:10:56 +0200 |
commit | 868fce62f86812759ccedccf7634236ac3701d9a (patch) | |
tree | 79074e065d885bf8903920bf38af06cb209919b6 /server/lib/activitypub/videos | |
parent | 10363c74c1d869f0e0c7bc4d0367b1f34d1bb6a4 (diff) | |
download | PeerTube-868fce62f86812759ccedccf7634236ac3701d9a.tar.gz PeerTube-868fce62f86812759ccedccf7634236ac3701d9a.tar.zst PeerTube-868fce62f86812759ccedccf7634236ac3701d9a.zip |
fetch -> load
avoid confusion with AP fetch functions
Diffstat (limited to 'server/lib/activitypub/videos')
-rw-r--r-- | server/lib/activitypub/videos/get.ts | 8 | ||||
-rw-r--r-- | server/lib/activitypub/videos/refresh.ts | 4 |
2 files changed, 6 insertions, 6 deletions
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 |