]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/live.ts
Merge branch 'master' into release/3.3.0
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / live.ts
index 6b733c577b539206fe9afd2a8938c8e6f58e16f4..d8c51c2d41b5c87e54d3ea3b6ddd6428eb267eea 100644 (file)
@@ -1,6 +1,6 @@
 import * as express from 'express'
-import { v4 as uuidv4 } from 'uuid'
 import { createReqFiles } from '@server/helpers/express-utils'
+import { buildUUID, uuidToShort } from '@server/helpers/uuid'
 import { CONFIG } from '@server/initializers/config'
 import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'
 import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
@@ -11,12 +11,12 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator
 import { VideoLiveModel } from '@server/models/video/video-live'
 import { MVideoDetails, MVideoFullLight } from '@server/types/models'
 import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 import { logger } from '../../../helpers/logger'
 import { sequelizeTypescript } from '../../../initializers/database'
-import { createVideoMiniatureFromExisting } from '../../../lib/thumbnail'
+import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail'
 import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'
 import { VideoModel } from '../../../models/video/video'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const liveRouter = express.Router()
 
@@ -94,13 +94,13 @@ async function addLiveVideo (req: express.Request, res: express.Response) {
   const videoLive = new VideoLiveModel()
   videoLive.saveReplay = videoInfo.saveReplay || false
   videoLive.permanentLive = videoInfo.permanentLive || false
-  videoLive.streamKey = uuidv4()
+  videoLive.streamKey = buildUUID()
 
   const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({
     video,
     files: req.files,
     fallback: type => {
-      return createVideoMiniatureFromExisting({
+      return updateVideoMiniatureFromExisting({
         inputPath: ASSETS_PATH.DEFAULT_LIVE_BACKGROUND,
         video,
         type,
@@ -138,6 +138,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) {
   return res.json({
     video: {
       id: videoCreated.id,
+      shortUUID: uuidToShort(videoCreated.uuid),
       uuid: videoCreated.uuid
     }
   })