aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-22 16:58:49 +0100
committerChocobozzz <me@florianbigard.com>2022-03-22 17:24:32 +0100
commit92e66e04f7f51d37b465cff442ce47f6d6d7cadd (patch)
tree4475c5c601c0f6673ca56afba5b7f70a4fae4ec3 /server/controllers/api
parent1808a1f8e4b7b102823492a2007a46929aebf189 (diff)
downloadPeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.gz
PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.zst
PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.zip
Rename studio to editor
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/config.ts4
-rw-r--r--server/controllers/api/users/my-notifications.ts2
-rw-r--r--server/controllers/api/videos/index.ts4
-rw-r--r--server/controllers/api/videos/studio.ts (renamed from server/controllers/api/videos/editor.ts)44
4 files changed, 27 insertions, 27 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 376143cb8..cfb750bc9 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -259,8 +259,8 @@ function customConfig (): CustomConfig {
259 } 259 }
260 } 260 }
261 }, 261 },
262 videoEditor: { 262 videoStudio: {
263 enabled: CONFIG.VIDEO_EDITOR.ENABLED 263 enabled: CONFIG.VIDEO_STUDIO.ENABLED
264 }, 264 },
265 import: { 265 import: {
266 videos: { 266 videos: {
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index 55184dc0f..6014cdbbf 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -83,7 +83,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
83 abuseStateChange: body.abuseStateChange, 83 abuseStateChange: body.abuseStateChange,
84 newPeerTubeVersion: body.newPeerTubeVersion, 84 newPeerTubeVersion: body.newPeerTubeVersion,
85 newPluginVersion: body.newPluginVersion, 85 newPluginVersion: body.newPluginVersion,
86 myVideoEditionFinished: body.myVideoEditionFinished 86 myVideoStudioEditionFinished: body.myVideoStudioEditionFinished
87 } 87 }
88 88
89 await UserNotificationSettingModel.update(values, query) 89 await UserNotificationSettingModel.update(values, query)
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index a5ae07d95..c7617093c 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -35,7 +35,7 @@ import { VideoModel } from '../../../models/video/video'
35import { blacklistRouter } from './blacklist' 35import { blacklistRouter } from './blacklist'
36import { videoCaptionsRouter } from './captions' 36import { videoCaptionsRouter } from './captions'
37import { videoCommentRouter } from './comment' 37import { videoCommentRouter } from './comment'
38import { editorRouter } from './editor' 38import { studioRouter } from './studio'
39import { filesRouter } from './files' 39import { filesRouter } from './files'
40import { videoImportsRouter } from './import' 40import { videoImportsRouter } from './import'
41import { liveRouter } from './live' 41import { liveRouter } from './live'
@@ -52,7 +52,7 @@ const videosRouter = express.Router()
52videosRouter.use('/', blacklistRouter) 52videosRouter.use('/', blacklistRouter)
53videosRouter.use('/', rateVideoRouter) 53videosRouter.use('/', rateVideoRouter)
54videosRouter.use('/', videoCommentRouter) 54videosRouter.use('/', videoCommentRouter)
55videosRouter.use('/', editorRouter) 55videosRouter.use('/', studioRouter)
56videosRouter.use('/', videoCaptionsRouter) 56videosRouter.use('/', videoCaptionsRouter)
57videosRouter.use('/', videoImportsRouter) 57videosRouter.use('/', videoImportsRouter)
58videosRouter.use('/', ownershipVideoRouter) 58videosRouter.use('/', ownershipVideoRouter)
diff --git a/server/controllers/api/videos/editor.ts b/server/controllers/api/videos/studio.ts
index 588cc1a8c..bff344f3f 100644
--- a/server/controllers/api/videos/editor.ts
+++ b/server/controllers/api/videos/studio.ts
@@ -2,26 +2,26 @@ import express from 'express'
2import { createAnyReqFiles } from '@server/helpers/express-utils' 2import { createAnyReqFiles } from '@server/helpers/express-utils'
3import { MIMETYPES } from '@server/initializers/constants' 3import { MIMETYPES } from '@server/initializers/constants'
4import { JobQueue } from '@server/lib/job-queue' 4import { JobQueue } from '@server/lib/job-queue'
5import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-editor' 5import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-studio'
6import { 6import {
7 HttpStatusCode, 7 HttpStatusCode,
8 VideoEditionTaskPayload, 8 VideoState,
9 VideoEditorCreateEdition, 9 VideoStudioCreateEdition,
10 VideoEditorTask, 10 VideoStudioTask,
11 VideoEditorTaskCut, 11 VideoStudioTaskCut,
12 VideoEditorTaskIntro, 12 VideoStudioTaskIntro,
13 VideoEditorTaskOutro, 13 VideoStudioTaskOutro,
14 VideoEditorTaskWatermark, 14 VideoStudioTaskPayload,
15 VideoState 15 VideoStudioTaskWatermark
16} from '@shared/models' 16} from '@shared/models'
17import { asyncMiddleware, authenticate, videosEditorAddEditionValidator } from '../../../middlewares' 17import { asyncMiddleware, authenticate, videoStudioAddEditionValidator } from '../../../middlewares'
18 18
19const editorRouter = express.Router() 19const studioRouter = express.Router()
20 20
21const tasksFiles = createAnyReqFiles( 21const tasksFiles = createAnyReqFiles(
22 MIMETYPES.VIDEO.MIMETYPE_EXT, 22 MIMETYPES.VIDEO.MIMETYPE_EXT,
23 (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => { 23 (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => {
24 const body = req.body as VideoEditorCreateEdition 24 const body = req.body as VideoStudioCreateEdition
25 25
26 // Fetch array element 26 // Fetch array element
27 const matches = file.fieldname.match(/tasks\[(\d+)\]/) 27 const matches = file.fieldname.match(/tasks\[(\d+)\]/)
@@ -43,24 +43,24 @@ const tasksFiles = createAnyReqFiles(
43 } 43 }
44) 44)
45 45
46editorRouter.post('/:videoId/editor/edit', 46studioRouter.post('/:videoId/studio/edit',
47 authenticate, 47 authenticate,
48 tasksFiles, 48 tasksFiles,
49 asyncMiddleware(videosEditorAddEditionValidator), 49 asyncMiddleware(videoStudioAddEditionValidator),
50 asyncMiddleware(createEditionTasks) 50 asyncMiddleware(createEditionTasks)
51) 51)
52 52
53// --------------------------------------------------------------------------- 53// ---------------------------------------------------------------------------
54 54
55export { 55export {
56 editorRouter 56 studioRouter
57} 57}
58 58
59// --------------------------------------------------------------------------- 59// ---------------------------------------------------------------------------
60 60
61async function createEditionTasks (req: express.Request, res: express.Response) { 61async function createEditionTasks (req: express.Request, res: express.Response) {
62 const files = req.files as Express.Multer.File[] 62 const files = req.files as Express.Multer.File[]
63 const body = req.body as VideoEditorCreateEdition 63 const body = req.body as VideoStudioCreateEdition
64 const video = res.locals.videoAll 64 const video = res.locals.videoAll
65 65
66 video.state = VideoState.TO_EDIT 66 video.state = VideoState.TO_EDIT
@@ -71,13 +71,13 @@ async function createEditionTasks (req: express.Request, res: express.Response)
71 tasks: body.tasks.map((t, i) => buildTaskPayload(t, i, files)) 71 tasks: body.tasks.map((t, i) => buildTaskPayload(t, i, files))
72 } 72 }
73 73
74 JobQueue.Instance.createJob({ type: 'video-edition', payload }) 74 JobQueue.Instance.createJob({ type: 'video-studio-edition', payload })
75 75
76 return res.sendStatus(HttpStatusCode.NO_CONTENT_204) 76 return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
77} 77}
78 78
79const taskPayloadBuilders: { 79const taskPayloadBuilders: {
80 [id in VideoEditorTask['name']]: (task: VideoEditorTask, indice?: number, files?: Express.Multer.File[]) => VideoEditionTaskPayload 80 [id in VideoStudioTask['name']]: (task: VideoStudioTask, indice?: number, files?: Express.Multer.File[]) => VideoStudioTaskPayload
81} = { 81} = {
82 'add-intro': buildIntroOutroTask, 82 'add-intro': buildIntroOutroTask,
83 'add-outro': buildIntroOutroTask, 83 'add-outro': buildIntroOutroTask,
@@ -85,11 +85,11 @@ const taskPayloadBuilders: {
85 'add-watermark': buildWatermarkTask 85 'add-watermark': buildWatermarkTask
86} 86}
87 87
88function buildTaskPayload (task: VideoEditorTask, indice: number, files: Express.Multer.File[]): VideoEditionTaskPayload { 88function buildTaskPayload (task: VideoStudioTask, indice: number, files: Express.Multer.File[]): VideoStudioTaskPayload {
89 return taskPayloadBuilders[task.name](task, indice, files) 89 return taskPayloadBuilders[task.name](task, indice, files)
90} 90}
91 91
92function buildIntroOutroTask (task: VideoEditorTaskIntro | VideoEditorTaskOutro, indice: number, files: Express.Multer.File[]) { 92function buildIntroOutroTask (task: VideoStudioTaskIntro | VideoStudioTaskOutro, indice: number, files: Express.Multer.File[]) {
93 return { 93 return {
94 name: task.name, 94 name: task.name,
95 options: { 95 options: {
@@ -98,7 +98,7 @@ function buildIntroOutroTask (task: VideoEditorTaskIntro | VideoEditorTaskOutro,
98 } 98 }
99} 99}
100 100
101function buildCutTask (task: VideoEditorTaskCut) { 101function buildCutTask (task: VideoStudioTaskCut) {
102 return { 102 return {
103 name: task.name, 103 name: task.name,
104 options: { 104 options: {
@@ -108,7 +108,7 @@ function buildCutTask (task: VideoEditorTaskCut) {
108 } 108 }
109} 109}
110 110
111function buildWatermarkTask (task: VideoEditorTaskWatermark, indice: number, files: Express.Multer.File[]) { 111function buildWatermarkTask (task: VideoStudioTaskWatermark, indice: number, files: Express.Multer.File[]) {
112 return { 112 return {
113 name: task.name, 113 name: task.name,
114 options: { 114 options: {