diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-28 17:30:59 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-29 14:56:35 +0200 |
commit | d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch) | |
tree | a4cb07318100031951c3dffc61f4f2cb95d2cbd0 /server/controllers/api/videos/live.ts | |
parent | 62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff) | |
download | PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip |
Support short uuid for GET video/playlist
Diffstat (limited to 'server/controllers/api/videos/live.ts')
-rw-r--r-- | server/controllers/api/videos/live.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 61fa979c4..d8c51c2d4 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { v4 as uuidv4 } from 'uuid' | ||
3 | import { createReqFiles } from '@server/helpers/express-utils' | 2 | import { createReqFiles } from '@server/helpers/express-utils' |
3 | import { buildUUID, uuidToShort } from '@server/helpers/uuid' | ||
4 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
5 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' | 5 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' |
6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
@@ -11,12 +11,12 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator | |||
11 | import { VideoLiveModel } from '@server/models/video/video-live' | 11 | import { VideoLiveModel } from '@server/models/video/video-live' |
12 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' | 12 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' |
13 | import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' | 13 | import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' |
14 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
14 | import { logger } from '../../../helpers/logger' | 15 | import { logger } from '../../../helpers/logger' |
15 | import { sequelizeTypescript } from '../../../initializers/database' | 16 | import { sequelizeTypescript } from '../../../initializers/database' |
16 | import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' | 17 | import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' |
17 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' | 18 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' |
18 | import { VideoModel } from '../../../models/video/video' | 19 | import { VideoModel } from '../../../models/video/video' |
19 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
20 | 20 | ||
21 | const liveRouter = express.Router() | 21 | const liveRouter = express.Router() |
22 | 22 | ||
@@ -94,7 +94,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) { | |||
94 | const videoLive = new VideoLiveModel() | 94 | const videoLive = new VideoLiveModel() |
95 | videoLive.saveReplay = videoInfo.saveReplay || false | 95 | videoLive.saveReplay = videoInfo.saveReplay || false |
96 | videoLive.permanentLive = videoInfo.permanentLive || false | 96 | videoLive.permanentLive = videoInfo.permanentLive || false |
97 | videoLive.streamKey = uuidv4() | 97 | videoLive.streamKey = buildUUID() |
98 | 98 | ||
99 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ | 99 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ |
100 | video, | 100 | video, |
@@ -138,6 +138,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) { | |||
138 | return res.json({ | 138 | return res.json({ |
139 | video: { | 139 | video: { |
140 | id: videoCreated.id, | 140 | id: videoCreated.id, |
141 | shortUUID: uuidToShort(videoCreated.uuid), | ||
141 | uuid: videoCreated.uuid | 142 | uuid: videoCreated.uuid |
142 | } | 143 | } |
143 | }) | 144 | }) |