aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r--server/controllers/api/videos/live.ts7
-rw-r--r--server/controllers/api/videos/upload.ts2
2 files changed, 6 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 @@
1import * as express from 'express' 1import * as express from 'express'
2import { v4 as uuidv4 } from 'uuid'
3import { createReqFiles } from '@server/helpers/express-utils' 2import { createReqFiles } from '@server/helpers/express-utils'
3import { buildUUID, uuidToShort } from '@server/helpers/uuid'
4import { CONFIG } from '@server/initializers/config' 4import { CONFIG } from '@server/initializers/config'
5import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' 5import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'
6import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 6import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
@@ -11,12 +11,12 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator
11import { VideoLiveModel } from '@server/models/video/video-live' 11import { VideoLiveModel } from '@server/models/video/video-live'
12import { MVideoDetails, MVideoFullLight } from '@server/types/models' 12import { MVideoDetails, MVideoFullLight } from '@server/types/models'
13import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' 13import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared'
14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
14import { logger } from '../../../helpers/logger' 15import { logger } from '../../../helpers/logger'
15import { sequelizeTypescript } from '../../../initializers/database' 16import { sequelizeTypescript } from '../../../initializers/database'
16import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' 17import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail'
17import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' 18import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'
18import { VideoModel } from '../../../models/video/video' 19import { VideoModel } from '../../../models/video/video'
19import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
20 20
21const liveRouter = express.Router() 21const 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 })
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts
index e767492bc..bcd21ac99 100644
--- a/server/controllers/api/videos/upload.ts
+++ b/server/controllers/api/videos/upload.ts
@@ -2,6 +2,7 @@ import * as express from 'express'
2import { move } from 'fs-extra' 2import { move } from 'fs-extra'
3import { getLowercaseExtension } from '@server/helpers/core-utils' 3import { getLowercaseExtension } from '@server/helpers/core-utils'
4import { deleteResumableUploadMetaFile, getResumableUploadPath } from '@server/helpers/upload' 4import { deleteResumableUploadMetaFile, getResumableUploadPath } from '@server/helpers/upload'
5import { uuidToShort } from '@server/helpers/uuid'
5import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 6import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
6import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 7import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
7import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' 8import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
@@ -218,6 +219,7 @@ async function addVideo (options: {
218 return res.json({ 219 return res.json({
219 video: { 220 video: {
220 id: videoCreated.id, 221 id: videoCreated.id,
222 shortUUID: uuidToShort(videoCreated.uuid),
221 uuid: videoCreated.uuid 223 uuid: videoCreated.uuid
222 } 224 }
223 }) 225 })