Skip to content

Commit

Permalink
Add video embed endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
NeKzor committed Jun 23, 2024
1 parent 83f7b71 commit a54558e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,27 @@ apiV1

return Ok(ctx);
})
// Get the URL of a video.
.get('/videos/embed/:share_id', async (ctx) => {
if (!validateShareId(ctx.params.share_id!)) {
return Err(ctx, Status.BadRequest, 'Invalid share ID.');
}

const [video] = await db.query<Pick<Video, 'video_url'>>(
`select video_url
from videos
where share_id = ?`,
[
ctx.params.share_id,
],
);

if (!video) {
return Err(ctx, Status.NotFound, 'Video not found.');
}

ctx.response.redirect(video.video_url);
})
// Get back changelog IDs of renders that exist.
.post('/check-videos-exist', async (ctx) => {
if (!ctx.request.hasBody) {
Expand Down

0 comments on commit a54558e

Please sign in to comment.