Proxy channel profile icons and banners through Invidious when API is preferred
This commit is contained in:
parent
71e33a82ef
commit
acf9b850c2
|
@ -24,6 +24,9 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
invidiousInstance: function () {
|
||||||
|
return this.$store.getters.getInvidiousInstance
|
||||||
|
},
|
||||||
listType: function () {
|
listType: function () {
|
||||||
return this.$store.getters.getListType
|
return this.$store.getters.getListType
|
||||||
},
|
},
|
||||||
|
@ -53,7 +56,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
parseInvidiousData: function () {
|
parseInvidiousData: function () {
|
||||||
this.thumbnail = this.data.authorThumbnails[2].url
|
this.thumbnail = this.data.authorThumbnails[2].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
this.channelName = this.data.author
|
this.channelName = this.data.author
|
||||||
this.id = this.data.authorId
|
this.id = this.data.authorId
|
||||||
if (this.hideChannelSubscriptions) {
|
if (this.hideChannelSubscriptions) {
|
||||||
|
|
|
@ -29,6 +29,12 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
backendPreference: function () {
|
||||||
|
return this.$store.getters.getBackendPreference
|
||||||
|
},
|
||||||
|
invidiousInstance: function () {
|
||||||
|
return this.$store.getters.getInvidiousInstance
|
||||||
|
},
|
||||||
profileList: function () {
|
profileList: function () {
|
||||||
return this.$store.getters.getProfileList
|
return this.$store.getters.getProfileList
|
||||||
},
|
},
|
||||||
|
@ -42,7 +48,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
profile: function () {
|
profile: function () {
|
||||||
this.channels = [].concat(this.primaryProfile.subscriptions).sort((a, b) => {
|
this.channels = JSON.parse(JSON.stringify(this.primaryProfile.subscriptions)).sort((a, b) => {
|
||||||
const nameA = a.name.toLowerCase()
|
const nameA = a.name.toLowerCase()
|
||||||
const nameB = b.name.toLowerCase()
|
const nameB = b.name.toLowerCase()
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
|
@ -59,6 +65,9 @@ export default Vue.extend({
|
||||||
|
|
||||||
return index === -1
|
return index === -1
|
||||||
}).map((channel) => {
|
}).map((channel) => {
|
||||||
|
if (this.backendPreference === 'invidious') {
|
||||||
|
channel.thumbnail = channel.thumbnail.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
|
}
|
||||||
channel.selected = false
|
channel.selected = false
|
||||||
return channel
|
return channel
|
||||||
})
|
})
|
||||||
|
@ -66,7 +75,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
if (typeof this.profile.subscriptions !== 'undefined') {
|
if (typeof this.profile.subscriptions !== 'undefined') {
|
||||||
this.channels = [].concat(this.profileList[0].subscriptions).sort((a, b) => {
|
this.channels = JSON.parse(JSON.stringify(this.profileList[0].subscriptions)).sort((a, b) => {
|
||||||
const nameA = a.name.toLowerCase()
|
const nameA = a.name.toLowerCase()
|
||||||
const nameB = b.name.toLowerCase()
|
const nameB = b.name.toLowerCase()
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
|
@ -83,6 +92,9 @@ export default Vue.extend({
|
||||||
|
|
||||||
return index === -1
|
return index === -1
|
||||||
}).map((channel) => {
|
}).map((channel) => {
|
||||||
|
if (this.backendPreference === 'invidious') {
|
||||||
|
channel.thumbnail = channel.thumbnail.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
|
}
|
||||||
channel.selected = false
|
channel.selected = false
|
||||||
return channel
|
return channel
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,6 +39,12 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
backendPreference: function () {
|
||||||
|
return this.$store.getters.getBackendPreference
|
||||||
|
},
|
||||||
|
invidiousInstance: function () {
|
||||||
|
return this.$store.getters.getInvidiousInstance
|
||||||
|
},
|
||||||
profileList: function () {
|
profileList: function () {
|
||||||
return this.$store.getters.getProfileList
|
return this.$store.getters.getProfileList
|
||||||
},
|
},
|
||||||
|
@ -62,7 +68,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
profile: function () {
|
profile: function () {
|
||||||
this.subscriptions = [].concat(this.profile.subscriptions).sort((a, b) => {
|
this.subscriptions = JSON.parse(JSON.stringify(this.profile.subscriptions)).sort((a, b) => {
|
||||||
const nameA = a.name.toLowerCase()
|
const nameA = a.name.toLowerCase()
|
||||||
const nameB = b.name.toLowerCase()
|
const nameB = b.name.toLowerCase()
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
|
@ -73,6 +79,9 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}).map((channel) => {
|
}).map((channel) => {
|
||||||
|
if (this.backendPreference === 'invidious') {
|
||||||
|
channel.thumbnail = channel.thumbnail.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
|
}
|
||||||
channel.selected = false
|
channel.selected = false
|
||||||
return channel
|
return channel
|
||||||
})
|
})
|
||||||
|
@ -80,7 +89,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
if (typeof this.profile.subscriptions !== 'undefined') {
|
if (typeof this.profile.subscriptions !== 'undefined') {
|
||||||
this.subscriptions = [].concat(this.profile.subscriptions).sort((a, b) => {
|
this.subscriptions = JSON.parse(JSON.stringify(this.profile.subscriptions)).sort((a, b) => {
|
||||||
const nameA = a.name.toLowerCase()
|
const nameA = a.name.toLowerCase()
|
||||||
const nameB = b.name.toLowerCase()
|
const nameB = b.name.toLowerCase()
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
|
@ -91,6 +100,9 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}).map((channel) => {
|
}).map((channel) => {
|
||||||
|
if (this.backendPreference === 'invidious') {
|
||||||
|
channel.thumbnail = channel.thumbnail.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
|
}
|
||||||
channel.selected = false
|
channel.selected = false
|
||||||
return channel
|
return channel
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,6 +13,12 @@ export default Vue.extend({
|
||||||
isOpen: function () {
|
isOpen: function () {
|
||||||
return this.$store.getters.getIsSideNavOpen
|
return this.$store.getters.getIsSideNavOpen
|
||||||
},
|
},
|
||||||
|
backendPreference: function () {
|
||||||
|
return this.$store.getters.getBackendPreference
|
||||||
|
},
|
||||||
|
invidiousInstance: function () {
|
||||||
|
return this.$store.getters.getInvidiousInstance
|
||||||
|
},
|
||||||
profileList: function () {
|
profileList: function () {
|
||||||
return this.$store.getters.getProfileList
|
return this.$store.getters.getProfileList
|
||||||
},
|
},
|
||||||
|
@ -31,6 +37,12 @@ export default Vue.extend({
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
|
}).map((channel) => {
|
||||||
|
if (this.backendPreference === 'invidious') {
|
||||||
|
channel.thumbnail = channel.thumbnail.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return channel
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
hidePopularVideos: function () {
|
hidePopularVideos: function () {
|
||||||
|
|
|
@ -205,7 +205,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
const commentData = response.comments.map((comment) => {
|
const commentData = response.comments.map((comment) => {
|
||||||
comment.showReplies = false
|
comment.showReplies = false
|
||||||
comment.authorThumb = comment.authorThumbnails[1].url
|
comment.authorThumb = comment.authorThumbnails[1].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
if (this.hideCommentLikes) {
|
if (this.hideCommentLikes) {
|
||||||
comment.likes = null
|
comment.likes = null
|
||||||
} else {
|
} else {
|
||||||
|
@ -273,7 +273,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
const commentData = response.comments.map((comment) => {
|
const commentData = response.comments.map((comment) => {
|
||||||
comment.showReplies = false
|
comment.showReplies = false
|
||||||
comment.authorThumb = comment.authorThumbnails[1].url
|
comment.authorThumb = comment.authorThumbnails[1].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
if (this.hideCommentLikes) {
|
if (this.hideCommentLikes) {
|
||||||
comment.likes = null
|
comment.likes = null
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -74,6 +74,10 @@ export default Vue.extend({
|
||||||
return this.$store.getters.getBackendFallback
|
return this.$store.getters.getBackendFallback
|
||||||
},
|
},
|
||||||
|
|
||||||
|
invidiousInstance: function () {
|
||||||
|
return this.$store.getters.getInvidiousInstance
|
||||||
|
},
|
||||||
|
|
||||||
sessionSearchHistory: function () {
|
sessionSearchHistory: function () {
|
||||||
return this.$store.getters.getSessionSearchHistory
|
return this.$store.getters.getSessionSearchHistory
|
||||||
},
|
},
|
||||||
|
@ -348,13 +352,17 @@ export default Vue.extend({
|
||||||
} else {
|
} else {
|
||||||
this.subCount = response.subCount
|
this.subCount = response.subCount
|
||||||
}
|
}
|
||||||
this.thumbnailUrl = response.authorThumbnails[3].url
|
this.thumbnailUrl = response.authorThumbnails[3].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
this.channelDescription = autolinker.link(response.description)
|
this.channelDescription = autolinker.link(response.description)
|
||||||
this.relatedChannels = response.relatedChannels
|
this.relatedChannels = response.relatedChannels.map((channel) => {
|
||||||
|
channel.authorThumbnails[channel.authorThumbnails.length - 1].url = channel.authorThumbnails[channel.authorThumbnails.length - 1].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
|
|
||||||
|
return channel
|
||||||
|
})
|
||||||
this.latestVideos = response.latestVideos
|
this.latestVideos = response.latestVideos
|
||||||
|
|
||||||
if (typeof (response.authorBanners) !== 'undefined') {
|
if (typeof (response.authorBanners) !== 'undefined') {
|
||||||
this.bannerUrl = response.authorBanners[0].url
|
this.bannerUrl = response.authorBanners[0].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|
|
@ -30,9 +30,11 @@ export default Vue.extend({
|
||||||
backendPreference: function () {
|
backendPreference: function () {
|
||||||
return this.$store.getters.getBackendPreference
|
return this.$store.getters.getBackendPreference
|
||||||
},
|
},
|
||||||
|
|
||||||
backendFallback: function () {
|
backendFallback: function () {
|
||||||
return this.$store.getters.getBackendFallback
|
return this.$store.getters.getBackendFallback
|
||||||
|
},
|
||||||
|
invidiousInstance: function () {
|
||||||
|
return this.$store.getters.getInvidiousInstance
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -145,7 +147,7 @@ export default Vue.extend({
|
||||||
viewCount: result.viewCount,
|
viewCount: result.viewCount,
|
||||||
videoCount: result.videoCount,
|
videoCount: result.videoCount,
|
||||||
channelName: result.author,
|
channelName: result.author,
|
||||||
channelThumbnail: result.authorThumbnails[2].url,
|
channelThumbnail: result.authorThumbnails[2].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`),
|
||||||
channelId: result.authorId,
|
channelId: result.authorId,
|
||||||
infoSource: 'invidious'
|
infoSource: 'invidious'
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,7 +448,7 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
this.channelId = result.authorId
|
this.channelId = result.authorId
|
||||||
this.channelName = result.author
|
this.channelName = result.author
|
||||||
this.channelThumbnail = result.authorThumbnails[1] ? result.authorThumbnails[1].url : ''
|
this.channelThumbnail = result.authorThumbnails[1] ? result.authorThumbnails[1].url.replace('https://yt3.ggpht.com', `${this.invidiousInstance}/ggpht/`) : ''
|
||||||
this.videoPublished = result.published * 1000
|
this.videoPublished = result.published * 1000
|
||||||
this.videoDescriptionHtml = result.descriptionHtml
|
this.videoDescriptionHtml = result.descriptionHtml
|
||||||
this.recommendedVideos = result.recommendedVideos
|
this.recommendedVideos = result.recommendedVideos
|
||||||
|
|
Loading…
Reference in New Issue