diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/actor.ts | 3 | ||||
-rw-r--r-- | server/lib/activitypub/playlist.ts | 3 | ||||
-rw-r--r-- | server/lib/activitypub/videos.ts | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index fb5558ff6..52547536c 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -36,6 +36,7 @@ import { | |||
36 | } from '../../types/models' | 36 | } from '../../types/models' |
37 | import { extname } from 'path' | 37 | import { extname } from 'path' |
38 | import { getServerActor } from '@server/models/application/application' | 38 | import { getServerActor } from '@server/models/application/application' |
39 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
39 | 40 | ||
40 | // Set account keys, this could be long so process after the account creation and do not block the client | 41 | // Set account keys, this could be long so process after the account creation and do not block the client |
41 | function setAsyncActorKeys <T extends MActor> (actor: T) { | 42 | function setAsyncActorKeys <T extends MActor> (actor: T) { |
@@ -277,7 +278,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel | |||
277 | 278 | ||
278 | const { result, statusCode } = await fetchRemoteActor(actorUrl) | 279 | const { result, statusCode } = await fetchRemoteActor(actorUrl) |
279 | 280 | ||
280 | if (statusCode === 404) { | 281 | if (statusCode === HttpStatusCode.NOT_FOUND_404) { |
281 | logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url) | 282 | logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url) |
282 | actor.Account | 283 | actor.Account |
283 | ? await actor.Account.destroy() | 284 | ? await actor.Account.destroy() |
diff --git a/server/lib/activitypub/playlist.ts b/server/lib/activitypub/playlist.ts index bd442b223..53298e968 100644 --- a/server/lib/activitypub/playlist.ts +++ b/server/lib/activitypub/playlist.ts | |||
@@ -18,6 +18,7 @@ import { createPlaylistMiniatureFromUrl } from '../thumbnail' | |||
18 | import { FilteredModelAttributes } from '../../types/sequelize' | 18 | import { FilteredModelAttributes } from '../../types/sequelize' |
19 | import { MAccountDefault, MAccountId, MVideoId } from '../../types/models' | 19 | import { MAccountDefault, MAccountId, MVideoId } from '../../types/models' |
20 | import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../types/models/video/video-playlist' | 20 | import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../types/models/video/video-playlist' |
21 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
21 | 22 | ||
22 | function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: MAccountId, to: string[]) { | 23 | function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: MAccountId, to: string[]) { |
23 | const privacy = to.includes(ACTIVITY_PUB.PUBLIC) | 24 | const privacy = to.includes(ACTIVITY_PUB.PUBLIC) |
@@ -120,7 +121,7 @@ async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner) | |||
120 | 121 | ||
121 | try { | 122 | try { |
122 | const { statusCode, playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url) | 123 | const { statusCode, playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url) |
123 | if (statusCode === 404) { | 124 | if (statusCode === HttpStatusCode.NOT_FOUND_404) { |
124 | logger.info('Cannot refresh remote video playlist %s: it does not exist anymore. Deleting it.', videoPlaylist.url) | 125 | logger.info('Cannot refresh remote video playlist %s: it does not exist anymore. Deleting it.', videoPlaylist.url) |
125 | 126 | ||
126 | await videoPlaylist.destroy() | 127 | await videoPlaylist.destroy() |
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 04f0bfc23..b15d5da1c 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -76,6 +76,7 @@ import { sendCreateVideo, sendUpdateVideo } from './send' | |||
76 | import { addVideoShares, shareVideoByServerAndChannel } from './share' | 76 | import { addVideoShares, shareVideoByServerAndChannel } from './share' |
77 | import { addVideoComments } from './video-comments' | 77 | import { addVideoComments } from './video-comments' |
78 | import { createRates } from './video-rates' | 78 | import { createRates } from './video-rates' |
79 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
79 | 80 | ||
80 | async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVideo: boolean, transaction?: sequelize.Transaction) { | 81 | async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVideo: boolean, transaction?: sequelize.Transaction) { |
81 | const video = videoArg as MVideoAP | 82 | const video = videoArg as MVideoAP |
@@ -488,7 +489,7 @@ async function refreshVideoIfNeeded (options: { | |||
488 | 489 | ||
489 | try { | 490 | try { |
490 | const { response, videoObject } = await fetchRemoteVideo(video.url) | 491 | const { response, videoObject } = await fetchRemoteVideo(video.url) |
491 | if (response.statusCode === 404) { | 492 | if (response.statusCode === HttpStatusCode.NOT_FOUND_404) { |
492 | logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url) | 493 | logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url) |
493 | 494 | ||
494 | // Video does not exist anymore | 495 | // Video does not exist anymore |