From 92e66e04f7f51d37b465cff442ce47f6d6d7cadd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 Mar 2022 16:58:49 +0100 Subject: [PATCH] Rename studio to editor --- .../edit-custom-config.component.ts | 2 +- .../edit-vod-transcoding.component.html | 12 ++--- .../edit-vod-transcoding.component.ts | 4 +- ...ount-notification-preferences.component.ts | 4 +- .../my-videos/my-videos.component.ts | 6 +-- client/src/app/+video-editor/edit/index.ts | 2 - client/src/app/+video-editor/index.ts | 1 - client/src/app/+video-editor/shared/index.ts | 1 - .../video-editor-routing.module.ts | 30 ------------- .../app/+video-editor/video-editor.module.ts | 27 ------------ client/src/app/+video-studio/edit/index.ts | 2 + .../edit/video-studio-edit.component.html} | 2 +- .../edit/video-studio-edit.component.scss} | 0 .../edit/video-studio-edit.component.ts} | 28 ++++++------ .../edit/video-studio-edit.resolver.ts} | 2 +- client/src/app/+video-studio/index.ts | 1 + client/src/app/+video-studio/shared/index.ts | 1 + .../shared/video-studio.service.ts} | 10 ++--- .../video-studio-routing.module.ts | 29 ++++++++++++ .../app/+video-studio/video-studio.module.ts | 27 ++++++++++++ .../action-buttons.component.ts | 2 +- client/src/app/app-routing.module.ts | 4 +- .../users/user-notification.model.ts | 2 +- .../users/user-notifications.component.html | 2 +- .../shared/shared-main/video/video.model.ts | 4 +- .../video-actions-dropdown.component.ts | 12 ++--- config/default.yaml | 2 +- config/production.yaml.example | 2 +- config/test-1.yaml | 2 +- config/test-3.yaml | 2 +- config/test-4.yaml | 2 +- config/test-5.yaml | 2 +- config/test-6.yaml | 2 +- config/test.yaml | 2 +- server/controllers/api/config.ts | 4 +- .../controllers/api/users/my-notifications.ts | 2 +- server/controllers/api/videos/index.ts | 4 +- .../api/videos/{editor.ts => studio.ts} | 44 +++++++++---------- .../{video-editor.ts => video-studio.ts} | 28 ++++++------ server/initializers/checker-after-init.ts | 8 ++-- server/initializers/checker-before-init.ts | 2 +- server/initializers/config.ts | 4 +- server/initializers/constants.ts | 8 ++-- .../0700-edition-finished-notification.ts | 6 +-- ...deo-edition.ts => video-studio-edition.ts} | 38 ++++++++-------- server/lib/job-queue/job-queue.ts | 10 ++--- server/lib/notifier/notifier.ts | 10 ++--- .../shared/video-publication/index.ts | 2 +- ...s => studio-edition-finished-for-owner.ts} | 8 ++-- server/lib/server-config-manager.ts | 4 +- server/lib/user.ts | 2 +- server/lib/video-state.ts | 2 +- .../lib/{video-editor.ts => video-studio.ts} | 8 ++-- server/middlewares/validators/config.ts | 12 ++--- server/middlewares/validators/videos/index.ts | 2 +- .../{video-editor.ts => video-studio.ts} | 40 ++++++++--------- .../models/user/user-notification-setting.ts | 8 ++-- server/tests/api/check-params/config.ts | 2 +- server/tests/api/check-params/index.ts | 2 +- .../api/check-params/user-notifications.ts | 2 +- .../{video-editor.ts => video-studio.ts} | 40 ++++++++--------- .../api/notifications/user-notifications.ts | 14 +++--- server/tests/api/server/config.ts | 6 +-- server/tests/api/transcoding/index.ts | 2 +- .../{video-editor.ts => video-studio.ts} | 18 ++++---- server/tests/shared/notifications.ts | 10 ++--- shared/models/server/custom-config.model.ts | 2 +- shared/models/server/job.model.ts | 29 ++++++------ shared/models/server/server-config.model.ts | 2 +- .../users/user-notification-setting.model.ts | 2 +- .../models/users/user-notification.model.ts | 2 +- shared/models/videos/editor/index.ts | 1 - .../editor/video-editor-create-edit.model.ts | 42 ------------------ shared/models/videos/index.ts | 2 +- shared/models/videos/studio/index.ts | 1 + .../studio/video-studio-create-edit.model.ts | 42 ++++++++++++++++++ .../server-commands/server/config-command.ts | 8 ++-- shared/server-commands/server/server.ts | 6 +-- shared/server-commands/videos/index.ts | 2 +- ...tor-command.ts => video-studio-command.ts} | 10 ++--- support/nginx/peertube | 2 +- 81 files changed, 368 insertions(+), 370 deletions(-) delete mode 100644 client/src/app/+video-editor/edit/index.ts delete mode 100644 client/src/app/+video-editor/index.ts delete mode 100644 client/src/app/+video-editor/shared/index.ts delete mode 100644 client/src/app/+video-editor/video-editor-routing.module.ts delete mode 100644 client/src/app/+video-editor/video-editor.module.ts create mode 100644 client/src/app/+video-studio/edit/index.ts rename client/src/app/{+video-editor/edit/video-editor-edit.component.html => +video-studio/edit/video-studio-edit.component.html} (97%) rename client/src/app/{+video-editor/edit/video-editor-edit.component.scss => +video-studio/edit/video-studio-edit.component.scss} (100%) rename client/src/app/{+video-editor/edit/video-editor-edit.component.ts => +video-studio/edit/video-studio-edit.component.ts} (85%) rename client/src/app/{+video-editor/edit/video-editor-edit.resolver.ts => +video-studio/edit/video-studio-edit.resolver.ts} (86%) create mode 100644 client/src/app/+video-studio/index.ts create mode 100644 client/src/app/+video-studio/shared/index.ts rename client/src/app/{+video-editor/shared/video-editor.service.ts => +video-studio/shared/video-studio.service.ts} (74%) create mode 100644 client/src/app/+video-studio/video-studio-routing.module.ts create mode 100644 client/src/app/+video-studio/video-studio.module.ts rename server/controllers/api/videos/{editor.ts => studio.ts} (67%) rename server/helpers/custom-validators/{video-editor.ts => video-studio.ts} (64%) rename server/lib/job-queue/handlers/{video-edition.ts => video-studio-edition.ts} (88%) rename server/lib/notifier/shared/video-publication/{edition-finished-for-owner.ts => studio-edition-finished-for-owner.ts} (81%) rename server/lib/{video-editor.ts => video-studio.ts} (78%) rename server/middlewares/validators/videos/{video-editor.ts => video-studio.ts} (74%) rename server/tests/api/check-params/{video-editor.ts => video-studio.ts} (91%) rename server/tests/api/transcoding/{video-editor.ts => video-studio.ts} (94%) delete mode 100644 shared/models/videos/editor/index.ts delete mode 100644 shared/models/videos/editor/video-editor-create-edit.model.ts create mode 100644 shared/models/videos/studio/index.ts create mode 100644 shared/models/videos/studio/video-studio-create-edit.model.ts rename shared/server-commands/videos/{video-editor-command.ts => video-studio-command.ts} (82%) diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 94f1021bf..eb892bbfd 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -200,7 +200,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { resolutions: {} } }, - videoEditor: { + videoStudio: { enabled: null }, autoBlacklist: { diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html index 52d6c79f6..5c0bea4a5 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html @@ -193,9 +193,9 @@ -
+
-
VIDEO EDITOR
+
VIDEO STUDIO
Allows your users to edit their video (cut, add intro/outro, add a watermark etc)
@@ -203,14 +203,14 @@
- +
- ⚠️ You need to enable transcoding first to enable video editor + ⚠️ You need to enable transcoding first to enable video studio
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts index 948c10b69..a38438e3a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts @@ -72,7 +72,7 @@ export class EditVODTranscodingComponent implements OnInit, OnChanges { private checkTranscodingFields () { const transcodingControl = this.form.get('transcoding.enabled') - const videoEditorControl = this.form.get('videoEditor.enabled') + const videoStudioControl = this.form.get('videoStudio.enabled') const hlsControl = this.form.get('transcoding.hls.enabled') const webtorrentControl = this.form.get('transcoding.webtorrent.enabled') @@ -101,7 +101,7 @@ export class EditVODTranscodingComponent implements OnInit, OnChanges { transcodingControl.valueChanges .subscribe(newValue => { if (newValue === false) { - videoEditorControl.setValue(false) + videoStudioControl.setValue(false) } }) } diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts index 187a3818a..7c13282fa 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts @@ -45,7 +45,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { abuseStateChange: $localize`One of your abuse reports has been accepted or rejected by moderators`, newPeerTubeVersion: $localize`A new PeerTube version is available`, newPluginVersion: $localize`One of your plugin/theme has a new available version`, - myVideoEditionFinished: $localize`Video edition finished` + myVideoStudioEditionFinished: $localize`Video studio edition has finished` } this.notificationSettingGroups = [ { @@ -64,7 +64,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { 'blacklistOnMyVideo', 'myVideoPublished', 'myVideoImportFinished', - 'myVideoEditionFinished' + 'myVideoStudioEditionFinished' ] }, diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts index 45a586981..a364b9b6a 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.ts +++ b/client/src/app/+my-library/my-videos/my-videos.component.ts @@ -205,9 +205,9 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { private buildActions () { this.videoActions = [ { - label: $localize`Editor`, - linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ], - isDisplayed: ({ video }) => video.isEditableBy(this.authService.getUser(), this.serverService.getHTMLConfig().videoEditor.enabled), + label: $localize`Studio`, + linkBuilder: ({ video }) => [ '/studio/edit', video.uuid ], + isDisplayed: ({ video }) => video.isEditableBy(this.authService.getUser(), this.serverService.getHTMLConfig().videoStudio.enabled), iconName: 'film' }, { diff --git a/client/src/app/+video-editor/edit/index.ts b/client/src/app/+video-editor/edit/index.ts deleted file mode 100644 index 390ca80fc..000000000 --- a/client/src/app/+video-editor/edit/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './video-editor-edit.component' -export * from './video-editor-edit.resolver' diff --git a/client/src/app/+video-editor/index.ts b/client/src/app/+video-editor/index.ts deleted file mode 100644 index 5a9e9fdd0..000000000 --- a/client/src/app/+video-editor/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-editor.module' diff --git a/client/src/app/+video-editor/shared/index.ts b/client/src/app/+video-editor/shared/index.ts deleted file mode 100644 index eaf88b6f4..000000000 --- a/client/src/app/+video-editor/shared/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-editor.service' diff --git a/client/src/app/+video-editor/video-editor-routing.module.ts b/client/src/app/+video-editor/video-editor-routing.module.ts deleted file mode 100644 index 9f37a0dae..000000000 --- a/client/src/app/+video-editor/video-editor-routing.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core' -import { RouterModule, Routes } from '@angular/router' -import { VideoEditorEditResolver } from './edit' -import { VideoEditorEditComponent } from './edit/video-editor-edit.component' - -const videoEditorRoutes: Routes = [ - { - path: '', - children: [ - { - path: 'edit/:videoId', - component: VideoEditorEditComponent, - data: { - meta: { - title: $localize`Edit video` - } - }, - resolve: { - video: VideoEditorEditResolver - } - } - ] - } -] - -@NgModule({ - imports: [ RouterModule.forChild(videoEditorRoutes) ], - exports: [ RouterModule ] -}) -export class VideoEditorRoutingModule {} diff --git a/client/src/app/+video-editor/video-editor.module.ts b/client/src/app/+video-editor/video-editor.module.ts deleted file mode 100644 index 7bbebc17b..000000000 --- a/client/src/app/+video-editor/video-editor.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { NgModule } from '@angular/core' -import { SharedFormModule } from '@app/shared/shared-forms' -import { SharedMainModule } from '@app/shared/shared-main' -import { VideoEditorEditComponent, VideoEditorEditResolver } from './edit' -import { VideoEditorService } from './shared' -import { VideoEditorRoutingModule } from './video-editor-routing.module' - -@NgModule({ - imports: [ - VideoEditorRoutingModule, - - SharedMainModule, - SharedFormModule - ], - - declarations: [ - VideoEditorEditComponent - ], - - exports: [], - - providers: [ - VideoEditorService, - VideoEditorEditResolver - ] -}) -export class VideoEditorModule { } diff --git a/client/src/app/+video-studio/edit/index.ts b/client/src/app/+video-studio/edit/index.ts new file mode 100644 index 000000000..ff1d77fc0 --- /dev/null +++ b/client/src/app/+video-studio/edit/index.ts @@ -0,0 +1,2 @@ +export * from './video-studio-edit.component' +export * from './video-studio-edit.resolver' diff --git a/client/src/app/+video-editor/edit/video-editor-edit.component.html b/client/src/app/+video-studio/edit/video-studio-edit.component.html similarity index 97% rename from client/src/app/+video-editor/edit/video-editor-edit.component.html rename to client/src/app/+video-studio/edit/video-studio-edit.component.html index d33dfaf18..a9f34811f 100644 --- a/client/src/app/+video-editor/edit/video-editor-edit.component.html +++ b/client/src/app/+video-studio/edit/video-studio-edit.component.html @@ -1,5 +1,5 @@
-

Edit {{ video.name }}

+

Studio for {{ video.name }}

diff --git a/client/src/app/+video-editor/edit/video-editor-edit.component.scss b/client/src/app/+video-studio/edit/video-studio-edit.component.scss similarity index 100% rename from client/src/app/+video-editor/edit/video-editor-edit.component.scss rename to client/src/app/+video-studio/edit/video-studio-edit.component.scss diff --git a/client/src/app/+video-editor/edit/video-editor-edit.component.ts b/client/src/app/+video-studio/edit/video-studio-edit.component.ts similarity index 85% rename from client/src/app/+video-editor/edit/video-editor-edit.component.ts rename to client/src/app/+video-studio/edit/video-studio-edit.component.ts index 0adf93335..392b65767 100644 --- a/client/src/app/+video-editor/edit/video-editor-edit.component.ts +++ b/client/src/app/+video-studio/edit/video-studio-edit.component.ts @@ -2,18 +2,18 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { ConfirmService, Notifier, ServerService } from '@app/core' import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' -import { Video, VideoDetails } from '@app/shared/shared-main' +import { VideoDetails } from '@app/shared/shared-main' import { LoadingBarService } from '@ngx-loading-bar/core' import { secondsToTime } from '@shared/core-utils' -import { VideoEditorTask, VideoEditorTaskCut } from '@shared/models' -import { VideoEditorService } from '../shared' +import { VideoStudioTask, VideoStudioTaskCut } from '@shared/models' +import { VideoStudioService } from '../shared' @Component({ - selector: 'my-video-editor-edit', - templateUrl: './video-editor-edit.component.html', - styleUrls: [ './video-editor-edit.component.scss' ] + selector: 'my-video-studio-edit', + templateUrl: './video-studio-edit.component.html', + styleUrls: [ './video-studio-edit.component.scss' ] }) -export class VideoEditorEditComponent extends FormReactive implements OnInit { +export class VideoStudioEditComponent extends FormReactive implements OnInit { isRunningEdition = false video: VideoDetails @@ -24,7 +24,7 @@ export class VideoEditorEditComponent extends FormReactive implements OnInit { private notifier: Notifier, private router: Router, private route: ActivatedRoute, - private videoEditorService: VideoEditorService, + private videoStudioService: VideoStudioService, private loadingBar: LoadingBarService, private confirmService: ConfirmService ) { @@ -84,11 +84,13 @@ export class VideoEditorEditComponent extends FormReactive implements OnInit { this.loadingBar.useRef().start() - return this.videoEditorService.editVideo(this.video.uuid, tasks) + return this.videoStudioService.editVideo(this.video.uuid, tasks) .subscribe({ next: () => { - this.notifier.success($localize`Video updated.`) - this.router.navigateByUrl(Video.buildWatchUrl(this.video)) + this.notifier.success($localize`Edition tasks created.`) + + // Don't redirect to old video version watch page that could be confusing for users + this.router.navigateByUrl('/my-library/videos') }, error: err => { @@ -153,13 +155,13 @@ export class VideoEditorEditComponent extends FormReactive implements OnInit { } private buildTasks () { - const tasks: VideoEditorTask[] = [] + const tasks: VideoStudioTask[] = [] const value = this.form.value const cut = value['cut'] if (cut['start'] !== 0 || cut['end'] !== this.video.duration) { - const options: VideoEditorTaskCut['options'] = {} + const options: VideoStudioTaskCut['options'] = {} if (cut['start'] !== 0) options.start = cut['start'] if (cut['end'] !== this.video.duration) options.end = cut['end'] diff --git a/client/src/app/+video-editor/edit/video-editor-edit.resolver.ts b/client/src/app/+video-studio/edit/video-studio-edit.resolver.ts similarity index 86% rename from client/src/app/+video-editor/edit/video-editor-edit.resolver.ts rename to client/src/app/+video-studio/edit/video-studio-edit.resolver.ts index 7b95ae834..c658be50b 100644 --- a/client/src/app/+video-editor/edit/video-editor-edit.resolver.ts +++ b/client/src/app/+video-studio/edit/video-studio-edit.resolver.ts @@ -4,7 +4,7 @@ import { ActivatedRouteSnapshot, Resolve } from '@angular/router' import { VideoService } from '@app/shared/shared-main' @Injectable() -export class VideoEditorEditResolver implements Resolve { +export class VideoStudioEditResolver implements Resolve { constructor ( private videoService: VideoService ) { diff --git a/client/src/app/+video-studio/index.ts b/client/src/app/+video-studio/index.ts new file mode 100644 index 000000000..d50c21cdc --- /dev/null +++ b/client/src/app/+video-studio/index.ts @@ -0,0 +1 @@ +export * from './video-studio.module' diff --git a/client/src/app/+video-studio/shared/index.ts b/client/src/app/+video-studio/shared/index.ts new file mode 100644 index 000000000..9940ac6a9 --- /dev/null +++ b/client/src/app/+video-studio/shared/index.ts @@ -0,0 +1 @@ +export * from './video-studio.service' diff --git a/client/src/app/+video-editor/shared/video-editor.service.ts b/client/src/app/+video-studio/shared/video-studio.service.ts similarity index 74% rename from client/src/app/+video-editor/shared/video-editor.service.ts rename to client/src/app/+video-studio/shared/video-studio.service.ts index 5b7053039..8d8b2f0e5 100644 --- a/client/src/app/+video-editor/shared/video-editor.service.ts +++ b/client/src/app/+video-studio/shared/video-studio.service.ts @@ -4,19 +4,19 @@ import { Injectable } from '@angular/core' import { RestExtractor } from '@app/core' import { objectToFormData } from '@app/helpers' import { VideoService } from '@app/shared/shared-main' -import { VideoEditorCreateEdition, VideoEditorTask } from '@shared/models' +import { VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' @Injectable() -export class VideoEditorService { +export class VideoStudioService { constructor ( private authHttp: HttpClient, private restExtractor: RestExtractor ) {} - editVideo (videoId: number | string, tasks: VideoEditorTask[]) { - const url = VideoService.BASE_VIDEO_URL + '/' + videoId + '/editor/edit' - const body: VideoEditorCreateEdition = { + editVideo (videoId: number | string, tasks: VideoStudioTask[]) { + const url = VideoService.BASE_VIDEO_URL + '/' + videoId + '/studio/edit' + const body: VideoStudioCreateEdition = { tasks } diff --git a/client/src/app/+video-studio/video-studio-routing.module.ts b/client/src/app/+video-studio/video-studio-routing.module.ts new file mode 100644 index 000000000..bcd9b79a5 --- /dev/null +++ b/client/src/app/+video-studio/video-studio-routing.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core' +import { RouterModule, Routes } from '@angular/router' +import { VideoStudioEditComponent, VideoStudioEditResolver } from './edit' + +const videoStudioRoutes: Routes = [ + { + path: '', + children: [ + { + path: 'edit/:videoId', + component: VideoStudioEditComponent, + data: { + meta: { + title: $localize`Studio` + } + }, + resolve: { + video: VideoStudioEditResolver + } + } + ] + } +] + +@NgModule({ + imports: [ RouterModule.forChild(videoStudioRoutes) ], + exports: [ RouterModule ] +}) +export class VideoStudioRoutingModule {} diff --git a/client/src/app/+video-studio/video-studio.module.ts b/client/src/app/+video-studio/video-studio.module.ts new file mode 100644 index 000000000..1a8763539 --- /dev/null +++ b/client/src/app/+video-studio/video-studio.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core' +import { SharedFormModule } from '@app/shared/shared-forms' +import { SharedMainModule } from '@app/shared/shared-main' +import { VideoStudioEditComponent, VideoStudioEditResolver } from './edit' +import { VideoStudioService } from './shared' +import { VideoStudioRoutingModule } from './video-studio-routing.module' + +@NgModule({ + imports: [ + VideoStudioRoutingModule, + + SharedMainModule, + SharedFormModule + ], + + declarations: [ + VideoStudioEditComponent + ], + + exports: [], + + providers: [ + VideoStudioService, + VideoStudioEditResolver + ] +}) +export class VideoStudioModule { } diff --git a/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts b/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts index 6e8a64f46..af26ea04d 100644 --- a/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts +++ b/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts @@ -35,7 +35,7 @@ export class ActionButtonsComponent implements OnInit, OnChanges { playlist: false, download: true, update: true, - editor: true, + studio: true, blacklist: true, delete: true, report: true, diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index cd499845b..a831da099 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts @@ -144,8 +144,8 @@ const routes: Routes = [ }, { - path: 'video-editor', - loadChildren: () => import('./+video-editor/video-editor.module').then(m => m.VideoEditorModule), + path: 'studio', + loadChildren: () => import('./+video-studio/video-studio.module').then(m => m.VideoStudioModule), canActivateChild: [ MetaGuard ] }, diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index d1b36f347..a2367166e 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts @@ -228,7 +228,7 @@ export class UserNotification implements UserNotificationServer { this.pluginQueryParams.pluginType = this.plugin.type + '' break - case UserNotificationType.MY_VIDEO_EDITION_FINISHED: + case UserNotificationType.MY_VIDEO_STUDIO_EDITION_FINISHED: this.videoUrl = this.buildVideoUrl(this.video) break } diff --git a/client/src/app/shared/shared-main/users/user-notifications.component.html b/client/src/app/shared/shared-main/users/user-notifications.component.html index ff1259fb8..e7cdb0183 100644 --- a/client/src/app/shared/shared-main/users/user-notifications.component.html +++ b/client/src/app/shared/shared-main/users/user-notifications.component.html @@ -207,7 +207,7 @@
- +
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 612fcf16c..2d4db9a28 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -228,8 +228,8 @@ export class Video implements VideoServerModel { return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) } - isEditableBy (user: AuthUser, videoEditorEnabled: boolean) { - return videoEditorEnabled && + isEditableBy (user: AuthUser, videoStudioEnabled: boolean) { + return videoStudioEnabled && this.state?.id === VideoState.PUBLISHED && this.isUpdatableBy(user) } diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 29a711378..5eef96145 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts @@ -29,7 +29,7 @@ export type VideoActionsDisplayType = { liveInfo?: boolean removeFiles?: boolean transcoding?: boolean - editor?: boolean + studio?: boolean } @Component({ @@ -61,7 +61,7 @@ export class VideoActionsDropdownComponent implements OnChanges { liveInfo: false, removeFiles: false, transcoding: false, - editor: true + studio: true } @Input() placement = 'left' @@ -153,7 +153,7 @@ export class VideoActionsDropdownComponent implements OnChanges { } isVideoEditable () { - return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoEditor.enabled) + return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoStudio.enabled) } isVideoRemovable () { @@ -337,10 +337,10 @@ export class VideoActionsDropdownComponent implements OnChanges { isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() }, { - label: $localize`Editor`, - linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ], + label: $localize`Studio`, + linkBuilder: ({ video }) => [ '/studio/edit', video.uuid ], iconName: 'film', - isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.editor && this.isVideoEditable() + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.studio && this.isVideoEditable() }, { label: $localize`Block`, diff --git a/config/default.yaml b/config/default.yaml index 6db8d3803..009c9b6d4 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -436,7 +436,7 @@ live: 1440p: false 2160p: false -video_editor: +video_studio: # Enable video edition by users (cut, add intro/outro, add watermark etc) enabled: false diff --git a/config/production.yaml.example b/config/production.yaml.example index e6e85da12..8efe07c01 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -444,7 +444,7 @@ live: 1440p: false 2160p: false -video_editor: +video_studio: # Enable video edition by users (cut, add intro/outro, add watermark etc) enabled: false diff --git a/config/test-1.yaml b/config/test-1.yaml index 0f6d56f1a..fd6a5a341 100644 --- a/config/test-1.yaml +++ b/config/test-1.yaml @@ -37,7 +37,7 @@ signup: transcoding: enabled: false -video_editor: +video_studio: enabled: false live: diff --git a/config/test-3.yaml b/config/test-3.yaml index 3cd3ddba7..c04df6029 100644 --- a/config/test-3.yaml +++ b/config/test-3.yaml @@ -31,5 +31,5 @@ admin: transcoding: enabled: false -video_editor: +video_studio: enabled: false diff --git a/config/test-4.yaml b/config/test-4.yaml index 6d8e51945..963dee547 100644 --- a/config/test-4.yaml +++ b/config/test-4.yaml @@ -31,5 +31,5 @@ admin: transcoding: enabled: false -video_editor: +video_studio: enabled: false diff --git a/config/test-5.yaml b/config/test-5.yaml index 5f2157fec..f41378c24 100644 --- a/config/test-5.yaml +++ b/config/test-5.yaml @@ -31,5 +31,5 @@ admin: transcoding: enabled: false -video_editor: +video_studio: enabled: false diff --git a/config/test-6.yaml b/config/test-6.yaml index 9c43d2b2e..574f89d19 100644 --- a/config/test-6.yaml +++ b/config/test-6.yaml @@ -31,5 +31,5 @@ admin: transcoding: enabled: false -video_editor: +video_studio: enabled: false diff --git a/config/test.yaml b/config/test.yaml index 6887523ae..247100fdf 100644 --- a/config/test.yaml +++ b/config/test.yaml @@ -168,5 +168,5 @@ views: local_buffer_update_interval: '5 seconds' ip_view_expiration: '1 second' -video_editor: +video_studio: enabled: true 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 { } } }, - videoEditor: { - enabled: CONFIG.VIDEO_EDITOR.ENABLED + videoStudio: { + enabled: CONFIG.VIDEO_STUDIO.ENABLED }, import: { 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 abuseStateChange: body.abuseStateChange, newPeerTubeVersion: body.newPeerTubeVersion, newPluginVersion: body.newPluginVersion, - myVideoEditionFinished: body.myVideoEditionFinished + myVideoStudioEditionFinished: body.myVideoStudioEditionFinished } 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' import { blacklistRouter } from './blacklist' import { videoCaptionsRouter } from './captions' import { videoCommentRouter } from './comment' -import { editorRouter } from './editor' +import { studioRouter } from './studio' import { filesRouter } from './files' import { videoImportsRouter } from './import' import { liveRouter } from './live' @@ -52,7 +52,7 @@ const videosRouter = express.Router() videosRouter.use('/', blacklistRouter) videosRouter.use('/', rateVideoRouter) videosRouter.use('/', videoCommentRouter) -videosRouter.use('/', editorRouter) +videosRouter.use('/', studioRouter) videosRouter.use('/', videoCaptionsRouter) videosRouter.use('/', videoImportsRouter) videosRouter.use('/', ownershipVideoRouter) diff --git a/server/controllers/api/videos/editor.ts b/server/controllers/api/videos/studio.ts similarity index 67% rename from server/controllers/api/videos/editor.ts rename to 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' import { createAnyReqFiles } from '@server/helpers/express-utils' import { MIMETYPES } from '@server/initializers/constants' import { JobQueue } from '@server/lib/job-queue' -import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-editor' +import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-studio' import { HttpStatusCode, - VideoEditionTaskPayload, - VideoEditorCreateEdition, - VideoEditorTask, - VideoEditorTaskCut, - VideoEditorTaskIntro, - VideoEditorTaskOutro, - VideoEditorTaskWatermark, - VideoState + VideoState, + VideoStudioCreateEdition, + VideoStudioTask, + VideoStudioTaskCut, + VideoStudioTaskIntro, + VideoStudioTaskOutro, + VideoStudioTaskPayload, + VideoStudioTaskWatermark } from '@shared/models' -import { asyncMiddleware, authenticate, videosEditorAddEditionValidator } from '../../../middlewares' +import { asyncMiddleware, authenticate, videoStudioAddEditionValidator } from '../../../middlewares' -const editorRouter = express.Router() +const studioRouter = express.Router() const tasksFiles = createAnyReqFiles( MIMETYPES.VIDEO.MIMETYPE_EXT, (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => { - const body = req.body as VideoEditorCreateEdition + const body = req.body as VideoStudioCreateEdition // Fetch array element const matches = file.fieldname.match(/tasks\[(\d+)\]/) @@ -43,24 +43,24 @@ const tasksFiles = createAnyReqFiles( } ) -editorRouter.post('/:videoId/editor/edit', +studioRouter.post('/:videoId/studio/edit', authenticate, tasksFiles, - asyncMiddleware(videosEditorAddEditionValidator), + asyncMiddleware(videoStudioAddEditionValidator), asyncMiddleware(createEditionTasks) ) // --------------------------------------------------------------------------- export { - editorRouter + studioRouter } // --------------------------------------------------------------------------- async function createEditionTasks (req: express.Request, res: express.Response) { const files = req.files as Express.Multer.File[] - const body = req.body as VideoEditorCreateEdition + const body = req.body as VideoStudioCreateEdition const video = res.locals.videoAll video.state = VideoState.TO_EDIT @@ -71,13 +71,13 @@ async function createEditionTasks (req: express.Request, res: express.Response) tasks: body.tasks.map((t, i) => buildTaskPayload(t, i, files)) } - JobQueue.Instance.createJob({ type: 'video-edition', payload }) + JobQueue.Instance.createJob({ type: 'video-studio-edition', payload }) return res.sendStatus(HttpStatusCode.NO_CONTENT_204) } const taskPayloadBuilders: { - [id in VideoEditorTask['name']]: (task: VideoEditorTask, indice?: number, files?: Express.Multer.File[]) => VideoEditionTaskPayload + [id in VideoStudioTask['name']]: (task: VideoStudioTask, indice?: number, files?: Express.Multer.File[]) => VideoStudioTaskPayload } = { 'add-intro': buildIntroOutroTask, 'add-outro': buildIntroOutroTask, @@ -85,11 +85,11 @@ const taskPayloadBuilders: { 'add-watermark': buildWatermarkTask } -function buildTaskPayload (task: VideoEditorTask, indice: number, files: Express.Multer.File[]): VideoEditionTaskPayload { +function buildTaskPayload (task: VideoStudioTask, indice: number, files: Express.Multer.File[]): VideoStudioTaskPayload { return taskPayloadBuilders[task.name](task, indice, files) } -function buildIntroOutroTask (task: VideoEditorTaskIntro | VideoEditorTaskOutro, indice: number, files: Express.Multer.File[]) { +function buildIntroOutroTask (task: VideoStudioTaskIntro | VideoStudioTaskOutro, indice: number, files: Express.Multer.File[]) { return { name: task.name, options: { @@ -98,7 +98,7 @@ function buildIntroOutroTask (task: VideoEditorTaskIntro | VideoEditorTaskOutro, } } -function buildCutTask (task: VideoEditorTaskCut) { +function buildCutTask (task: VideoStudioTaskCut) { return { name: task.name, options: { @@ -108,7 +108,7 @@ function buildCutTask (task: VideoEditorTaskCut) { } } -function buildWatermarkTask (task: VideoEditorTaskWatermark, indice: number, files: Express.Multer.File[]) { +function buildWatermarkTask (task: VideoStudioTaskWatermark, indice: number, files: Express.Multer.File[]) { return { name: task.name, options: { diff --git a/server/helpers/custom-validators/video-editor.ts b/server/helpers/custom-validators/video-studio.ts similarity index 64% rename from server/helpers/custom-validators/video-editor.ts rename to server/helpers/custom-validators/video-studio.ts index 09238675e..19e7906d5 100644 --- a/server/helpers/custom-validators/video-editor.ts +++ b/server/helpers/custom-validators/video-studio.ts @@ -1,40 +1,40 @@ import validator from 'validator' import { CONSTRAINTS_FIELDS } from '@server/initializers/constants' -import { buildTaskFileFieldname } from '@server/lib/video-editor' -import { VideoEditorTask } from '@shared/models' +import { buildTaskFileFieldname } from '@server/lib/video-studio' +import { VideoStudioTask } from '@shared/models' import { isArray } from './misc' import { isVideoFileMimeTypeValid, isVideoImageValid } from './videos' -function isValidEditorTasksArray (tasks: any) { +function isValidStudioTasksArray (tasks: any) { if (!isArray(tasks)) return false - return tasks.length >= CONSTRAINTS_FIELDS.VIDEO_EDITOR.TASKS.min && - tasks.length <= CONSTRAINTS_FIELDS.VIDEO_EDITOR.TASKS.max + return tasks.length >= CONSTRAINTS_FIELDS.VIDEO_STUDIO.TASKS.min && + tasks.length <= CONSTRAINTS_FIELDS.VIDEO_STUDIO.TASKS.max } -function isEditorCutTaskValid (task: VideoEditorTask) { +function isStudioCutTaskValid (task: VideoStudioTask) { if (task.name !== 'cut') return false if (!task.options) return false const { start, end } = task.options if (!start && !end) return false - if (start && !validator.isInt(start + '', CONSTRAINTS_FIELDS.VIDEO_EDITOR.CUT_TIME)) return false - if (end && !validator.isInt(end + '', CONSTRAINTS_FIELDS.VIDEO_EDITOR.CUT_TIME)) return false + if (start && !validator.isInt(start + '', CONSTRAINTS_FIELDS.VIDEO_STUDIO.CUT_TIME)) return false + if (end && !validator.isInt(end + '', CONSTRAINTS_FIELDS.VIDEO_STUDIO.CUT_TIME)) return false if (!start || !end) return true return parseInt(start + '') < parseInt(end + '') } -function isEditorTaskAddIntroOutroValid (task: VideoEditorTask, indice: number, files: Express.Multer.File[]) { +function isStudioTaskAddIntroOutroValid (task: VideoStudioTask, indice: number, files: Express.Multer.File[]) { const file = files.find(f => f.fieldname === buildTaskFileFieldname(indice, 'file')) return (task.name === 'add-intro' || task.name === 'add-outro') && file && isVideoFileMimeTypeValid([ file ], null) } -function isEditorTaskAddWatermarkValid (task: VideoEditorTask, indice: number, files: Express.Multer.File[]) { +function isStudioTaskAddWatermarkValid (task: VideoStudioTask, indice: number, files: Express.Multer.File[]) { const file = files.find(f => f.fieldname === buildTaskFileFieldname(indice, 'file')) return task.name === 'add-watermark' && @@ -44,9 +44,9 @@ function isEditorTaskAddWatermarkValid (task: VideoEditorTask, indice: number, f // --------------------------------------------------------------------------- export { - isValidEditorTasksArray, + isValidStudioTasksArray, - isEditorCutTaskValid, - isEditorTaskAddIntroOutroValid, - isEditorTaskAddWatermarkValid + isStudioCutTaskValid, + isStudioTaskAddIntroOutroValid, + isStudioTaskAddWatermarkValid } diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts index 635a32010..f65798c42 100644 --- a/server/initializers/checker-after-init.ts +++ b/server/initializers/checker-after-init.ts @@ -49,7 +49,7 @@ function checkConfig () { checkSearchConfig() checkLiveConfig() checkObjectStorageConfig() - checkVideoEditorConfig() + checkVideoStudioConfig() } // We get db by param to not import it in this file (import orders) @@ -260,8 +260,8 @@ function checkObjectStorageConfig () { } } -function checkVideoEditorConfig () { - if (CONFIG.VIDEO_EDITOR.ENABLED === true && CONFIG.TRANSCODING.ENABLED === false) { - throw new Error('Video editor cannot be enabled if transcoding is disabled') +function checkVideoStudioConfig () { + if (CONFIG.VIDEO_STUDIO.ENABLED === true && CONFIG.TRANSCODING.ENABLED === false) { + throw new Error('Video studio cannot be enabled if transcoding is disabled') } } diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index fa311f708..0f23a2d73 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts @@ -30,7 +30,7 @@ function checkMissedConfig () { 'transcoding.profile', 'transcoding.concurrency', 'transcoding.resolutions.0p', 'transcoding.resolutions.144p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p', 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', - 'transcoding.resolutions.2160p', 'video_editor.enabled', + 'transcoding.resolutions.2160p', 'video_studio.enabled', 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled', 'trending.videos.interval_days', 'client.videos.miniature.display_author_avatar', diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 1658298c5..122cb9472 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -335,8 +335,8 @@ const CONFIG = { } } }, - VIDEO_EDITOR: { - get ENABLED () { return config.get('video_editor.enabled') } + VIDEO_STUDIO: { + get ENABLED () { return config.get('video_studio.enabled') } }, IMPORT: { VIDEOS: { diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 17d8ba556..6bcefe0db 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -152,7 +152,7 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = { 'activitypub-refresher': 1, 'video-redundancy': 1, 'video-live-ending': 1, - 'video-edition': 1, + 'video-studio-edition': 1, 'manage-video-torrent': 1, 'move-to-object-storage': 3 } @@ -170,7 +170,7 @@ const JOB_CONCURRENCY: { [id in Exclude = { +type TaskProcessorOptions = { inputPath: string outputPath: string video: MVideo @@ -119,7 +119,7 @@ type TaskProcessorOptions Promise } = { +const taskProcessors: { [id in VideoStudioTask['name']]: (options: TaskProcessorOptions) => Promise } = { 'add-intro': processAddIntroOutro, 'add-outro': processAddIntroOutro, 'cut': processCut, @@ -137,7 +137,7 @@ async function processTask (options: TaskProcessorOptions) { return processor(options) } -function processAddIntroOutro (options: TaskProcessorOptions) { +function processAddIntroOutro (options: TaskProcessorOptions) { const { task } = options return addIntroOutro({ @@ -153,7 +153,7 @@ function processAddIntroOutro (options: TaskProcessorOptions) { +function processCut (options: TaskProcessorOptions) { const { task } = options return cutVideo({ @@ -164,7 +164,7 @@ function processCut (options: TaskProcessorOptions) { }) } -function processAddWatermark (options: TaskProcessorOptions) { +function processAddWatermark (options: TaskProcessorOptions) { const { task } = options return addWatermark({ @@ -212,10 +212,10 @@ async function removeAllFiles (video: MVideoWithAllFiles, webTorrentFileExceptio } } -async function checkUserQuotaOrThrow (video: MVideoFullLight, payload: VideoEditionPayload) { +async function checkUserQuotaOrThrow (video: MVideoFullLight, payload: VideoStudioEditionPayload) { const user = await UserModel.loadByVideoId(video.id) - const filePathFinder = (i: number) => (payload.tasks[i] as VideoEditorTaskIntroPayload | VideoEditorTaskOutroPayload).options.file + const filePathFinder = (i: number) => (payload.tasks[i] as VideoStudioTaskIntroPayload | VideoStudioTaskOutroPayload).options.file const additionalBytes = await approximateIntroOutroAdditionalSize(video, payload.tasks, filePathFinder) if (await isAbleToUploadVideo(user.id, additionalBytes) === false) { diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index 3224abcc3..167b7b168 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts @@ -15,11 +15,11 @@ import { ManageVideoTorrentPayload, MoveObjectStoragePayload, RefreshPayload, - VideoEditionPayload, VideoFileImportPayload, VideoImportPayload, VideoLiveEndingPayload, VideoRedundancyPayload, + VideoStudioEditionPayload, VideoTranscodingPayload } from '../../../shared/models' import { logger } from '../../helpers/logger' @@ -34,10 +34,10 @@ import { processActorKeys } from './handlers/actor-keys' import { processEmail } from './handlers/email' import { processManageVideoTorrent } from './handlers/manage-video-torrent' import { processMoveToObjectStorage } from './handlers/move-to-object-storage' -import { processVideoEdition } from './handlers/video-edition' import { processVideoFileImport } from './handlers/video-file-import' import { processVideoImport } from './handlers/video-import' import { processVideoLiveEnding } from './handlers/video-live-ending' +import { processVideoStudioEdition } from './handlers/video-studio-edition' import { processVideoTranscoding } from './handlers/video-transcoding' import { processVideosViewsStats } from './handlers/video-views-stats' @@ -57,7 +57,7 @@ type CreateJobArgument = { type: 'actor-keys', payload: ActorKeysPayload } | { type: 'video-redundancy', payload: VideoRedundancyPayload } | { type: 'delete-resumable-upload-meta-file', payload: DeleteResumableUploadMetaFilePayload } | - { type: 'video-edition', payload: VideoEditionPayload } | + { type: 'video-studio-edition', payload: VideoStudioEditionPayload } | { type: 'manage-video-torrent', payload: ManageVideoTorrentPayload } | { type: 'move-to-object-storage', payload: MoveObjectStoragePayload } @@ -83,7 +83,7 @@ const handlers: { [id in JobType]: (job: Job) => Promise } = { 'video-redundancy': processVideoRedundancy, 'move-to-object-storage': processMoveToObjectStorage, 'manage-video-torrent': processManageVideoTorrent, - 'video-edition': processVideoEdition + 'video-studio-edition': processVideoStudioEdition } const jobTypes: JobType[] = [ @@ -103,7 +103,7 @@ const jobTypes: JobType[] = [ 'video-live-ending', 'move-to-object-storage', 'manage-video-torrent', - 'video-edition' + 'video-studio-edition' ] class JobQueue { diff --git a/server/lib/notifier/notifier.ts b/server/lib/notifier/notifier.ts index e34a82603..a6f13780b 100644 --- a/server/lib/notifier/notifier.ts +++ b/server/lib/notifier/notifier.ts @@ -12,7 +12,7 @@ import { AbuseStateChangeForReporter, AutoFollowForInstance, CommentMention, - EditionFinishedForOwner, + StudioEditionFinishedForOwner, FollowForInstance, FollowForUser, ImportFinishedForOwner, @@ -55,7 +55,7 @@ class Notifier { newAbuseMessage: [ NewAbuseMessageForReporter, NewAbuseMessageForModerators ], newPeertubeVersion: [ NewPeerTubeVersionForAdmins ], newPluginVersion: [ NewPluginVersionForAdmins ], - videoEditionFinished: [ EditionFinishedForOwner ] + videoStudioEditionFinished: [ StudioEditionFinishedForOwner ] } private static instance: Notifier @@ -200,11 +200,11 @@ class Notifier { .catch(err => logger.error('Cannot notify on new plugin version %s.', plugin.name, { err })) } - notifyOfFinishedVideoEdition (video: MVideoFullLight) { - const models = this.notificationModels.videoEditionFinished + notifyOfFinishedVideoStudioEdition (video: MVideoFullLight) { + const models = this.notificationModels.videoStudioEditionFinished this.sendNotifications(models, video) - .catch(err => logger.error('Cannot notify on finished edition %s.', video.url, { err })) + .catch(err => logger.error('Cannot notify on finished studio edition %s.', video.url, { err })) } private async notify (object: AbstractNotification) { diff --git a/server/lib/notifier/shared/video-publication/index.ts b/server/lib/notifier/shared/video-publication/index.ts index 57f3443b9..5e92cb011 100644 --- a/server/lib/notifier/shared/video-publication/index.ts +++ b/server/lib/notifier/shared/video-publication/index.ts @@ -1,6 +1,6 @@ export * from './new-video-for-subscribers' -export * from './edition-finished-for-owner' export * from './import-finished-for-owner' export * from './owned-publication-after-auto-unblacklist' export * from './owned-publication-after-schedule-update' export * from './owned-publication-after-transcoding' +export * from './studio-edition-finished-for-owner' diff --git a/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts b/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts similarity index 81% rename from server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts rename to server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts index dec91f574..ee3027245 100644 --- a/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts +++ b/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts @@ -6,7 +6,7 @@ import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotifi import { UserNotificationType } from '@shared/models' import { AbstractNotification } from '../common/abstract-notification' -export class EditionFinishedForOwner extends AbstractNotification { +export class StudioEditionFinishedForOwner extends AbstractNotification { private user: MUserDefault async prepare () { @@ -14,11 +14,11 @@ export class EditionFinishedForOwner extends AbstractNotification ({ - type: UserNotificationType.MY_VIDEO_EDITION_FINISHED, + type: UserNotificationType.MY_VIDEO_STUDIO_EDITION_FINISHED, userId: user.id, videoId: this.payload.id }) diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts index b920b73d5..d16a88f65 100644 --- a/server/lib/server-config-manager.ts +++ b/server/lib/server-config-manager.ts @@ -159,8 +159,8 @@ class ServerConfigManager { port: CONFIG.LIVE.RTMP.PORT } }, - videoEditor: { - enabled: CONFIG.VIDEO_EDITOR.ENABLED + videoStudio: { + enabled: CONFIG.VIDEO_STUDIO.ENABLED }, import: { videos: { diff --git a/server/lib/user.ts b/server/lib/user.ts index 173d89d0b..310a3c30c 100644 --- a/server/lib/user.ts +++ b/server/lib/user.ts @@ -253,7 +253,7 @@ function createDefaultUserNotificationSettings (user: MUserId, t: Transaction | autoInstanceFollowing: UserNotificationSettingValue.WEB, newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, newPluginVersion: UserNotificationSettingValue.WEB, - myVideoEditionFinished: UserNotificationSettingValue.WEB + myVideoStudioEditionFinished: UserNotificationSettingValue.WEB } return UserNotificationSettingModel.create(values, { transaction: t }) diff --git a/server/lib/video-state.ts b/server/lib/video-state.ts index f75f81704..7b207eb87 100644 --- a/server/lib/video-state.ts +++ b/server/lib/video-state.ts @@ -135,7 +135,7 @@ async function moveToPublishedState (options: { await federateVideoIfNeeded(video, isNewVideo, transaction) if (previousState === VideoState.TO_EDIT) { - Notifier.Instance.notifyOfFinishedVideoEdition(video) + Notifier.Instance.notifyOfFinishedVideoStudioEdition(video) return } diff --git a/server/lib/video-editor.ts b/server/lib/video-studio.ts similarity index 78% rename from server/lib/video-editor.ts rename to server/lib/video-studio.ts index 99b0bd949..cdacd35f2 100644 --- a/server/lib/video-editor.ts +++ b/server/lib/video-studio.ts @@ -1,6 +1,6 @@ -import { MVideoFullLight } from "@server/types/models" -import { getVideoStreamDuration } from "@shared/extra-utils" -import { VideoEditorTask } from "@shared/models" +import { MVideoFullLight } from '@server/types/models' +import { getVideoStreamDuration } from '@shared/extra-utils' +import { VideoStudioTask } from '@shared/models' function buildTaskFileFieldname (indice: number, fieldName = 'file') { return `tasks[${indice}][options][${fieldName}]` @@ -10,7 +10,7 @@ function getTaskFile (files: Express.Multer.File[], indice: number, fieldName = return files.find(f => f.fieldname === buildTaskFileFieldname(indice, fieldName)) } -async function approximateIntroOutroAdditionalSize (video: MVideoFullLight, tasks: VideoEditorTask[], fileFinder: (i: number) => string) { +async function approximateIntroOutroAdditionalSize (video: MVideoFullLight, tasks: VideoStudioTask[], fileFinder: (i: number) => string) { let additionalDuration = 0 for (let i = 0; i < tasks.length; i++) { diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index e87b2e39d..1e839d577 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts @@ -57,7 +57,7 @@ const customConfigUpdateValidator = [ body('transcoding.webtorrent.enabled').isBoolean().withMessage('Should have a valid webtorrent transcoding enabled boolean'), body('transcoding.hls.enabled').isBoolean().withMessage('Should have a valid hls transcoding enabled boolean'), - body('videoEditor.enabled').isBoolean().withMessage('Should have a valid video editor enabled boolean'), + body('videoStudio.enabled').isBoolean().withMessage('Should have a valid video studio enabled boolean'), body('import.videos.concurrency').isInt({ min: 0 }).withMessage('Should have a valid import concurrency number'), body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'), @@ -106,7 +106,7 @@ const customConfigUpdateValidator = [ if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return if (!checkInvalidTranscodingConfig(req.body, res)) return if (!checkInvalidLiveConfig(req.body, res)) return - if (!checkInvalidVideoEditorConfig(req.body, res)) return + if (!checkInvalidVideoStudioConfig(req.body, res)) return return next() } @@ -163,11 +163,11 @@ function checkInvalidLiveConfig (customConfig: CustomConfig, res: express.Respon return true } -function checkInvalidVideoEditorConfig (customConfig: CustomConfig, res: express.Response) { - if (customConfig.videoEditor.enabled === false) return true +function checkInvalidVideoStudioConfig (customConfig: CustomConfig, res: express.Response) { + if (customConfig.videoStudio.enabled === false) return true - if (customConfig.videoEditor.enabled === true && customConfig.transcoding.enabled === false) { - res.fail({ message: 'You cannot enable video editor if transcoding is not enabled' }) + if (customConfig.videoStudio.enabled === true && customConfig.transcoding.enabled === false) { + res.fail({ message: 'You cannot enable video studio if transcoding is not enabled' }) return false } diff --git a/server/middlewares/validators/videos/index.ts b/server/middlewares/validators/videos/index.ts index faa082510..c7dea4b3d 100644 --- a/server/middlewares/validators/videos/index.ts +++ b/server/middlewares/validators/videos/index.ts @@ -2,7 +2,6 @@ export * from './video-blacklist' export * from './video-captions' export * from './video-channels' export * from './video-comments' -export * from './video-editor' export * from './video-files' export * from './video-imports' export * from './video-live' @@ -10,5 +9,6 @@ export * from './video-ownership-changes' export * from './video-watch' export * from './video-rates' export * from './video-shares' +export * from './video-studio' export * from './video-transcoding' export * from './videos' diff --git a/server/middlewares/validators/videos/video-editor.ts b/server/middlewares/validators/videos/video-studio.ts similarity index 74% rename from server/middlewares/validators/videos/video-editor.ts rename to server/middlewares/validators/videos/video-studio.ts index 9be97be93..af7fe2283 100644 --- a/server/middlewares/validators/videos/video-editor.ts +++ b/server/middlewares/validators/videos/video-studio.ts @@ -2,31 +2,31 @@ import express from 'express' import { body, param } from 'express-validator' import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc' import { - isEditorCutTaskValid, - isEditorTaskAddIntroOutroValid, - isEditorTaskAddWatermarkValid, - isValidEditorTasksArray -} from '@server/helpers/custom-validators/video-editor' + isStudioCutTaskValid, + isStudioTaskAddIntroOutroValid, + isStudioTaskAddWatermarkValid, + isValidStudioTasksArray +} from '@server/helpers/custom-validators/video-studio' import { cleanUpReqFiles } from '@server/helpers/express-utils' import { CONFIG } from '@server/initializers/config' -import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-editor' +import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio' import { isAudioFile } from '@shared/extra-utils' -import { HttpStatusCode, UserRight, VideoEditorCreateEdition, VideoEditorTask, VideoState } from '@shared/models' +import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' import { logger } from '../../../helpers/logger' import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' -const videosEditorAddEditionValidator = [ +const videoStudioAddEditionValidator = [ param('videoId').custom(isIdOrUUIDValid).withMessage('Should have a valid video id/uuid'), - body('tasks').custom(isValidEditorTasksArray).withMessage('Should have a valid array of tasks'), + body('tasks').custom(isValidStudioTasksArray).withMessage('Should have a valid array of tasks'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking videosEditorAddEditionValidator parameters.', { parameters: req.params, body: req.body, files: req.files }) + logger.debug('Checking videoStudioAddEditionValidator parameters.', { parameters: req.params, body: req.body, files: req.files }) - if (CONFIG.VIDEO_EDITOR.ENABLED !== true) { + if (CONFIG.VIDEO_STUDIO.ENABLED !== true) { res.fail({ status: HttpStatusCode.BAD_REQUEST_400, - message: 'Video editor is disabled on this instance' + message: 'Video studio is disabled on this instance' }) return cleanUpReqFiles(req) @@ -34,7 +34,7 @@ const videosEditorAddEditionValidator = [ if (areValidationErrors(req, res)) return cleanUpReqFiles(req) - const body: VideoEditorCreateEdition = req.body + const body: VideoStudioCreateEdition = req.body const files = req.files as Express.Multer.File[] for (let i = 0; i < body.tasks.length; i++) { @@ -90,21 +90,21 @@ const videosEditorAddEditionValidator = [ // --------------------------------------------------------------------------- export { - videosEditorAddEditionValidator + videoStudioAddEditionValidator } // --------------------------------------------------------------------------- const taskCheckers: { - [id in VideoEditorTask['name']]: (task: VideoEditorTask, indice?: number, files?: Express.Multer.File[]) => boolean + [id in VideoStudioTask['name']]: (task: VideoStudioTask, indice?: number, files?: Express.Multer.File[]) => boolean } = { - 'cut': isEditorCutTaskValid, - 'add-intro': isEditorTaskAddIntroOutroValid, - 'add-outro': isEditorTaskAddIntroOutroValid, - 'add-watermark': isEditorTaskAddWatermarkValid + 'cut': isStudioCutTaskValid, + 'add-intro': isStudioTaskAddIntroOutroValid, + 'add-outro': isStudioTaskAddIntroOutroValid, + 'add-watermark': isStudioTaskAddWatermarkValid } -function checkTask (req: express.Request, task: VideoEditorTask, indice?: number) { +function checkTask (req: express.Request, task: VideoStudioTask, indice?: number) { const checker = taskCheckers[task.name] if (!checker) return false diff --git a/server/models/user/user-notification-setting.ts b/server/models/user/user-notification-setting.ts index b144f8377..66e1d85b3 100644 --- a/server/models/user/user-notification-setting.ts +++ b/server/models/user/user-notification-setting.ts @@ -178,11 +178,11 @@ export class UserNotificationSettingModel extends Model throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoEditionFinished') + 'UserNotificationSettingMyVideoStudioEditionFinished', + value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoStudioEditionFinished') ) @Column - myVideoEditionFinished: UserNotificationSettingValue + myVideoStudioEditionFinished: UserNotificationSettingValue @ForeignKey(() => UserModel) @Column @@ -225,7 +225,7 @@ export class UserNotificationSettingModel extends Model { @@ -335,7 +335,7 @@ describe('Test user notifications', function () { } }) - it('Should send a notification after editor edition', async function () { + it('Should send a notification after studio edition', async function () { this.timeout(240000) const { name, shortUUID, id } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true }) @@ -343,7 +343,7 @@ describe('Test user notifications', function () { await waitJobs(servers) await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' }) - const tasks: VideoEditorTask[] = [ + const tasks: VideoStudioTask[] = [ { name: 'cut', options: { @@ -352,10 +352,10 @@ describe('Test user notifications', function () { } } ] - await servers[1].videoEditor.createEditionTasks({ videoId: id, tasks }) + await servers[1].videoStudio.createEditionTasks({ videoId: id, tasks }) await waitJobs(servers) - await checkVideoEditionIsFinished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' }) + await checkVideoStudioEditionIsFinished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' }) }) }) diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 5028b65e6..f31012a5c 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -98,7 +98,7 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) { expect(data.live.transcoding.resolutions['1440p']).to.be.false expect(data.live.transcoding.resolutions['2160p']).to.be.false - expect(data.videoEditor.enabled).to.be.false + expect(data.videoStudio.enabled).to.be.false expect(data.import.videos.concurrency).to.equal(2) expect(data.import.videos.http.enabled).to.be.true @@ -201,7 +201,7 @@ function checkUpdatedConfig (data: CustomConfig) { expect(data.live.transcoding.resolutions['1080p']).to.be.true expect(data.live.transcoding.resolutions['2160p']).to.be.true - expect(data.videoEditor.enabled).to.be.true + expect(data.videoStudio.enabled).to.be.true expect(data.import.videos.concurrency).to.equal(4) expect(data.import.videos.http.enabled).to.be.false @@ -350,7 +350,7 @@ const newCustomConfig: CustomConfig = { } } }, - videoEditor: { + videoStudio: { enabled: true }, import: { diff --git a/server/tests/api/transcoding/index.ts b/server/tests/api/transcoding/index.ts index 8a0a1d787..0cc28b4a4 100644 --- a/server/tests/api/transcoding/index.ts +++ b/server/tests/api/transcoding/index.ts @@ -2,4 +2,4 @@ export * from './audio-only' export * from './create-transcoding' export * from './hls' export * from './transcoder' -export * from './video-editor' +export * from './video-studio' diff --git a/server/tests/api/transcoding/video-editor.ts b/server/tests/api/transcoding/video-studio.ts similarity index 94% rename from server/tests/api/transcoding/video-editor.ts rename to server/tests/api/transcoding/video-studio.ts index f70bd49e6..ac1c0fc7e 100644 --- a/server/tests/api/transcoding/video-editor.ts +++ b/server/tests/api/transcoding/video-studio.ts @@ -1,7 +1,7 @@ import { expect } from 'chai' import { expectStartWith, getAllFiles } from '@server/tests/shared' import { areObjectStorageTestsDisabled } from '@shared/core-utils' -import { VideoEditorTask } from '@shared/models' +import { VideoStudioTask } from '@shared/models' import { cleanupTests, createMultipleServers, @@ -10,11 +10,11 @@ import { PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, - VideoEditorCommand, + VideoStudioCommand, waitJobs } from '@shared/server-commands' -describe('Test video editor', function () { +describe('Test video studio', function () { let servers: PeerTubeServer[] = [] let videoUUID: string @@ -39,8 +39,8 @@ describe('Test video editor', function () { await waitJobs(servers) } - async function createTasks (tasks: VideoEditorTask[]) { - await servers[0].videoEditor.createEditionTasks({ videoId: videoUUID, tasks }) + async function createTasks (tasks: VideoStudioTask[]) { + await servers[0].videoStudio.createEditionTasks({ videoId: videoUUID, tasks }) await waitJobs(servers) } @@ -56,7 +56,7 @@ describe('Test video editor', function () { await servers[0].config.enableMinimumTranscoding() - await servers[0].config.enableEditor() + await servers[0].config.enableStudio() }) describe('Cutting', function () { @@ -276,7 +276,7 @@ describe('Test video editor', function () { this.timeout(240_000) await renewVideo() - await createTasks(VideoEditorCommand.getComplexTask()) + await createTasks(VideoStudioCommand.getComplexTask()) for (const server of servers) { await checkDuration(server, 9) @@ -303,7 +303,7 @@ describe('Test video editor', function () { this.timeout(240_000) await renewVideo() - await createTasks(VideoEditorCommand.getComplexTask()) + await createTasks(VideoStudioCommand.getComplexTask()) for (const server of servers) { const video = await server.videos.get({ id: videoUUID }) @@ -333,7 +333,7 @@ describe('Test video editor', function () { const video = await servers[0].videos.get({ id: videoUUID }) const oldFileUrls = getAllFiles(video).map(f => f.fileUrl) - await createTasks(VideoEditorCommand.getComplexTask()) + await createTasks(VideoStudioCommand.getComplexTask()) for (const server of servers) { const video = await server.videos.get({ id: videoUUID }) diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts index f1ddbbbf7..2a69a09de 100644 --- a/server/tests/shared/notifications.ts +++ b/server/tests/shared/notifications.ts @@ -47,7 +47,7 @@ function getAllNotificationsSettings (): UserNotificationSetting { abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, - myVideoEditionFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, + myVideoStudioEditionFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL } } @@ -110,13 +110,13 @@ async function checkVideoIsPublished (options: CheckerBaseParams & { await checkNotification({ ...options, notificationChecker, emailNotificationFinder }) } -async function checkVideoEditionIsFinished (options: CheckerBaseParams & { +async function checkVideoStudioEditionIsFinished (options: CheckerBaseParams & { videoName: string shortUUID: string checkType: CheckerType }) { const { videoName, shortUUID } = options - const notificationType = UserNotificationType.MY_VIDEO_EDITION_FINISHED + const notificationType = UserNotificationType.MY_VIDEO_STUDIO_EDITION_FINISHED function notificationChecker (notification: UserNotification, checkType: CheckerType) { if (checkType === 'presence') { @@ -685,7 +685,7 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an await setDefaultChannelAvatar(servers) await setDefaultAccountAvatar(servers) - await servers[1].config.enableEditor() + await servers[1].config.enableStudio() if (serversCount > 1) { await doubleFollow(servers[0], servers[1]) @@ -756,7 +756,7 @@ export { checkNewAccountAbuseForModerators, checkNewPeerTubeVersion, checkNewPluginVersion, - checkVideoEditionIsFinished + checkVideoStudioEditionIsFinished } // --------------------------------------------------------------------------- diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 5df606566..ab83ed497 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -147,7 +147,7 @@ export interface CustomConfig { } } - videoEditor: { + videoStudio: { enabled: boolean } diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index 3b4855eaa..91469d010 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts @@ -1,6 +1,6 @@ import { ContextType } from '../activitypub/context' import { VideoState } from '../videos' -import { VideoEditorTaskCut } from '../videos/editor' +import { VideoStudioTaskCut } from '../videos/studio' import { VideoResolution } from '../videos/file/video-resolution.enum' import { SendEmailOptions } from './emailer.model' @@ -23,7 +23,7 @@ export type JobType = | 'actor-keys' | 'manage-video-torrent' | 'move-to-object-storage' - | 'video-edition' + | 'video-studio-edition' export interface Job { id: number @@ -117,9 +117,6 @@ export type ManageVideoTorrentPayload = interface BaseTranscodingPayload { videoUUID: string isNewVideo?: boolean - - // Custom notification when the task is finished - notification?: 'default' | 'video-edition' } export interface HLSTranscodingPayload extends BaseTranscodingPayload { @@ -178,9 +175,9 @@ export interface MoveObjectStoragePayload { previousVideoState: VideoState } -export type VideoEditorTaskCutPayload = VideoEditorTaskCut +export type VideoStudioTaskCutPayload = VideoStudioTaskCut -export type VideoEditorTaskIntroPayload = { +export type VideoStudioTaskIntroPayload = { name: 'add-intro' options: { @@ -188,7 +185,7 @@ export type VideoEditorTaskIntroPayload = { } } -export type VideoEditorTaskOutroPayload = { +export type VideoStudioTaskOutroPayload = { name: 'add-outro' options: { @@ -196,7 +193,7 @@ export type VideoEditorTaskOutroPayload = { } } -export type VideoEditorTaskWatermarkPayload = { +export type VideoStudioTaskWatermarkPayload = { name: 'add-watermark' options: { @@ -204,13 +201,13 @@ export type VideoEditorTaskWatermarkPayload = { } } -export type VideoEditionTaskPayload = - VideoEditorTaskCutPayload | - VideoEditorTaskIntroPayload | - VideoEditorTaskOutroPayload | - VideoEditorTaskWatermarkPayload +export type VideoStudioTaskPayload = + VideoStudioTaskCutPayload | + VideoStudioTaskIntroPayload | + VideoStudioTaskOutroPayload | + VideoStudioTaskWatermarkPayload -export interface VideoEditionPayload { +export interface VideoStudioEditionPayload { videoUUID: string - tasks: VideoEditionTaskPayload[] + tasks: VideoStudioTaskPayload[] } diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 146bed24b..67ad809f7 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -175,7 +175,7 @@ export interface ServerConfig { } } - videoEditor: { + videoStudio: { enabled: boolean } diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index 35656f14c..278a05e7a 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -28,5 +28,5 @@ export interface UserNotificationSetting { newPeerTubeVersion: UserNotificationSettingValue newPluginVersion: UserNotificationSettingValue - myVideoEditionFinished: UserNotificationSettingValue + myVideoStudioEditionFinished: UserNotificationSettingValue } diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index a2918194f..0fd7a7181 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -32,7 +32,7 @@ export const enum UserNotificationType { NEW_PLUGIN_VERSION = 17, NEW_PEERTUBE_VERSION = 18, - MY_VIDEO_EDITION_FINISHED = 19 + MY_VIDEO_STUDIO_EDITION_FINISHED = 19 } export interface VideoInfo { diff --git a/shared/models/videos/editor/index.ts b/shared/models/videos/editor/index.ts deleted file mode 100644 index 3436f2c3f..000000000 --- a/shared/models/videos/editor/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-editor-create-edit.model' diff --git a/shared/models/videos/editor/video-editor-create-edit.model.ts b/shared/models/videos/editor/video-editor-create-edit.model.ts deleted file mode 100644 index 36b7c8d55..000000000 --- a/shared/models/videos/editor/video-editor-create-edit.model.ts +++ /dev/null @@ -1,42 +0,0 @@ -export interface VideoEditorCreateEdition { - tasks: VideoEditorTask[] -} - -export type VideoEditorTask = - VideoEditorTaskCut | - VideoEditorTaskIntro | - VideoEditorTaskOutro | - VideoEditorTaskWatermark - -export interface VideoEditorTaskCut { - name: 'cut' - - options: { - start?: number - end?: number - } -} - -export interface VideoEditorTaskIntro { - name: 'add-intro' - - options: { - file: Blob | string - } -} - -export interface VideoEditorTaskOutro { - name: 'add-outro' - - options: { - file: Blob | string - } -} - -export interface VideoEditorTaskWatermark { - name: 'add-watermark' - - options: { - file: Blob | string - } -} diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index e8eb227ab..705e8d0ff 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -3,7 +3,7 @@ export * from './caption' export * from './change-ownership' export * from './channel' export * from './comment' -export * from './editor' +export * from './studio' export * from './live' export * from './file' export * from './import' diff --git a/shared/models/videos/studio/index.ts b/shared/models/videos/studio/index.ts new file mode 100644 index 000000000..a1eb98a49 --- /dev/null +++ b/shared/models/videos/studio/index.ts @@ -0,0 +1 @@ +export * from './video-studio-create-edit.model' diff --git a/shared/models/videos/studio/video-studio-create-edit.model.ts b/shared/models/videos/studio/video-studio-create-edit.model.ts new file mode 100644 index 000000000..001d65c90 --- /dev/null +++ b/shared/models/videos/studio/video-studio-create-edit.model.ts @@ -0,0 +1,42 @@ +export interface VideoStudioCreateEdition { + tasks: VideoStudioTask[] +} + +export type VideoStudioTask = + VideoStudioTaskCut | + VideoStudioTaskIntro | + VideoStudioTaskOutro | + VideoStudioTaskWatermark + +export interface VideoStudioTaskCut { + name: 'cut' + + options: { + start?: number + end?: number + } +} + +export interface VideoStudioTaskIntro { + name: 'add-intro' + + options: { + file: Blob | string + } +} + +export interface VideoStudioTaskOutro { + name: 'add-outro' + + options: { + file: Blob | string + } +} + +export interface VideoStudioTaskWatermark { + name: 'add-watermark' + + options: { + file: Blob | string + } +} diff --git a/shared/server-commands/server/config-command.ts b/shared/server-commands/server/config-command.ts index 35a1eec7c..ed4961bc3 100644 --- a/shared/server-commands/server/config-command.ts +++ b/shared/server-commands/server/config-command.ts @@ -60,7 +60,7 @@ export class ConfigCommand extends AbstractCommand { transcoding: { enabled: false }, - videoEditor: { + videoStudio: { enabled: false } } @@ -111,10 +111,10 @@ export class ConfigCommand extends AbstractCommand { }) } - enableEditor () { + enableStudio () { return this.updateExistingSubConfig({ newConfig: { - videoEditor: { + videoStudio: { enabled: true } } @@ -339,7 +339,7 @@ export class ConfigCommand extends AbstractCommand { } } }, - videoEditor: { + videoStudio: { enabled: false }, import: { diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts index af4423e8d..2bf31b5a4 100644 --- a/shared/server-commands/server/server.ts +++ b/shared/server-commands/server/server.ts @@ -25,7 +25,7 @@ import { PlaylistsCommand, ServicesCommand, StreamingPlaylistsCommand, - VideoEditorCommand, + VideoStudioCommand, VideosCommand } from '../videos' import { CommentsCommand } from '../videos/comments-command' @@ -125,7 +125,7 @@ export class PeerTubeServer { login?: LoginCommand users?: UsersCommand objectStorage?: ObjectStorageCommand - videoEditor?: VideoEditorCommand + videoStudio?: VideoStudioCommand videos?: VideosCommand constructor (options: { serverNumber: number } | { url: string }) { @@ -396,6 +396,6 @@ export class PeerTubeServer { this.users = new UsersCommand(this) this.videos = new VideosCommand(this) this.objectStorage = new ObjectStorageCommand(this) - this.videoEditor = new VideoEditorCommand(this) + this.videoStudio = new VideoStudioCommand(this) } } diff --git a/shared/server-commands/videos/index.ts b/shared/server-commands/videos/index.ts index 154aed9a6..c9ef6134d 100644 --- a/shared/server-commands/videos/index.ts +++ b/shared/server-commands/videos/index.ts @@ -12,5 +12,5 @@ export * from './playlists-command' export * from './services-command' export * from './streaming-playlists-command' export * from './comments-command' -export * from './video-editor-command' +export * from './video-studio-command' export * from './videos-command' diff --git a/shared/server-commands/videos/video-editor-command.ts b/shared/server-commands/videos/video-studio-command.ts similarity index 82% rename from shared/server-commands/videos/video-editor-command.ts rename to shared/server-commands/videos/video-studio-command.ts index 485edce8e..9fe467cc2 100644 --- a/shared/server-commands/videos/video-editor-command.ts +++ b/shared/server-commands/videos/video-studio-command.ts @@ -1,9 +1,9 @@ -import { HttpStatusCode, VideoEditorTask } from '@shared/models' +import { HttpStatusCode, VideoStudioTask } from '@shared/models' import { AbstractCommand, OverrideCommandOptions } from '../shared' -export class VideoEditorCommand extends AbstractCommand { +export class VideoStudioCommand extends AbstractCommand { - static getComplexTask (): VideoEditorTask[] { + static getComplexTask (): VideoStudioTask[] { return [ // Total duration: 2 { @@ -41,9 +41,9 @@ export class VideoEditorCommand extends AbstractCommand { createEditionTasks (options: OverrideCommandOptions & { videoId: number | string - tasks: VideoEditorTask[] + tasks: VideoStudioTask[] }) { - const path = '/api/v1/videos/' + options.videoId + '/editor/edit' + const path = '/api/v1/videos/' + options.videoId + '/studio/edit' const attaches: { [id: string]: any } = {} for (let i = 0; i < options.tasks.length; i++) { diff --git a/support/nginx/peertube b/support/nginx/peertube index 425a78900..abb83d5c4 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube @@ -85,7 +85,7 @@ server { try_files /dev/null @api; } - location ~ ^/api/v1/videos/(upload|([^/]+/editor/edit))$ { + location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ { limit_except POST HEAD { deny all; } # This is the maximum upload size, which roughly matches the maximum size of a video file. -- 2.41.0