]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-video-playlist/video-playlist.model.ts
Move to sass module
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-video-playlist / video-playlist.model.ts
index 3db3b7a2e4156f4df4a7afd585cceeaf0af58a55..d67f372f41e7b101bd1dfb6f656770e98c159cfa 100644 (file)
@@ -15,12 +15,12 @@ export class VideoPlaylist implements ServerVideoPlaylist {
   uuid: string
   isLocal: boolean
 
+  url: string
+
   displayName: string
   description: string
   privacy: VideoConstant<VideoPlaylistPrivacy>
 
-  thumbnailPath: string
-
   videosLength: number
 
   type: VideoConstant<VideoPlaylistType>
@@ -31,25 +31,22 @@ export class VideoPlaylist implements ServerVideoPlaylist {
   ownerAccount: AccountSummary
   videoChannel?: VideoChannelSummary
 
+  thumbnailPath: string
   thumbnailUrl: string
 
   embedPath: string
   embedUrl: string
 
   ownerBy: string
-  ownerAvatarUrl: string
 
   videoChannelBy?: string
-  videoChannelAvatarUrl?: string
-
-  private thumbnailVersion: number
-  private originThumbnailUrl: string
 
   constructor (hash: ServerVideoPlaylist, translations: {}) {
     const absoluteAPIUrl = getAbsoluteAPIUrl()
 
     this.id = hash.id
     this.uuid = hash.uuid
+    this.url = hash.url
     this.isLocal = hash.isLocal
 
     this.displayName = hash.displayName
@@ -59,15 +56,12 @@ export class VideoPlaylist implements ServerVideoPlaylist {
 
     this.thumbnailPath = hash.thumbnailPath
 
-    if (this.thumbnailPath) {
-      this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
-      this.originThumbnailUrl = this.thumbnailUrl
-    } else {
-      this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg'
-    }
+    this.thumbnailUrl = this.thumbnailPath
+      ? hash.thumbnailUrl || (absoluteAPIUrl + hash.thumbnailPath)
+      : absoluteAPIUrl + '/client/assets/images/default-playlist.jpg'
 
     this.embedPath = hash.embedPath
-    this.embedUrl = getAbsoluteEmbedUrl() + hash.embedPath
+    this.embedUrl = hash.embedUrl || (getAbsoluteEmbedUrl() + hash.embedPath)
 
     this.videosLength = hash.videosLength
 
@@ -78,12 +72,10 @@ export class VideoPlaylist implements ServerVideoPlaylist {
 
     this.ownerAccount = hash.ownerAccount
     this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
-    this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount)
 
     if (hash.videoChannel) {
       this.videoChannel = hash.videoChannel
       this.videoChannelBy = Actor.CREATE_BY_STRING(hash.videoChannel.name, hash.videoChannel.host)
-      this.videoChannelAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.videoChannel)
     }
 
     this.privacy.label = peertubeTranslate(this.privacy.label, translations)
@@ -92,13 +84,4 @@ export class VideoPlaylist implements ServerVideoPlaylist {
       this.displayName = peertubeTranslate(this.displayName, translations)
     }
   }
-
-  refreshThumbnail () {
-    if (!this.originThumbnailUrl) return
-
-    if (!this.thumbnailVersion) this.thumbnailVersion = 0
-    this.thumbnailVersion++
-
-    this.thumbnailUrl = this.originThumbnailUrl + '?v' + this.thumbnailVersion
-  }
 }