]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video/video.model.ts
Don't manage remote video files
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / video.model.ts
index 472a8c8108b360b1ffdfa91b04229ce3b9630b52..fe56436889fedd1f91907bcf14107e5e95cb1ffd 100644 (file)
@@ -14,7 +14,8 @@ import {
   VideoPrivacy,
   VideoScheduleUpdate,
   VideoState,
-  VideoStreamingPlaylist
+  VideoStreamingPlaylist,
+  VideoStreamingPlaylistType
 } from '@shared/models'
 
 export class Video implements VideoServerModel {
@@ -219,6 +220,28 @@ export class Video implements VideoServerModel {
     return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
   }
 
+  canRemoveFiles (user: AuthUser) {
+    return this.isLocal &&
+      user.hasRight(UserRight.MANAGE_VIDEO_FILES) &&
+      this.state.id !== VideoState.TO_TRANSCODE &&
+      this.hasHLS() &&
+      this.hasWebTorrent()
+  }
+
+  canRunTranscoding (user: AuthUser) {
+    return this.isLocal &&
+      user.hasRight(UserRight.RUN_VIDEO_TRANSCODING) &&
+      this.state.id !== VideoState.TO_TRANSCODE
+  }
+
+  hasHLS () {
+    return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS)
+  }
+
+  hasWebTorrent () {
+    return this.files && this.files.length !== 0
+  }
+
   isLiveInfoAvailableBy (user: AuthUser) {
     return this.isLive &&
       user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE))