[Fix] Invidious not used for channels icons in search (#1477)

* fix channel icons

* Add comment

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

Co-authored-by: Preston <freetubeapp@protonmail.com>
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
ChunkyProgrammer 2021-10-07 02:36:13 -04:00 committed by GitHub
parent 3cf18b9f2d
commit 1390276d55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -66,7 +66,16 @@ export default Vue.extend({
},
parseInvidiousData: function () {
this.thumbnail = this.data.authorThumbnails[2].url.replace('https://yt3.ggpht.com', `${this.currentInvidiousInstance}/ggpht/`)
// Can be prefixed with `https://` or `//` (protocol relative)
let thumbnailUrl = this.data.authorThumbnails[2].url
// Update protocol relative URL to be prefixed with `https://`
if (thumbnailUrl.startsWith('//')) {
thumbnailUrl = `https:${thumbnailUrl}`
}
this.thumbnail = thumbnailUrl.replace('https://yt3.ggpht.com', `${this.currentInvidiousInstance}/ggpht/`)
this.channelName = this.data.author
this.id = this.data.authorId
if (this.hideChannelSubscriptions) {