mirror of https://github.com/Chocobozzz/PeerTube
Do not run transcription/transcoding on lives
parent
45d22afca6
commit
b45ed3c05a
|
@ -244,10 +244,6 @@ export class Video implements VideoServerModel {
|
|||
this.isUpdatableBy(user)
|
||||
}
|
||||
|
||||
canGenerateTranscription (user: AuthUser, transcriptionEnabled: boolean) {
|
||||
return transcriptionEnabled && this.isLocal && user.hasRight(UserRight.UPDATE_ANY_VIDEO)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
isOwner (user: AuthUser) {
|
||||
|
@ -278,13 +274,15 @@ export class Video implements VideoServerModel {
|
|||
}
|
||||
|
||||
canRunTranscoding (user: AuthUser) {
|
||||
return this.canRunForcedTranscoding(user)
|
||||
return this.isLocal && !this.isLive && user?.hasRight(UserRight.RUN_VIDEO_TRANSCODING)
|
||||
}
|
||||
|
||||
canRunForcedTranscoding (user: AuthUser) {
|
||||
return this.isLocal && user?.hasRight(UserRight.RUN_VIDEO_TRANSCODING)
|
||||
canGenerateTranscription (user: AuthUser, transcriptionEnabled: boolean) {
|
||||
return transcriptionEnabled && this.isLocal && !this.isLive && user.hasRight(UserRight.UPDATE_ANY_VIDEO)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
hasHLS () {
|
||||
return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS)
|
||||
}
|
||||
|
|
|
@ -234,8 +234,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
return this.video.canRemoveFiles(this.user)
|
||||
}
|
||||
|
||||
canRunForcedTranscoding () {
|
||||
return this.video.canRunForcedTranscoding(this.user)
|
||||
canRunTranscoding () {
|
||||
return this.video.canRunTranscoding(this.user)
|
||||
}
|
||||
|
||||
/* Action handlers */
|
||||
|
@ -462,13 +462,13 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
{
|
||||
label: $localize`Run HLS transcoding`,
|
||||
handler: ({ video }) => this.runTranscoding(video, 'hls'),
|
||||
isDisplayed: () => this.displayOptions.transcoding && this.canRunForcedTranscoding(),
|
||||
isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
|
||||
iconName: 'cog'
|
||||
},
|
||||
{
|
||||
label: $localize`Run Web Video transcoding`,
|
||||
handler: ({ video }) => this.runTranscoding(video, 'web-video'),
|
||||
isDisplayed: () => this.displayOptions.transcoding && this.canRunForcedTranscoding(),
|
||||
isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
|
||||
iconName: 'cog'
|
||||
},
|
||||
{
|
||||
|
|
|
@ -74,6 +74,13 @@ export const generateVideoCaptionValidator = [
|
|||
})
|
||||
}
|
||||
|
||||
if (video.isLive) {
|
||||
return res.fail({
|
||||
status: HttpStatusCode.BAD_REQUEST_400,
|
||||
message: 'Cannot run transcription job on a live'
|
||||
})
|
||||
}
|
||||
|
||||
// Check if the user who did the request is able to update the video
|
||||
const user = res.locals.oauth.token.User
|
||||
if (!checkUserCanManageVideo(user, video, UserRight.UPDATE_ANY_VIDEO, res)) return
|
||||
|
|
|
@ -31,6 +31,13 @@ const createTranscodingValidator = [
|
|||
})
|
||||
}
|
||||
|
||||
if (video.isLive) {
|
||||
return res.fail({
|
||||
status: HttpStatusCode.BAD_REQUEST_400,
|
||||
message: 'Cannot run transcoding job on a live'
|
||||
})
|
||||
}
|
||||
|
||||
if (CONFIG.TRANSCODING.ENABLED !== true) {
|
||||
return res.fail({
|
||||
status: HttpStatusCode.BAD_REQUEST_400,
|
||||
|
|
Loading…
Reference in New Issue