2020-03-06 15:58:55 +00:00
|
|
|
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
|
2022-02-11 09:51:33 +00:00
|
|
|
import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
|
2020-08-12 08:40:04 +00:00
|
|
|
import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation'
|
2019-04-05 08:52:27 +00:00
|
|
|
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
|
2022-03-18 15:31:12 +00:00
|
|
|
import { VideoCaption } from '@shared/models'
|
2020-08-12 08:40:04 +00:00
|
|
|
import {
|
|
|
|
Actor,
|
|
|
|
DropdownAction,
|
|
|
|
DropdownButtonSize,
|
|
|
|
DropdownDirection,
|
|
|
|
RedundancyService,
|
|
|
|
Video,
|
|
|
|
VideoDetails,
|
|
|
|
VideoService
|
|
|
|
} from '../shared-main'
|
2020-11-05 09:56:23 +00:00
|
|
|
import { LiveStreamInformationComponent } from '../shared-video-live'
|
2020-06-23 12:10:17 +00:00
|
|
|
import { VideoAddToPlaylistComponent } from '../shared-video-playlist'
|
|
|
|
import { VideoDownloadComponent } from './video-download.component'
|
2019-04-05 08:52:27 +00:00
|
|
|
|
|
|
|
export type VideoActionsDisplayType = {
|
|
|
|
playlist?: boolean
|
|
|
|
download?: boolean
|
|
|
|
update?: boolean
|
|
|
|
blacklist?: boolean
|
|
|
|
delete?: boolean
|
|
|
|
report?: boolean
|
2020-01-10 09:11:28 +00:00
|
|
|
duplicate?: boolean
|
2020-06-28 14:38:51 +00:00
|
|
|
mute?: boolean
|
2020-11-05 09:56:23 +00:00
|
|
|
liveInfo?: boolean
|
2021-11-17 15:04:53 +00:00
|
|
|
removeFiles?: boolean
|
2021-11-18 13:35:08 +00:00
|
|
|
transcoding?: boolean
|
2022-03-22 15:58:49 +00:00
|
|
|
studio?: boolean
|
2022-04-05 12:03:52 +00:00
|
|
|
stats?: boolean
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'my-video-actions-dropdown',
|
|
|
|
templateUrl: './video-actions-dropdown.component.html',
|
|
|
|
styleUrls: [ './video-actions-dropdown.component.scss' ]
|
|
|
|
})
|
2019-05-13 13:18:11 +00:00
|
|
|
export class VideoActionsDropdownComponent implements OnChanges {
|
2020-02-07 09:00:34 +00:00
|
|
|
@ViewChild('playlistDropdown') playlistDropdown: NgbDropdown
|
|
|
|
@ViewChild('playlistAdd') playlistAdd: VideoAddToPlaylistComponent
|
2019-04-05 08:52:27 +00:00
|
|
|
|
2020-02-07 09:00:34 +00:00
|
|
|
@ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
|
|
|
|
@ViewChild('videoReportModal') videoReportModal: VideoReportComponent
|
2020-06-02 18:50:42 +00:00
|
|
|
@ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent
|
2020-11-05 09:56:23 +00:00
|
|
|
@ViewChild('liveStreamInformationModal') liveStreamInformationModal: LiveStreamInformationComponent
|
2019-04-05 08:52:27 +00:00
|
|
|
|
|
|
|
@Input() video: Video | VideoDetails
|
2020-01-07 15:53:57 +00:00
|
|
|
@Input() videoCaptions: VideoCaption[] = []
|
2019-04-05 08:52:27 +00:00
|
|
|
|
|
|
|
@Input() displayOptions: VideoActionsDisplayType = {
|
|
|
|
playlist: false,
|
|
|
|
download: true,
|
|
|
|
update: true,
|
|
|
|
blacklist: true,
|
|
|
|
delete: true,
|
2020-01-10 09:11:28 +00:00
|
|
|
report: true,
|
2020-06-28 14:38:51 +00:00
|
|
|
duplicate: true,
|
2020-11-05 09:56:23 +00:00
|
|
|
mute: true,
|
2021-11-18 13:35:08 +00:00
|
|
|
liveInfo: false,
|
|
|
|
removeFiles: false,
|
2022-02-11 09:51:33 +00:00
|
|
|
transcoding: false,
|
2022-04-05 12:03:52 +00:00
|
|
|
studio: true,
|
|
|
|
stats: true
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
2019-04-05 12:16:48 +00:00
|
|
|
@Input() placement = 'left'
|
2022-04-05 12:03:52 +00:00
|
|
|
@Input() moreActions: DropdownAction<{ video: Video }>[][] = []
|
2019-04-05 08:52:27 +00:00
|
|
|
|
|
|
|
@Input() label: string
|
|
|
|
|
|
|
|
@Input() buttonStyled = false
|
|
|
|
@Input() buttonSize: DropdownButtonSize = 'normal'
|
|
|
|
@Input() buttonDirection: DropdownDirection = 'vertical'
|
|
|
|
|
2021-11-17 15:04:53 +00:00
|
|
|
@Output() videoFilesRemoved = new EventEmitter()
|
2019-04-05 08:52:27 +00:00
|
|
|
@Output() videoRemoved = new EventEmitter()
|
2020-06-02 18:50:42 +00:00
|
|
|
@Output() videoUnblocked = new EventEmitter()
|
|
|
|
@Output() videoBlocked = new EventEmitter()
|
2020-06-28 14:38:51 +00:00
|
|
|
@Output() videoAccountMuted = new EventEmitter()
|
2021-11-18 13:35:08 +00:00
|
|
|
@Output() transcodingCreated = new EventEmitter()
|
2019-12-05 08:21:09 +00:00
|
|
|
@Output() modalOpened = new EventEmitter()
|
2019-04-05 08:52:27 +00:00
|
|
|
|
|
|
|
videoActions: DropdownAction<{ video: Video }>[][] = []
|
|
|
|
|
|
|
|
private loaded = false
|
|
|
|
|
|
|
|
constructor (
|
|
|
|
private authService: AuthService,
|
|
|
|
private notifier: Notifier,
|
|
|
|
private confirmService: ConfirmService,
|
2020-06-28 14:38:51 +00:00
|
|
|
private blocklistService: BlocklistService,
|
2020-06-02 18:50:42 +00:00
|
|
|
private videoBlocklistService: VideoBlockService,
|
2019-04-05 08:52:27 +00:00
|
|
|
private screenService: ScreenService,
|
|
|
|
private videoService: VideoService,
|
2022-02-11 09:51:33 +00:00
|
|
|
private redundancyService: RedundancyService,
|
|
|
|
private serverService: ServerService
|
2019-04-05 08:52:27 +00:00
|
|
|
) { }
|
|
|
|
|
|
|
|
get user () {
|
|
|
|
return this.authService.getUser()
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnChanges () {
|
2019-05-17 12:34:21 +00:00
|
|
|
if (this.loaded) {
|
|
|
|
this.loaded = false
|
2020-11-06 08:09:36 +00:00
|
|
|
if (this.playlistAdd) this.playlistAdd.reload()
|
2019-05-17 12:34:21 +00:00
|
|
|
}
|
|
|
|
|
2019-04-05 08:52:27 +00:00
|
|
|
this.buildActions()
|
|
|
|
}
|
|
|
|
|
|
|
|
isUserLoggedIn () {
|
|
|
|
return this.authService.isLoggedIn()
|
|
|
|
}
|
|
|
|
|
|
|
|
loadDropdownInformation () {
|
|
|
|
if (!this.isUserLoggedIn() || this.loaded === true) return
|
|
|
|
|
|
|
|
this.loaded = true
|
|
|
|
|
|
|
|
if (this.displayOptions.playlist) this.playlistAdd.load()
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Show modals */
|
|
|
|
|
|
|
|
showDownloadModal () {
|
2019-12-05 08:21:09 +00:00
|
|
|
this.modalOpened.emit()
|
|
|
|
|
2020-01-07 15:53:57 +00:00
|
|
|
this.videoDownloadModal.show(this.video as VideoDetails, this.videoCaptions)
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
showReportModal () {
|
2019-12-05 08:21:09 +00:00
|
|
|
this.modalOpened.emit()
|
|
|
|
|
2019-04-05 08:52:27 +00:00
|
|
|
this.videoReportModal.show()
|
|
|
|
}
|
|
|
|
|
2020-06-02 18:50:42 +00:00
|
|
|
showBlockModal () {
|
2019-12-05 08:21:09 +00:00
|
|
|
this.modalOpened.emit()
|
|
|
|
|
2021-11-17 10:18:49 +00:00
|
|
|
this.videoBlockModal.show([ this.video ])
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 09:56:23 +00:00
|
|
|
showLiveInfoModal (video: Video) {
|
|
|
|
this.modalOpened.emit()
|
|
|
|
|
|
|
|
this.liveStreamInformationModal.show(video)
|
|
|
|
}
|
|
|
|
|
2019-04-05 08:52:27 +00:00
|
|
|
/* Actions checker */
|
|
|
|
|
|
|
|
isVideoUpdatable () {
|
|
|
|
return this.video.isUpdatableBy(this.user)
|
|
|
|
}
|
|
|
|
|
2022-02-11 09:51:33 +00:00
|
|
|
isVideoEditable () {
|
2022-03-22 15:58:49 +00:00
|
|
|
return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoStudio.enabled)
|
2022-02-11 09:51:33 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 12:03:52 +00:00
|
|
|
isVideoStatsAvailable () {
|
|
|
|
return this.video.canSeeStats(this.user)
|
|
|
|
}
|
|
|
|
|
2019-04-05 08:52:27 +00:00
|
|
|
isVideoRemovable () {
|
|
|
|
return this.video.isRemovableBy(this.user)
|
|
|
|
}
|
|
|
|
|
2020-06-02 18:50:42 +00:00
|
|
|
isVideoBlockable () {
|
|
|
|
return this.video.isBlockableBy(this.user)
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
2020-06-02 18:50:42 +00:00
|
|
|
isVideoUnblockable () {
|
|
|
|
return this.video.isUnblockableBy(this.user)
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 09:56:23 +00:00
|
|
|
isVideoLiveInfoAvailable () {
|
|
|
|
return this.video.isLiveInfoAvailableBy(this.user)
|
|
|
|
}
|
|
|
|
|
2019-05-13 09:18:24 +00:00
|
|
|
isVideoDownloadable () {
|
2020-09-25 08:04:21 +00:00
|
|
|
return this.video &&
|
|
|
|
this.video.isLive !== true &&
|
|
|
|
this.video instanceof VideoDetails &&
|
|
|
|
this.video.downloadEnabled
|
2019-05-13 09:18:24 +00:00
|
|
|
}
|
|
|
|
|
2020-01-10 09:11:28 +00:00
|
|
|
canVideoBeDuplicated () {
|
2020-12-07 14:08:12 +00:00
|
|
|
return !this.video.isLive && this.video.canBeDuplicatedBy(this.user)
|
2020-01-10 09:11:28 +00:00
|
|
|
}
|
|
|
|
|
2020-06-28 14:38:51 +00:00
|
|
|
isVideoAccountMutable () {
|
|
|
|
return this.video.account.id !== this.user.account.id
|
|
|
|
}
|
|
|
|
|
2021-11-17 15:04:53 +00:00
|
|
|
canRemoveVideoFiles () {
|
2021-11-18 13:35:08 +00:00
|
|
|
return this.video.canRemoveFiles(this.user)
|
|
|
|
}
|
|
|
|
|
|
|
|
canRunTranscoding () {
|
|
|
|
return this.video.canRunTranscoding(this.user)
|
2021-11-17 15:04:53 +00:00
|
|
|
}
|
|
|
|
|
2019-04-05 08:52:27 +00:00
|
|
|
/* Action handlers */
|
|
|
|
|
2020-06-02 18:50:42 +00:00
|
|
|
async unblockVideo () {
|
2021-11-15 08:12:15 +00:00
|
|
|
const confirmMessage = $localize`Do you really want to unblock ${this.video.name}? It will be available again in the videos list.`
|
2019-04-05 08:52:27 +00:00
|
|
|
|
2021-11-15 08:12:15 +00:00
|
|
|
const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock ${this.video.name}`)
|
2019-04-05 08:52:27 +00:00
|
|
|
if (res === false) return
|
|
|
|
|
2020-06-28 14:38:51 +00:00
|
|
|
this.videoBlocklistService.unblockVideo(this.video.id)
|
2021-08-17 09:27:47 +00:00
|
|
|
.subscribe({
|
|
|
|
next: () => {
|
2020-08-12 08:40:04 +00:00
|
|
|
this.notifier.success($localize`Video ${this.video.name} unblocked.`)
|
2019-04-05 08:52:27 +00:00
|
|
|
|
2020-06-28 14:38:51 +00:00
|
|
|
this.video.blacklisted = false
|
2021-10-27 12:37:04 +00:00
|
|
|
this.video.blacklistedReason = null
|
2019-04-05 08:52:27 +00:00
|
|
|
|
2020-06-28 14:38:51 +00:00
|
|
|
this.videoUnblocked.emit()
|
|
|
|
},
|
2019-04-05 08:52:27 +00:00
|
|
|
|
2021-08-17 09:27:47 +00:00
|
|
|
error: err => this.notifier.error(err.message)
|
|
|
|
})
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async removeVideo () {
|
2019-12-05 08:21:09 +00:00
|
|
|
this.modalOpened.emit()
|
|
|
|
|
2021-11-15 08:12:15 +00:00
|
|
|
let message = $localize`Do you really want to delete ${this.video.name}?`
|
2020-10-28 09:49:20 +00:00
|
|
|
if (this.video.isLive) {
|
2022-07-22 13:22:21 +00:00
|
|
|
message += ' ' + $localize`The live stream will be automatically terminated and replays won't be saved.`
|
2020-10-28 09:49:20 +00:00
|
|
|
}
|
|
|
|
|
2021-11-15 08:12:15 +00:00
|
|
|
const res = await this.confirmService.confirm(message, $localize`Delete ${this.video.name}`)
|
2019-04-05 08:52:27 +00:00
|
|
|
if (res === false) return
|
|
|
|
|
|
|
|
this.videoService.removeVideo(this.video.id)
|
2021-08-17 09:27:47 +00:00
|
|
|
.subscribe({
|
|
|
|
next: () => {
|
2020-08-12 08:40:04 +00:00
|
|
|
this.notifier.success($localize`Video ${this.video.name} deleted.`)
|
2019-04-05 08:52:27 +00:00
|
|
|
this.videoRemoved.emit()
|
|
|
|
},
|
|
|
|
|
2021-08-17 09:27:47 +00:00
|
|
|
error: err => this.notifier.error(err.message)
|
|
|
|
})
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
2020-01-10 09:11:28 +00:00
|
|
|
duplicateVideo () {
|
|
|
|
this.redundancyService.addVideoRedundancy(this.video)
|
2021-08-17 09:27:47 +00:00
|
|
|
.subscribe({
|
|
|
|
next: () => {
|
2021-11-15 08:12:15 +00:00
|
|
|
const message = $localize`${this.video.name} will be duplicated by your instance.`
|
2020-06-28 14:38:51 +00:00
|
|
|
this.notifier.success(message)
|
|
|
|
},
|
2020-01-10 09:11:28 +00:00
|
|
|
|
2021-08-17 09:27:47 +00:00
|
|
|
error: err => this.notifier.error(err.message)
|
|
|
|
})
|
2020-06-28 14:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
muteVideoAccount () {
|
|
|
|
const params = { nameWithHost: Actor.CREATE_BY_STRING(this.video.account.name, this.video.account.host) }
|
|
|
|
|
|
|
|
this.blocklistService.blockAccountByUser(params)
|
2021-08-17 09:27:47 +00:00
|
|
|
.subscribe({
|
|
|
|
next: () => {
|
2020-08-12 08:40:04 +00:00
|
|
|
this.notifier.success($localize`Account ${params.nameWithHost} muted.`)
|
2020-06-28 14:38:51 +00:00
|
|
|
this.videoAccountMuted.emit()
|
|
|
|
},
|
|
|
|
|
2021-08-17 09:27:47 +00:00
|
|
|
error: err => this.notifier.error(err.message)
|
|
|
|
})
|
2020-01-10 09:11:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-17 15:04:53 +00:00
|
|
|
async removeVideoFiles (video: Video, type: 'hls' | 'webtorrent') {
|
|
|
|
const confirmMessage = $localize`Do you really want to remove "${this.video.name}" files?`
|
|
|
|
|
|
|
|
const res = await this.confirmService.confirm(confirmMessage, $localize`Remove "${this.video.name}" files`)
|
|
|
|
if (res === false) return
|
|
|
|
|
|
|
|
this.videoService.removeVideoFiles([ video.id ], type)
|
|
|
|
.subscribe({
|
|
|
|
next: () => {
|
|
|
|
this.notifier.success($localize`Removed files of ${video.name}.`)
|
|
|
|
this.videoFilesRemoved.emit()
|
|
|
|
},
|
|
|
|
|
|
|
|
error: err => this.notifier.error(err.message)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-11-18 13:35:08 +00:00
|
|
|
runTranscoding (video: Video, type: 'hls' | 'webtorrent') {
|
|
|
|
this.videoService.runTranscoding([ video.id ], type)
|
|
|
|
.subscribe({
|
|
|
|
next: () => {
|
|
|
|
this.notifier.success($localize`Transcoding jobs created for ${video.name}.`)
|
|
|
|
this.transcodingCreated.emit()
|
|
|
|
},
|
|
|
|
|
|
|
|
error: err => this.notifier.error(err.message)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-06-02 18:50:42 +00:00
|
|
|
onVideoBlocked () {
|
|
|
|
this.videoBlocked.emit()
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getPlaylistDropdownPlacement () {
|
|
|
|
if (this.screenService.isInSmallView()) {
|
|
|
|
return 'bottom-right'
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'bottom-left bottom-right'
|
|
|
|
}
|
|
|
|
|
|
|
|
private buildActions () {
|
2019-06-07 09:08:56 +00:00
|
|
|
this.videoActions = [
|
|
|
|
[
|
2019-04-05 08:52:27 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Save to playlist`,
|
2019-04-05 08:52:27 +00:00
|
|
|
handler: () => this.playlistDropdown.toggle(),
|
2019-06-07 09:08:56 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist,
|
2019-04-05 08:52:27 +00:00
|
|
|
iconName: 'playlist-add'
|
|
|
|
}
|
2019-06-07 09:08:56 +00:00
|
|
|
],
|
2020-06-28 14:38:51 +00:00
|
|
|
[ // actions regarding the video
|
2019-04-05 08:52:27 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Download`,
|
2019-04-05 08:52:27 +00:00
|
|
|
handler: () => this.showDownloadModal(),
|
2019-05-13 09:18:24 +00:00
|
|
|
isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(),
|
2019-04-05 08:52:27 +00:00
|
|
|
iconName: 'download'
|
|
|
|
},
|
2020-11-05 09:56:23 +00:00
|
|
|
{
|
|
|
|
label: $localize`Display live information`,
|
|
|
|
handler: ({ video }) => this.showLiveInfoModal(video),
|
2020-11-06 08:09:36 +00:00
|
|
|
isDisplayed: () => this.displayOptions.liveInfo && this.isVideoLiveInfoAvailable(),
|
2020-11-05 09:56:23 +00:00
|
|
|
iconName: 'live'
|
|
|
|
},
|
2019-04-05 08:52:27 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Update`,
|
2019-04-05 08:52:27 +00:00
|
|
|
linkBuilder: ({ video }) => [ '/videos/update', video.uuid ],
|
|
|
|
iconName: 'edit',
|
2019-06-07 09:08:56 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable()
|
2019-04-05 08:52:27 +00:00
|
|
|
},
|
2022-02-11 09:51:33 +00:00
|
|
|
{
|
2022-03-22 15:58:49 +00:00
|
|
|
label: $localize`Studio`,
|
|
|
|
linkBuilder: ({ video }) => [ '/studio/edit', video.uuid ],
|
2022-02-11 09:51:33 +00:00
|
|
|
iconName: 'film',
|
2022-03-22 15:58:49 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.studio && this.isVideoEditable()
|
2022-02-11 09:51:33 +00:00
|
|
|
},
|
2022-04-05 12:03:52 +00:00
|
|
|
{
|
|
|
|
label: $localize`Stats`,
|
|
|
|
linkBuilder: ({ video }) => [ '/stats/videos', video.uuid ],
|
|
|
|
iconName: 'stats',
|
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.stats && this.isVideoStatsAvailable()
|
|
|
|
},
|
2019-04-05 08:52:27 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Block`,
|
2020-06-02 18:50:42 +00:00
|
|
|
handler: () => this.showBlockModal(),
|
2019-04-05 08:52:27 +00:00
|
|
|
iconName: 'no',
|
2020-06-02 18:50:42 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable()
|
2019-04-05 08:52:27 +00:00
|
|
|
},
|
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Unblock`,
|
2020-06-02 18:50:42 +00:00
|
|
|
handler: () => this.unblockVideo(),
|
2019-04-05 08:52:27 +00:00
|
|
|
iconName: 'undo',
|
2020-06-02 18:50:42 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblockable()
|
2019-04-05 08:52:27 +00:00
|
|
|
},
|
2020-01-10 09:11:28 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Mirror`,
|
2020-01-10 09:11:28 +00:00
|
|
|
handler: () => this.duplicateVideo(),
|
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.duplicate && this.canVideoBeDuplicated(),
|
|
|
|
iconName: 'cloud-download'
|
|
|
|
},
|
2019-04-05 08:52:27 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Delete`,
|
2019-04-05 08:52:27 +00:00
|
|
|
handler: () => this.removeVideo(),
|
2019-06-07 09:08:56 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(),
|
2019-04-05 08:52:27 +00:00
|
|
|
iconName: 'delete'
|
2020-06-28 14:38:51 +00:00
|
|
|
},
|
2019-04-05 08:52:27 +00:00
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Report`,
|
2019-04-05 08:52:27 +00:00
|
|
|
handler: () => this.showReportModal(),
|
2019-06-07 09:08:56 +00:00
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report,
|
2020-06-30 09:21:04 +00:00
|
|
|
iconName: 'flag'
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
2020-06-28 14:38:51 +00:00
|
|
|
],
|
2021-11-17 15:04:53 +00:00
|
|
|
[
|
2021-11-18 13:35:08 +00:00
|
|
|
{
|
|
|
|
label: $localize`Run HLS transcoding`,
|
|
|
|
handler: ({ video }) => this.runTranscoding(video, 'hls'),
|
|
|
|
isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
|
|
|
|
iconName: 'cog'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: $localize`Run WebTorrent transcoding`,
|
|
|
|
handler: ({ video }) => this.runTranscoding(video, 'webtorrent'),
|
|
|
|
isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
|
|
|
|
iconName: 'cog'
|
|
|
|
},
|
2021-11-17 15:04:53 +00:00
|
|
|
{
|
|
|
|
label: $localize`Delete HLS files`,
|
|
|
|
handler: ({ video }) => this.removeVideoFiles(video, 'hls'),
|
|
|
|
isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(),
|
|
|
|
iconName: 'delete'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: $localize`Delete WebTorrent files`,
|
|
|
|
handler: ({ video }) => this.removeVideoFiles(video, 'webtorrent'),
|
|
|
|
isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(),
|
|
|
|
iconName: 'delete'
|
|
|
|
}
|
|
|
|
],
|
2020-06-28 14:38:51 +00:00
|
|
|
[ // actions regarding the account/its server
|
|
|
|
{
|
2020-08-12 08:40:04 +00:00
|
|
|
label: $localize`Mute account`,
|
2020-06-28 14:38:51 +00:00
|
|
|
handler: () => this.muteVideoAccount(),
|
|
|
|
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.mute && this.isVideoAccountMutable(),
|
|
|
|
iconName: 'no'
|
|
|
|
}
|
2019-06-07 09:08:56 +00:00
|
|
|
]
|
|
|
|
]
|
2022-04-05 12:03:52 +00:00
|
|
|
|
|
|
|
this.videoActions = this.videoActions.concat(this.moreActions)
|
2019-04-05 08:52:27 +00:00
|
|
|
}
|
|
|
|
}
|