diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index ffbf1ba19..a342a48d4 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -39,6 +39,7 @@ import { | |||
39 | import { VideoCaptionModel } from '../../models/video/video-caption' | 39 | import { VideoCaptionModel } from '../../models/video/video-caption' |
40 | import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' | 40 | import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' |
41 | import { getServerActor } from '../../helpers/utils' | 41 | import { getServerActor } from '../../helpers/utils' |
42 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | ||
42 | 43 | ||
43 | const activityPubClientRouter = express.Router() | 44 | const activityPubClientRouter = express.Router() |
44 | 45 | ||
@@ -164,6 +165,8 @@ function getAccountVideoRate (rateType: VideoRateType) { | |||
164 | async function videoController (req: express.Request, res: express.Response, next: express.NextFunction) { | 165 | async function videoController (req: express.Request, res: express.Response, next: express.NextFunction) { |
165 | const video: VideoModel = res.locals.video | 166 | const video: VideoModel = res.locals.video |
166 | 167 | ||
168 | if (video.isOwned() === false) return res.redirect(video.url) | ||
169 | |||
167 | // We need captions to render AP object | 170 | // We need captions to render AP object |
168 | video.VideoCaptions = await VideoCaptionModel.listVideoCaptions(video.id) | 171 | video.VideoCaptions = await VideoCaptionModel.listVideoCaptions(video.id) |
169 | 172 | ||
@@ -180,6 +183,9 @@ async function videoController (req: express.Request, res: express.Response, nex | |||
180 | 183 | ||
181 | async function videoAnnounceController (req: express.Request, res: express.Response, next: express.NextFunction) { | 184 | async function videoAnnounceController (req: express.Request, res: express.Response, next: express.NextFunction) { |
182 | const share = res.locals.videoShare as VideoShareModel | 185 | const share = res.locals.videoShare as VideoShareModel |
186 | |||
187 | if (share.Actor.isOwned() === false) return res.redirect(share.url) | ||
188 | |||
183 | const { activity } = await buildAnnounceWithVideoAudience(share.Actor, share, res.locals.video, undefined) | 189 | const { activity } = await buildAnnounceWithVideoAudience(share.Actor, share, res.locals.video, undefined) |
184 | 190 | ||
185 | return activityPubResponse(activityPubContextify(activity), res) | 191 | return activityPubResponse(activityPubContextify(activity), res) |
@@ -252,6 +258,8 @@ async function videoChannelFollowingController (req: express.Request, res: expre | |||
252 | async function videoCommentController (req: express.Request, res: express.Response, next: express.NextFunction) { | 258 | async function videoCommentController (req: express.Request, res: express.Response, next: express.NextFunction) { |
253 | const videoComment: VideoCommentModel = res.locals.videoComment | 259 | const videoComment: VideoCommentModel = res.locals.videoComment |
254 | 260 | ||
261 | if (videoComment.isOwned() === false) return res.redirect(videoComment.url) | ||
262 | |||
255 | const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, undefined) | 263 | const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, undefined) |
256 | const isPublic = true // Comments are always public | 264 | const isPublic = true // Comments are always public |
257 | const audience = getAudience(videoComment.Account.Actor, isPublic) | 265 | const audience = getAudience(videoComment.Account.Actor, isPublic) |
@@ -267,7 +275,9 @@ async function videoCommentController (req: express.Request, res: express.Respon | |||
267 | } | 275 | } |
268 | 276 | ||
269 | async function videoRedundancyController (req: express.Request, res: express.Response) { | 277 | async function videoRedundancyController (req: express.Request, res: express.Response) { |
270 | const videoRedundancy = res.locals.videoRedundancy | 278 | const videoRedundancy: VideoRedundancyModel = res.locals.videoRedundancy |
279 | if (videoRedundancy.isOwned() === false) return res.redirect(videoRedundancy.url) | ||
280 | |||
271 | const serverActor = await getServerActor() | 281 | const serverActor = await getServerActor() |
272 | 282 | ||
273 | const audience = getAudience(serverActor) | 283 | const audience = getAudience(serverActor) |