diff --git a/src/renderer/components/subscriptions-community/subscriptions-community.js b/src/renderer/components/subscriptions-community/subscriptions-community.js index 59df38efcb570..86c81c6ecc1a6 100644 --- a/src/renderer/components/subscriptions-community/subscriptions-community.js +++ b/src/renderer/components/subscriptions-community/subscriptions-community.js @@ -164,12 +164,8 @@ export default defineComponent({ let thumbnailUrl = post.authorThumbnails?.[0]?.url if (name || thumbnailUrl) { - if (thumbnailUrl) { - if (thumbnailUrl.startsWith('//')) { - thumbnailUrl = 'https:' + thumbnailUrl - } else if (thumbnailUrl.startsWith(`${this.currentInvidiousInstanceUrl}/ggpht`)) { - thumbnailUrl = thumbnailUrl.replace(`${this.currentInvidiousInstanceUrl}/ggpht`, 'https://yt3.googleusercontent.com') - } + if (thumbnailUrl?.startsWith('//')) { + thumbnailUrl = 'https:' + thumbnailUrl } subscriptionUpdates.push({ diff --git a/src/renderer/store/modules/profiles.js b/src/renderer/store/modules/profiles.js index 70ca26b8aaa18..9e55e61e3f953 100644 --- a/src/renderer/store/modules/profiles.js +++ b/src/renderer/store/modules/profiles.js @@ -113,7 +113,11 @@ const actions = { } if (channelThumbnailUrl) { - const thumbnail = channelThumbnailUrl.replace(/=s\d*/, '=s176') // change thumbnail size if different + const thumbnail = channelThumbnailUrl + // change thumbnail size if different + .replace(/=s\d*/, '=s176') + // If this is an Invidious URL, convert it to a YouTube one + .replace(/^https?:\/\/[^/]+\/ggpht/, 'https://yt3.googleusercontent.com') if (channel.thumbnail !== thumbnail) { channel.thumbnail = thumbnail @@ -129,7 +133,12 @@ const actions = { }, async updateSubscriptionDetails({ dispatch, state }, { channelThumbnailUrl, channelName, channelId }) { - const thumbnail = channelThumbnailUrl?.replace(/=s\d*/, '=s176') ?? null // change thumbnail size if different + const thumbnail = channelThumbnailUrl + // change thumbnail size if different + ?.replace(/=s\d*/, '=s176') + // If this is an Invidious URL, convert it to a YouTube one + .replace(/^https?:\/\/[^/]+\/ggpht/, 'https://yt3.googleusercontent.com') ?? + null const profileList = state.profileList for (const profile of profileList) { const currentProfileCopy = deepCopy(profile) @@ -173,6 +182,11 @@ const actions = { }, async addChannelToProfiles({ commit }, { channel, profileIds }) { + // If this is an Invidious URL, convert it to a YouTube one + if (!channel.thumbnail.startsWith('https://yt3.googleusercontent.com/')) { + channel.thumbnail = channel.thumbnail.replace(/^https?:\/\/[^/]+\/ggpht/, 'https://yt3.googleusercontent.com') + } + try { await DBProfileHandlers.addChannelToProfiles(channel, profileIds) commit('addChannelToProfiles', { channel, profileIds })