aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-01 16:54:24 +0200
committerChocobozzz <me@florianbigard.com>2019-08-01 16:54:24 +0200
commit65af03a241aa83ab7ba71278b6c99acd26428b8a (patch)
tree0cc04c31cdf631d11a915ae40389e8fa141f136b /client/src/app/shared
parenta21e25ff641854c8b01664cb18655aa420620af6 (diff)
downloadPeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.tar.gz
PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.tar.zst
PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.zip
Automatically update playlist thumbnails
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/video-playlist/video-playlist.model.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.model.ts b/client/src/app/shared/video-playlist/video-playlist.model.ts
index 7e311aa54..6f27e7475 100644
--- a/client/src/app/shared/video-playlist/video-playlist.model.ts
+++ b/client/src/app/shared/video-playlist/video-playlist.model.ts
@@ -38,6 +38,9 @@ export class VideoPlaylist implements ServerVideoPlaylist {
38 videoChannelBy?: string 38 videoChannelBy?: string
39 videoChannelAvatarUrl?: string 39 videoChannelAvatarUrl?: string
40 40
41 private thumbnailVersion: number
42 private originThumbnailUrl: string
43
41 constructor (hash: ServerVideoPlaylist, translations: {}) { 44 constructor (hash: ServerVideoPlaylist, translations: {}) {
42 const absoluteAPIUrl = getAbsoluteAPIUrl() 45 const absoluteAPIUrl = getAbsoluteAPIUrl()
43 46
@@ -54,6 +57,7 @@ export class VideoPlaylist implements ServerVideoPlaylist {
54 57
55 if (this.thumbnailPath) { 58 if (this.thumbnailPath) {
56 this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath 59 this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
60 this.originThumbnailUrl = this.thumbnailUrl
57 } else { 61 } else {
58 this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg' 62 this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg'
59 } 63 }
@@ -81,4 +85,13 @@ export class VideoPlaylist implements ServerVideoPlaylist {
81 this.displayName = peertubeTranslate(this.displayName, translations) 85 this.displayName = peertubeTranslate(this.displayName, translations)
82 } 86 }
83 } 87 }
88
89 refreshThumbnail () {
90 if (!this.originThumbnailUrl) return
91
92 if (!this.thumbnailVersion) this.thumbnailVersion = 0
93 this.thumbnailVersion++
94
95 this.thumbnailUrl = this.originThumbnailUrl + '?v' + this.thumbnailVersion
96 }
84} 97}