Skip to content

Commit c00de4d

Browse files
Fix share button and load thumbnail
1 parent 60805de commit c00de4d

File tree

5 files changed

+49
-13
lines changed

5 files changed

+49
-13
lines changed

src/renderer/components/ft-share-button/ft-share-button.js

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export default defineComponent({
3838
dropdownPositionY: {
3939
type: String,
4040
default: 'bottom'
41+
},
42+
invidiousInstance: {
43+
type: String,
44+
default: null
4145
}
4246
},
4347
data: function () {
@@ -54,6 +58,10 @@ export default defineComponent({
5458
return this.shareTargetType === 'Playlist'
5559
},
5660

61+
isIVPlaylist: function () {
62+
return this.shareTargetType === 'IVPlaylist'
63+
},
64+
5765
isVideo: function() {
5866
return this.shareTargetType === 'Video'
5967
},
@@ -69,6 +77,9 @@ export default defineComponent({
6977
if (this.isPlaylist) {
7078
return `${this.currentInvidiousInstance}/playlist?list=${this.id}`
7179
}
80+
if (this.isIVPlaylist) {
81+
return `${this.invidiousInstance}/playlist?list=${this.id}`
82+
}
7283
let videoUrl = `${this.currentInvidiousInstance}/watch?v=${this.id}`
7384
// `playlistId` can be undefined
7485
if (this.playlistId && this.playlistId.length !== 0) {
@@ -82,6 +93,9 @@ export default defineComponent({
8293
if (this.isPlaylist) {
8394
return `${this.currentInvidiousInstance}/embed/videoseries?list=${this.id}`
8495
}
96+
if (this.isIVPlaylist) {
97+
return `${this.invidiousInstance}/embed/videoseries?list=${this.id}`
98+
}
8599
return `${this.currentInvidiousInstance}/embed/${this.id}`
86100
},
87101

src/renderer/components/ft-share-button/ft-share-button.vue

+12-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
/>
2020
</ft-flex-box>
2121
<div class="shareLinks">
22-
<div class="header">
22+
<div
23+
v-if="!isIVPlaylist"
24+
class="header"
25+
>
2326
<img
2427
id="youtubeShareImage"
2528
class="youtubeLogo"
@@ -30,7 +33,10 @@
3033
>
3134
</div>
3235

33-
<div class="buttons">
36+
<div
37+
v-if="!isIVPlaylist"
38+
class="buttons"
39+
>
3440
<ft-button
3541
class="action"
3642
aria-describedby="youtubeShareImage"
@@ -69,7 +75,10 @@
6975
</ft-button>
7076
</div>
7177

72-
<div class="divider" />
78+
<div
79+
v-if="!isIVPlaylist"
80+
class="divider"
81+
/>
7382

7483
<div
7584
id="invidiousShare"

src/renderer/components/playlist-info/playlist-info.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ export default defineComponent({
2323
channelName: '',
2424
channelId: null,
2525
videoCount: 0,
26-
viewCount: 0,
26+
viewCount: null,
2727
lastUpdated: '',
2828
description: '',
29-
infoSource: ''
29+
infoSource: '',
30+
// if the playlist only exists on invidious
31+
isInvidiousPlaylist: false,
32+
origin: ''
3033
}
3134
},
3235
computed: {
@@ -62,10 +65,10 @@ export default defineComponent({
6265
if (this.thumbnailPreference === 'hidden') {
6366
return require('../../assets/img/thumbnail_placeholder.svg')
6467
}
65-
let baseUrl
68+
let baseUrl = 'https://i.ytimg.com'
6669
if (this.backendPreference === 'invidious') {
6770
baseUrl = this.currentInvidiousInstance
68-
} else {
71+
} else if (this.data.playlistThumbnail) {
6972
return this.data.playlistThumbnail
7073
}
7174

@@ -91,9 +94,11 @@ export default defineComponent({
9194
this.uploadedTime = this.data.uploaded_at
9295
this.description = this.data.description
9396
this.infoSource = this.data.infoSource
97+
this.origin = this.data.origin
98+
this.isInvidiousPlaylist = this.data.isInvidiousPlaylist
9499

95100
// Causes errors if not put inside of a check
96-
if (typeof (this.data.viewCount) !== 'undefined' && !isNaN(this.data.viewCount)) {
101+
if (this.data.viewCount !== null && typeof (this.data.viewCount) !== 'undefined' && !isNaN(this.data.viewCount)) {
97102
this.viewCount = this.hideViews ? null : formatNumber(this.data.viewCount)
98103
}
99104

@@ -106,7 +111,12 @@ export default defineComponent({
106111
methods: {
107112
sharePlaylist: function (method) {
108113
const youtubeUrl = `https://youtube.com/playlist?list=${this.id}`
109-
const invidiousUrl = `${this.currentInvidiousInstance}/playlist?list=${this.id}`
114+
let invidiousUrl
115+
if (this.isInvidiousPlaylist) {
116+
invidiousUrl = `${this.origin}/playlist?list=${this.id}`
117+
} else {
118+
invidiousUrl = `${this.currentInvidiousInstance}/playlist?list=${this.id}`
119+
}
110120

111121
switch (method) {
112122
case 'copyYoutube':

src/renderer/components/playlist-info/playlist-info.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{{ title }}
2424
</h2>
2525
<p>
26-
{{ videoCount }} {{ $t("Playlist.Videos") }} - <span v-if="!hideViews">{{ viewCount }} {{ $t("Playlist.Views") }} -</span>
26+
{{ videoCount }} {{ $t("Playlist.Videos") }} - <span v-if="!hideViews && viewCount != null">{{ viewCount }} {{ $t("Playlist.Views") }} -</span>
2727
<span v-if="infoSource !== 'local'">
2828
{{ $t("Playlist.Last Updated On") }}
2929
</span>
@@ -72,7 +72,8 @@
7272
v-if="!hideSharingActions"
7373
:id="id"
7474
:dropdown-position-y="description ? 'top' : 'bottom'"
75-
share-target-type="Playlist"
75+
:share-target-type="isInvidiousPlaylist ? 'IVPlaylist' : 'Playlist'"
76+
:invidious-instance="origin"
7677
/>
7778
</div>
7879
</div>

src/renderer/views/Playlist/Playlist.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,14 @@ export default defineComponent({
154154
title: result.title,
155155
description: result.description,
156156
firstVideoId: result.videos[0].videoId,
157-
viewCount: result.viewCount,
157+
viewCount: (!this.query.playlistType === 'invidious') ? result.viewCount : null,
158158
videoCount: result.videoCount,
159159
channelName: result.author,
160160
channelThumbnail: youtubeImageUrlToInvidious(result.authorThumbnails.at(2)?.url, this.currentInvidiousInstance),
161161
channelId: result.authorId,
162-
infoSource: 'invidious'
162+
infoSource: 'invidious',
163+
isInvidiousPlaylist: this.query.playlistType === 'invidious',
164+
origin: origin
163165
}
164166

165167
if (!this.query.playlistType === 'invidious') {

0 commit comments

Comments
 (0)