diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-20 11:21:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-20 11:21:08 +0100 |
commit | de94ac86a211dec657332d964693857ec235ce40 (patch) | |
tree | 3bff96a40e7c862d83561a26249992b07331b0a2 /server/controllers/api/video-playlist.ts | |
parent | 3fba4b6bce69247b1d37f923894d8f44818a891c (diff) | |
download | PeerTube-de94ac86a211dec657332d964693857ec235ce40.tar.gz PeerTube-de94ac86a211dec657332d964693857ec235ce40.tar.zst PeerTube-de94ac86a211dec657332d964693857ec235ce40.zip |
Fix incorrect IDs in AP federation
Diffstat (limited to 'server/controllers/api/video-playlist.ts')
-rw-r--r-- | server/controllers/api/video-playlist.ts | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 41a0e07ff..fb08a63b2 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -1,5 +1,24 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { join } from 'path' | ||
3 | import { getServerActor } from '@server/models/application/application' | ||
4 | import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' | ||
5 | import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model' | ||
6 | import { VideoPlaylistElementCreate } from '../../../shared/models/videos/playlist/video-playlist-element-create.model' | ||
7 | import { VideoPlaylistElementUpdate } from '../../../shared/models/videos/playlist/video-playlist-element-update.model' | ||
8 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' | ||
9 | import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' | ||
10 | import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model' | ||
11 | import { resetSequelizeInstance } from '../../helpers/database-utils' | ||
12 | import { buildNSFWFilter, createReqFiles } from '../../helpers/express-utils' | ||
13 | import { logger } from '../../helpers/logger' | ||
2 | import { getFormattedObjects } from '../../helpers/utils' | 14 | import { getFormattedObjects } from '../../helpers/utils' |
15 | import { CONFIG } from '../../initializers/config' | ||
16 | import { MIMETYPES, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers/constants' | ||
17 | import { sequelizeTypescript } from '../../initializers/database' | ||
18 | import { sendCreateVideoPlaylist, sendDeleteVideoPlaylist, sendUpdateVideoPlaylist } from '../../lib/activitypub/send' | ||
19 | import { getLocalVideoPlaylistActivityPubUrl, getLocalVideoPlaylistElementActivityPubUrl } from '../../lib/activitypub/url' | ||
20 | import { JobQueue } from '../../lib/job-queue' | ||
21 | import { createPlaylistMiniatureFromExisting } from '../../lib/thumbnail' | ||
3 | import { | 22 | import { |
4 | asyncMiddleware, | 23 | asyncMiddleware, |
5 | asyncRetryTransactionMiddleware, | 24 | asyncRetryTransactionMiddleware, |
@@ -10,11 +29,6 @@ import { | |||
10 | setDefaultSort | 29 | setDefaultSort |
11 | } from '../../middlewares' | 30 | } from '../../middlewares' |
12 | import { videoPlaylistsSortValidator } from '../../middlewares/validators' | 31 | import { videoPlaylistsSortValidator } from '../../middlewares/validators' |
13 | import { buildNSFWFilter, createReqFiles } from '../../helpers/express-utils' | ||
14 | import { MIMETYPES, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers/constants' | ||
15 | import { logger } from '../../helpers/logger' | ||
16 | import { resetSequelizeInstance } from '../../helpers/database-utils' | ||
17 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | ||
18 | import { | 32 | import { |
19 | commonVideoPlaylistFiltersValidator, | 33 | commonVideoPlaylistFiltersValidator, |
20 | videoPlaylistsAddValidator, | 34 | videoPlaylistsAddValidator, |
@@ -25,23 +39,9 @@ import { | |||
25 | videoPlaylistsUpdateOrRemoveVideoValidator, | 39 | videoPlaylistsUpdateOrRemoveVideoValidator, |
26 | videoPlaylistsUpdateValidator | 40 | videoPlaylistsUpdateValidator |
27 | } from '../../middlewares/validators/videos/video-playlists' | 41 | } from '../../middlewares/validators/videos/video-playlists' |
28 | import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model' | ||
29 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' | ||
30 | import { join } from 'path' | ||
31 | import { sendCreateVideoPlaylist, sendDeleteVideoPlaylist, sendUpdateVideoPlaylist } from '../../lib/activitypub/send' | ||
32 | import { getVideoPlaylistActivityPubUrl, getVideoPlaylistElementActivityPubUrl } from '../../lib/activitypub/url' | ||
33 | import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model' | ||
34 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' | ||
35 | import { VideoPlaylistElementCreate } from '../../../shared/models/videos/playlist/video-playlist-element-create.model' | ||
36 | import { VideoPlaylistElementUpdate } from '../../../shared/models/videos/playlist/video-playlist-element-update.model' | ||
37 | import { AccountModel } from '../../models/account/account' | 42 | import { AccountModel } from '../../models/account/account' |
38 | import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' | 43 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
39 | import { JobQueue } from '../../lib/job-queue' | 44 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' |
40 | import { CONFIG } from '../../initializers/config' | ||
41 | import { sequelizeTypescript } from '../../initializers/database' | ||
42 | import { createPlaylistMiniatureFromExisting } from '../../lib/thumbnail' | ||
43 | import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' | ||
44 | import { getServerActor } from '@server/models/application/application' | ||
45 | 45 | ||
46 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) | 46 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) |
47 | 47 | ||
@@ -161,7 +161,7 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) { | |||
161 | ownerAccountId: user.Account.id | 161 | ownerAccountId: user.Account.id |
162 | }) as MVideoPlaylistFull | 162 | }) as MVideoPlaylistFull |
163 | 163 | ||
164 | videoPlaylist.url = getVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object | 164 | videoPlaylist.url = getLocalVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object |
165 | 165 | ||
166 | if (videoPlaylistInfo.videoChannelId) { | 166 | if (videoPlaylistInfo.videoChannelId) { |
167 | const videoChannel = res.locals.videoChannel | 167 | const videoChannel = res.locals.videoChannel |
@@ -304,7 +304,7 @@ async function addVideoInPlaylist (req: express.Request, res: express.Response) | |||
304 | videoId: video.id | 304 | videoId: video.id |
305 | }, { transaction: t }) | 305 | }, { transaction: t }) |
306 | 306 | ||
307 | playlistElement.url = getVideoPlaylistElementActivityPubUrl(videoPlaylist, playlistElement) | 307 | playlistElement.url = getLocalVideoPlaylistElementActivityPubUrl(videoPlaylist, playlistElement) |
308 | await playlistElement.save({ transaction: t }) | 308 | await playlistElement.save({ transaction: t }) |
309 | 309 | ||
310 | videoPlaylist.changed('updatedAt', true) | 310 | videoPlaylist.changed('updatedAt', true) |