X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fvideos%2Flive.ts;h=d8c51c2d41b5c87e54d3ea3b6ddd6428eb267eea;hb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;hp=6b733c577b539206fe9afd2a8938c8e6f58e16f4;hpb=76148b27f7501bac061992136852be4303370c8d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 6b733c577..d8c51c2d4 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts @@ -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 } })