diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 2812bfe1e..9a5fd6084 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -37,7 +37,7 @@ import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike' | |||
37 | import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists' | 37 | import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists' |
38 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 38 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
39 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' | 39 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' |
40 | import { MAccountId, MActorId, MVideo, MVideoAPWithoutCaption } from '@server/typings/models' | 40 | import { MAccountId, MActorId, MVideo, MVideoAPWithoutCaption, MVideoId } from '@server/typings/models' |
41 | 41 | ||
42 | const activityPubClientRouter = express.Router() | 42 | const activityPubClientRouter = express.Router() |
43 | 43 | ||
@@ -85,7 +85,7 @@ activityPubClientRouter.get('/videos/watch/:id/activity', | |||
85 | ) | 85 | ) |
86 | activityPubClientRouter.get('/videos/watch/:id/announces', | 86 | activityPubClientRouter.get('/videos/watch/:id/announces', |
87 | executeIfActivityPub, | 87 | executeIfActivityPub, |
88 | asyncMiddleware(videosCustomGetValidator('only-video')), | 88 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), |
89 | asyncMiddleware(videoAnnouncesController) | 89 | asyncMiddleware(videoAnnouncesController) |
90 | ) | 90 | ) |
91 | activityPubClientRouter.get('/videos/watch/:id/announces/:actorId', | 91 | activityPubClientRouter.get('/videos/watch/:id/announces/:actorId', |
@@ -95,17 +95,17 @@ activityPubClientRouter.get('/videos/watch/:id/announces/:actorId', | |||
95 | ) | 95 | ) |
96 | activityPubClientRouter.get('/videos/watch/:id/likes', | 96 | activityPubClientRouter.get('/videos/watch/:id/likes', |
97 | executeIfActivityPub, | 97 | executeIfActivityPub, |
98 | asyncMiddleware(videosCustomGetValidator('only-video')), | 98 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), |
99 | asyncMiddleware(videoLikesController) | 99 | asyncMiddleware(videoLikesController) |
100 | ) | 100 | ) |
101 | activityPubClientRouter.get('/videos/watch/:id/dislikes', | 101 | activityPubClientRouter.get('/videos/watch/:id/dislikes', |
102 | executeIfActivityPub, | 102 | executeIfActivityPub, |
103 | asyncMiddleware(videosCustomGetValidator('only-video')), | 103 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), |
104 | asyncMiddleware(videoDislikesController) | 104 | asyncMiddleware(videoDislikesController) |
105 | ) | 105 | ) |
106 | activityPubClientRouter.get('/videos/watch/:id/comments', | 106 | activityPubClientRouter.get('/videos/watch/:id/comments', |
107 | executeIfActivityPub, | 107 | executeIfActivityPub, |
108 | asyncMiddleware(videosCustomGetValidator('only-video')), | 108 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), |
109 | asyncMiddleware(videoCommentsController) | 109 | asyncMiddleware(videoCommentsController) |
110 | ) | 110 | ) |
111 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', | 111 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', |
@@ -238,7 +238,7 @@ async function videoAnnounceController (req: express.Request, res: express.Respo | |||
238 | } | 238 | } |
239 | 239 | ||
240 | async function videoAnnouncesController (req: express.Request, res: express.Response) { | 240 | async function videoAnnouncesController (req: express.Request, res: express.Response) { |
241 | const video = res.locals.onlyVideo | 241 | const video = res.locals.onlyImmutableVideo |
242 | 242 | ||
243 | const handler = async (start: number, count: number) => { | 243 | const handler = async (start: number, count: number) => { |
244 | const result = await VideoShareModel.listAndCountByVideoId(video.id, start, count) | 244 | const result = await VideoShareModel.listAndCountByVideoId(video.id, start, count) |
@@ -253,21 +253,21 @@ async function videoAnnouncesController (req: express.Request, res: express.Resp | |||
253 | } | 253 | } |
254 | 254 | ||
255 | async function videoLikesController (req: express.Request, res: express.Response) { | 255 | async function videoLikesController (req: express.Request, res: express.Response) { |
256 | const video = res.locals.onlyVideo | 256 | const video = res.locals.onlyImmutableVideo |
257 | const json = await videoRates(req, 'like', video, getVideoLikesActivityPubUrl(video)) | 257 | const json = await videoRates(req, 'like', video, getVideoLikesActivityPubUrl(video)) |
258 | 258 | ||
259 | return activityPubResponse(activityPubContextify(json), res) | 259 | return activityPubResponse(activityPubContextify(json), res) |
260 | } | 260 | } |
261 | 261 | ||
262 | async function videoDislikesController (req: express.Request, res: express.Response) { | 262 | async function videoDislikesController (req: express.Request, res: express.Response) { |
263 | const video = res.locals.onlyVideo | 263 | const video = res.locals.onlyImmutableVideo |
264 | const json = await videoRates(req, 'dislike', video, getVideoDislikesActivityPubUrl(video)) | 264 | const json = await videoRates(req, 'dislike', video, getVideoDislikesActivityPubUrl(video)) |
265 | 265 | ||
266 | return activityPubResponse(activityPubContextify(json), res) | 266 | return activityPubResponse(activityPubContextify(json), res) |
267 | } | 267 | } |
268 | 268 | ||
269 | async function videoCommentsController (req: express.Request, res: express.Response) { | 269 | async function videoCommentsController (req: express.Request, res: express.Response) { |
270 | const video = res.locals.onlyVideo | 270 | const video = res.locals.onlyImmutableVideo |
271 | 271 | ||
272 | const handler = async (start: number, count: number) => { | 272 | const handler = async (start: number, count: number) => { |
273 | const result = await VideoCommentModel.listAndCountByVideoId(video.id, start, count) | 273 | const result = await VideoCommentModel.listAndCountByVideoId(video.id, start, count) |
@@ -386,7 +386,7 @@ async function actorPlaylists (req: express.Request, account: MAccountId) { | |||
386 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) | 386 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) |
387 | } | 387 | } |
388 | 388 | ||
389 | function videoRates (req: express.Request, rateType: VideoRateType, video: MVideo, url: string) { | 389 | function videoRates (req: express.Request, rateType: VideoRateType, video: MVideoId, url: string) { |
390 | const handler = async (start: number, count: number) => { | 390 | const handler = async (start: number, count: number) => { |
391 | const result = await AccountVideoRateModel.listAndCountAccountUrlsByVideoId(rateType, video.id, start, count) | 391 | const result = await AccountVideoRateModel.listAndCountAccountUrlsByVideoId(rateType, video.id, start, count) |
392 | return { | 392 | return { |