Skip to content

Commit 16c2e9a

Browse files
committed
Merge branch 'development' into custom-builds/tmp
* development: (29 commits) Translated using Weblate (Chinese (Traditional)) Fix URL copied via right click menu (FreeTubeApp#4690) Translated using Weblate (Croatian) Wrap ft-icon buttons below before they go fully vertical (FreeTubeApp#4735) * Make activating a chapter selector makes window scroll to top like clicking on timestamp links (FreeTubeApp#4722) Translated using Weblate (Portuguese (Brazil)) Translated using Weblate (Portuguese (Brazil)) Make video thumbnails have certain height before image loading starts to avoid layout shifts (FreeTubeApp#4723) Update subscription cache when visiting a channel (FreeTubeApp#4667) Fix fallback to Invidious for the podcasts channel tab (FreeTubeApp#4731) Translated using Weblate (Portuguese (Brazil)) Translated using Weblate (Arabic) Translated using Weblate (Polish) Translated using Weblate (Dutch) Translated using Weblate (Icelandic) Translated using Weblate (Spanish) Translated using Weblate (Arabic) Translated using Weblate (Icelandic) Translated using Weblate (Italian) Translated using Weblate (Chinese (Simplified)) ...
2 parents 3448e11 + 0a11571 commit 16c2e9a

File tree

21 files changed

+678
-195
lines changed

21 files changed

+678
-195
lines changed

src/renderer/components/watch-video-chapters/watch-video-chapters.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export default defineComponent({
6969
changeChapter: function(index) {
7070
this.currentIndex = index
7171
this.$emit('timestamp-event', this.chapters[index].startSeconds)
72+
window.scrollTo(0, 0)
7273
},
7374

7475
navigateChapters(direction) {

src/renderer/components/watch-video-info/watch-video-info.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@
6464
inset-inline-end: calc(50% - 20px);
6565
}
6666
}
67+
68+
@media screen and (max-width: 460px) {
69+
flex-wrap: nowrap;
70+
:deep(.iconDropdown) {
71+
inset-inline-start: auto;
72+
inset-inline-end: auto;
73+
}
74+
}
75+
}
76+
@media screen and (max-width: 460px) {
77+
flex-direction: column;
78+
align-items: flex-start;
79+
margin-block-start: 10px;
6780
}
6881
}
6982

src/renderer/store/modules/subscriptions.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ const actions = {
5454
commit('updateShortsCacheByChannel', payload)
5555
},
5656

57+
updateSubscriptionShortsCacheWithChannelPageShorts: ({ commit }, payload) => {
58+
commit('updateShortsCacheWithChannelPageShorts', payload)
59+
},
60+
5761
updateSubscriptionLiveCacheByChannel: ({ commit }, payload) => {
5862
commit('updateLiveCacheByChannel', payload)
5963
},
@@ -86,6 +90,31 @@ const mutations = {
8690
if (videos != null) { newObject.videos = videos }
8791
state.shortsCache[channelId] = newObject
8892
},
93+
updateShortsCacheWithChannelPageShorts(state, { channelId, videos }) {
94+
const cachedObject = state.shortsCache[channelId]
95+
96+
if (cachedObject && cachedObject.videos.length > 0) {
97+
cachedObject.videos.forEach(cachedVideo => {
98+
const channelVideo = videos.find(short => cachedVideo.videoId === short.videoId)
99+
100+
if (channelVideo) {
101+
// authorId probably never changes, so we don't need to update that
102+
103+
cachedVideo.title = channelVideo.title
104+
cachedVideo.author = channelVideo.author
105+
106+
// as the channel shorts page only has compact view counts for numbers above 1000 e.g. 12k
107+
// and the RSS feeds include an exact value, we only want to overwrite it when the number is larger than the cached value
108+
// 12345 vs 12000 => 12345
109+
// 12345 vs 15000 => 15000
110+
111+
if (channelVideo.viewCount > cachedVideo.viewCount) {
112+
cachedVideo.viewCount = channelVideo.viewCount
113+
}
114+
}
115+
})
116+
}
117+
},
89118
clearShortsCache(state) {
90119
state.shortsCache = {}
91120
},

src/renderer/views/Channel/Channel.js

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import {
3333
parseLocalListVideo,
3434
parseLocalSubscriberCount
3535
} from '../../helpers/api/local'
36+
import {
37+
addPublishedDatesInvidious,
38+
addPublishedDatesLocal
39+
} from '../../helpers/subscriptions'
3640

