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