3741
export default defineComponent({
3842
name: 'Channel',
@@ -171,6 +175,13 @@ export default defineComponent({
171175
return this.subscriptionInfo !== null
172176
},
173177

178+
isSubscribedInAnyProfile: function () {
179+
const profileList = this.$store.getters.getProfileList
180+
181+
// check the all channels profile
182+
return profileList[0].subscriptions.some((channel) => channel.id === this.id)
183+
},
184+
174185
videoLiveSelectNames: function () {
175186
return [
176187
this.$t('Channel.Videos.Sort Types.Newest'),
@@ -767,6 +778,17 @@ export default defineComponent({
767778
this.latestVideos = parseLocalChannelVideos(videosTab.videos, this.id, this.channelName)
768779
this.videoContinuationData = videosTab.has_continuation ? videosTab : null
769780
this.isElementListLoading = false
781+
782+
if (this.isSubscribedInAnyProfile && this.latestVideos.length > 0 && this.videoSortBy === 'newest') {
783+
addPublishedDatesLocal(this.latestVideos)
784+
this.updateSubscriptionVideosCacheByChannel({
785+
channelId: this.id,
786+
// create a copy so that we only cache the first page
787+
// if we use the same array, the store will get angry at us for modifying it outside of the store,
788+
// when the user clicks load more
789+
videos: [...this.latestVideos]
790+
})
791+
}
770792
} catch (err) {
771793
console.error(err)
772794
const errorMessage = this.$t('Local API Error (Click to copy)')
@@ -825,6 +847,16 @@ export default defineComponent({
825847
this.latestShorts = parseLocalChannelShorts(shortsTab.videos, this.id, this.channelName)
826848
this.shortContinuationData = shortsTab.has_continuation ? shortsTab : null
827849
this.isElementListLoading = false
850+
851+
if (this.isSubscribedInAnyProfile && this.latestShorts.length > 0 && this.shortSortBy === 'newest') {
852+
// As the shorts tab API response doesn't include the published dates,
853+
// we can't just write the results to the subscriptions cache like we do with videos and live (can't sort chronologically without the date).
854+
// However we can still update the metadata in the cache such as the view count and title that might have changed since it was cached
855+
this.updateSubscriptionShortsCacheWithChannelPageShorts({
856+
channelId: this.id,
857+
videos: this.latestShorts
858+
})
859+
}
828860
} catch (err) {
829861
console.error(err)
830862
const errorMessage = this.$t('Local API Error (Click to copy)')
@@ -883,6 +915,17 @@ export default defineComponent({
883915
this.latestLive = parseLocalChannelVideos(liveTab.videos, this.id, this.channelName)
884916
this.liveContinuationData = liveTab.has_continuation ? liveTab : null
885917
this.isElementListLoading = false
918+
919+
if (this.isSubscribedInAnyProfile && this.latestLive.length > 0 && this.liveSortBy === 'newest') {
920+
addPublishedDatesLocal(this.latestLive)
921+
this.updateSubscriptionLiveCacheByChannel({
922+
channelId: this.id,
923+
// create a copy so that we only cache the first page
924+
// if we use the same array, the store will get angry at us for modifying it outside of the store,
925+
// when the user clicks load more
926+
videos: [...this.latestLive]
927+
})
928+
}
886929
} catch (err) {
887930
console.error(err)
888931
const errorMessage = this.$t('Local API Error (Click to copy)')
@@ -1052,6 +1095,16 @@ export default defineComponent({
10521095
}
10531096
this.videoContinuationData = response.continuation || null
10541097
this.isElementListLoading = false
1098+
1099+
if (this.isSubscribedInAnyProfile && !more && this.latestVideos.length > 0 && this.videoSortBy === 'newest') {
1100+
addPublishedDatesInvidious(this.latestVideos)
1101+
this.updateSubscriptionVideosCacheByChannel({
1102+
channelId: this.id,
1103+
// create a copy so that we only cache the first page
1104+
// if we use the same array, it will also contain all the next pages
1105+
videos: [...this.latestVideos]
1106+
})
1107+
}
10551108
}).catch((err) => {
10561109
console.error(err)
10571110
const errorMessage = this.$t('Invidious API Error (Click to copy)')
@@ -1101,6 +1154,17 @@ export default defineComponent({
11011154
}
11021155
this.shortContinuationData = response.continuation || null
11031156
this.isElementListLoading = false
1157+
1158+
if (this.isSubscribedInAnyProfile && !more && this.latestShorts.length > 0 && this.shortSortBy === 'newest') {
1159+
// As the shorts tab API response doesn't include the published dates,
1160+
// we can't just write the results to the subscriptions cache like we do with videos and live (can't sort chronologically without the date).
1161+
// However we can still update the metadata in the cache e.g. adding the duration, as that isn't included in the RSS feeds
1162+
// and updating the view count and title that might have changed since it was cached
1163+
this.updateSubscriptionShortsCacheWithChannelPageShorts({
1164+
channelId: this.id,
1165+
videos: this.latestShorts
1166+
})
1167+
}
11041168
}).catch((err) => {
11051169
console.error(err)
11061170
const errorMessage = this.$t('Invidious API Error (Click to copy)')
@@ -1142,6 +1206,17 @@ export default defineComponent({
11421206
}
11431207
this.liveContinuationData = response.continuation || null
11441208
this.isElementListLoading = false
1209+
1210+
if (this.isSubscribedInAnyProfile && !more && this.latestLive.length > 0 && this.liveSortBy === 'newest') {
1211+
addPublishedDatesInvidious(this.latestLive)
1212+
this.updateSubscriptionLiveCacheByChannel({
1213+
channelId: this.id,
1214+
// create a copy so that we only cache the first page
1215+
// if we use the same array, the store will get angry at us for modifying it outside of the store,
1216+
// when the user clicks load more
1217+
videos: [...this.latestLive]
1218+
})
1219+
}
11451220
}).catch((err) => {
11461221
console.error(err)
11471222
const errorMessage = this.$t('Invidious API Error (Click to copy)')
@@ -1444,7 +1519,7 @@ export default defineComponent({
14441519
})
14451520
if (this.backendPreference === 'local' && this.backendFallback) {
14461521
showToast(this.$t('Falling back to Invidious API'))
1447-
this.getChannelPodcastsInvidious()
1522+
this.channelInvidiousPodcasts()
14481523
} else {
14491524
this.isLoading = false
14501525
}
@@ -1559,6 +1634,19 @@ export default defineComponent({
15591634

15601635
this.latestCommunityPosts = parseLocalCommunityPosts(posts)
15611636
this.communityContinuationData = communityTab.has_continuation ? communityTab : null
1637+
1638+
if (this.latestCommunityPosts.length > 0) {
1639+
this.latestCommunityPosts.forEach(post => {
1640+
post.authorId = this.id
1641+
})
1642+
this.updateSubscriptionPostsCacheByChannel({
1643+
channelId: this.id,
1644+
// create a copy so that we only cache the first page
1645+
// if we use the same array, the store will get angry at us for modifying it outside of the store,
1646+
// when the user clicks load more
1647+
posts: [...this.latestCommunityPosts]
1648+
})
1649+
}
15621650
} catch (err) {
15631651
console.error(err)
15641652
const errorMessage = this.$t('Local API Error (Click to copy)')
@@ -1610,6 +1698,19 @@ export default defineComponent({
16101698
this.latestCommunityPosts = posts
16111699
}
16121700
this.communityContinuationData = continuation
1701+
1702+
if (this.isSubscribedInAnyProfile && !more && this.latestCommunityPosts.length > 0) {
1703+
this.latestCommunityPosts.forEach(post => {
1704+
post.authorId = this.id
1705+
})
1706+
this.updateSubscriptionPostsCacheByChannel({
1707+
channelId: this.id,
1708+
// create a copy so that we only cache the first page
1709+
// if we use the same array, the store will get angry at us for modifying it outside of the store,
1710+
// when the user clicks load more
1711+
posts: [...this.latestCommunityPosts]
1712+
})
1713+
}
16131714
}).catch(async (err) => {
16141715
console.error(err)
16151716
const errorMessage = this.$t('Invidious API Error (Click to copy)')
@@ -1849,7 +1950,11 @@ export default defineComponent({
18491950

18501951
...mapActions([
18511952
'showOutlines',
1852-
'updateSubscriptionDetails'
1953+
'updateSubscriptionDetails',
1954+
'updateSubscriptionVideosCacheByChannel',
1955+
'updateSubscriptionLiveCacheByChannel',
1956+
'updateSubscriptionShortsCacheWithChannelPageShorts',
1957+
'updateSubscriptionPostsCacheByChannel'
18531958
])
18541959
}
18551960
})

static/locales/ar.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Put the name of your locale in the same language
2-
Locale Name: 'الإنجليزية (الولايات المتحدة)'
2+
Locale Name: 'العربية'
33
FreeTube: 'فري تيوب'
44
# Currently on Subscriptions, Playlists, and History
55
'This part of the app is not ready yet. Come back later when progress has been made.': >-
@@ -186,6 +186,7 @@ User Playlists:
186186
Save: حفظ
187187
Search in Playlists: البحث في قوائم التشغيل
188188
N playlists selected: تم تحديد {playlistCount}
189+
Added {count} Times: تمت إضافة {count} الوقت | تمت إضافة {count} مرة
189190
CreatePlaylistPrompt:
190191
Toast:
191192
There is already a playlist with this name. Please pick a different name.: توجد

static/locales/cs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ User Playlists:
146146
Select a playlist to add your N videos to: Vyberte playlist, do kterého přidat
147147
vaše video | Vyberte playlist, do kterého přidat vašich {videoCount} videí
148148
N playlists selected: Vybráno {playlistCount}
149+
Added {count} Times: Přidáno {count}krát | Přidáno {count}krát
149150
SinglePlaylistView:
150151
Toast:
151152
There were no videos to remove.: Nejsou zde žádná videa k odstranění.

static/locales/en_GB.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ Playlists: 'Playlists'
121121
User Playlists:
122122
Your Playlists: 'Your playlists'
123123
Playlist Message: This page is not reflective of fully working playlists. It only
124-
lists videos that you have saved or favourited. When the work has finished, all
125-
videos currently here will be migrated to a ‘Favourites’ playlist.
124+
lists videos that you have saved or made a Favourite. When the work has finished,
125+
all videos currently here will be migrated to a ‘Favourites’ playlist.
126126
Your saved videos are empty. Click on the save button on the corner of a video to have it listed here: Your
127127
saved videos are empty. Click on the save button on the corner of a video to have
128128
it listed here
129129
Search bar placeholder: Search in playlist
130130
Empty Search Message: There are no videos in this playlist that match your search
131-
Create New Playlist: Create new playlist
131+
Create New Playlist: Create new Playlist
132132
Add to Playlist: Add to playlist
133133
This playlist currently has no videos.: This playlist currently has no videos.
134134
Move Video Down: Move video down
@@ -185,11 +185,21 @@ User Playlists:
185185
"{videoCount} video(s) added to 1 playlist": 1 video added to 1 playlist | {videoCount}
186186
videos added to 1 playlist
187187
You haven't selected any playlist yet.: You haven't selected any playlist yet.
188+
"{videoCount} video(s) added to {playlistCount} playlists": 1 video added to
189+
{playlistCount} playlists | {videoCount} videos added to {playlistCount}
190+
playlists
188191
Select a playlist to add your N videos to: Select a playlist to add your video
189192
to | Select a playlist to add your {videoCount} videos to
190193
CreatePlaylistPrompt:
191-
New Playlist Name: New playlist name
194+
New Playlist Name: New Playlist name
192195
Create: Create
196+
Toast:
197+
Playlist {playlistName} has been successfully created.: Playlist {playlistName}
198+
has been successfully created.
199+
There was an issue with creating the playlist.: There was an problem when creating
200+
the playlist.
201+
There is already a playlist with this name. Please pick a different name.: There
202+
is already a Playlist with this name. Please pick a different name.
193203
You have no playlists. Click on the create new playlist button to create a new one.: You
194204
have no playlists. Click on the create new playlist button to create a new one.
195205
Move Video Up: Move video up
@@ -252,7 +262,7 @@ Settings:
252262
Clear Default Instance: Clear default instance
253263
Set Current Instance as Default: Set current instance as default
254264
Current instance will be randomized on startup: Current instance will be randomised
255-
on startup
265+
on Startup
256266
No default instance has been set: No default instance has been set
257267
The currently set default instance is {instance}: The currently set default instance
258268
is {instance}
@@ -1082,8 +1092,8 @@ New Window: New window
10821092
Channels:
10831093
Empty: Your channel list is currently empty.
10841094
Unsubscribe: Unsubscribe
1085-
Unsubscribed: '{channelName} has been removed from your subscriptions'
1086-
Unsubscribe Prompt: Are you sure you want to unsubscribe from ‘{channelName}’?
1095+
Unsubscribed: '{channelName} has been removed from your Subscriptions'
1096+
Unsubscribe Prompt: Are you sure you want to Unsubscribe from ‘{channelName}’?
10871097
Title: Channel list
10881098
Search bar placeholder: Search channels
10891099
Channels: Channels
@@ -1113,3 +1123,4 @@ Playlist will not pause when current video is finished: Playlist will not pause
11131123
current video is finished
11141124
Go to page: Go to {page}
11151125
Tag already exists: ‘{tagName}’ tag already exists
1126+
Close Banner: Close Banner

static/locales/es.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ User Playlists:
142142
a la que añadir su vídeo | Seleccione una lista de reproducción a la que añadir
143143
sus {videoCount} vídeos
144144
N playlists selected: '{playlistCount} seleccionada'
145+
Added {count} Times: Añadido {count} vez | Añadido {count} veces
145146
SinglePlaylistView:
146147
Toast:
147148
There were no videos to remove.: No había vídeos que eliminar.

0 commit comments

Comments
 (0)