Skip to content

Commit 952c074

Browse files
committed
Merge branch 'development' into custom-builds/current
* development: Translated using Weblate (Indonesian) Bump version number to v0.23.1 Translated using Weblate (Portuguese (Brazil)) Fix comment sorting when sort by newest is the default (FreeTubeApp#6702) ! Fix license data reading code causing some videos cannot be played (FreeTubeApp#6682) Translated using Weblate (Spanish) Update release.yml Update release.yml Bump version number to v0.23.0 Add Creative Commons License to Description of Videos (FreeTubeApp#6614) Only refresh current trending tab (FreeTubeApp#6667) Translated using Weblate (Icelandic) Translated using Weblate (Chinese (Traditional Han script)) Translated using Weblate (Arabic)
2 parents d586bd5 + ee1708f commit 952c074

File tree

16 files changed

+190
-97
lines changed

16 files changed

+190
-97
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ jobs:
5959
id: getPackageInfo
6060
uses: jaywcjlove/github-action-package@main
6161

62+
- name: Install libarchive-tools
63+
if: startsWith(matrix.os, 'ubuntu')
64+
run: sudo apt update; sudo apt -y install libarchive-tools; echo "Version Number ${{ toJson(job) }} ${{ toJson(needs) }}"
65+
6266
- name: Build x64 with Node.js ${{ matrix.node-version}}
6367
if: contains(matrix.runtime, 'x64')
6468
run: yarn run build
@@ -76,7 +80,7 @@ jobs:
7680
run: |
7781
sudo apt install desktop-file-utils
7882
cd build
79-
appimage="FreeTube-${{ steps.versionNumber.outputs.result }}.AppImage"
83+
appimage="FreeTube-${{ steps.getPackageInfo.outputs.version }}.AppImage"
8084
wget "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" -O ./appimagetool.AppImage
8185
chmod +x ./"$appimage" ./appimagetool.AppImage
8286
./"$appimage" --appimage-extract && rm -f ./"$appimage"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "freetube",
33
"productName": "FreeTube",
44
"description": "A private YouTube client",
5-
"version": "0.22.1",
5+
"version": "0.23.1",
66
"license": "AGPL-3.0-or-later",
77
"main": "./dist/main.js",
88
"private": true,

src/renderer/components/CommentSection/CommentSection.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ const nextPageToken = shallowRef(null)
363363
// we need to react to new replies and showReplies being toggled
364364
const commentData = ref([])
365365
366+
/** @type {import('youtubei.js').YT.Comments | undefined} */
367+
let localCommentsInstance
368+
366369
/** @type {import('vue').ComputedRef<'local' | 'invidious'>} */
367370
const backendPreference = computed(() => {
368371
return store.getters.getBackendPreference
@@ -538,8 +541,13 @@ async function getCommentDataLocal(more = false) {
538541
let comments
539542
if (more) {
540543
comments = await nextPageToken.value.getContinuation()
544+
} else if (localCommentsInstance) {
545+
comments = await localCommentsInstance.applySort(sortNewest.value ? 'NEWEST_FIRST' : 'TOP_COMMENTS')
546+
localCommentsInstance = comments
541547
} else {
542-
comments = await getLocalComments(props.id, sortNewest.value)
548+
comments = await getLocalComments(props.id)
549+
sortNewest.value = comments.header?.sort_menu?.sub_menu_items?.[1].selected ?? false
550+
localCommentsInstance = comments
543551
}
544552
545553
const parsedComments = comments.contents
@@ -575,6 +583,7 @@ async function getCommentDataLocal(more = false) {
575583
nextPageToken.value = null
576584
isLoading.value = false
577585
showComments.value = true
586+
localCommentsInstance = undefined
578587
return
579588
}
580589
// endregion No comment detection
@@ -585,6 +594,7 @@ async function getCommentDataLocal(more = false) {
585594
copyToClipboard(err)
586595
})
587596
if (backendFallback.value && backendPreference.value === 'local') {
597+
localCommentsInstance = undefined
588598
showToast(t('Falling back to Invidious API'))
589599
getCommentDataInvidious()
590600
} else {

src/renderer/components/WatchVideoDescription/WatchVideoDescription.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@
4343
max-block-size: 4lh;
4444
overflow: hidden;
4545
}
46+
47+
.license {
48+
margin-block: 1em;
49+
}

src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
@timestamp-event="onTimestamp"
2323
@click.native="expandDescriptionWithClick"
2424
/>
25+
<span
26+
v-if="license && showFullDescription"
27+
class="license"
28+
>
29+
{{ license }}
30+
</span>
2531
<span
2632
v-if="showControls && showFullDescription"
2733
class="descriptionStatus"
@@ -51,6 +57,10 @@ const props = defineProps({
5157
descriptionHtml: {
5258
type: String,
5359
default: ''
60+
},
61+
license: {
62+
type: String,
63+
default: null,
5464
}
5565
})
5666

src/renderer/helpers/api/local.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,10 @@ export async function getLocalVideoInfo(id) {
291291

292292
/**
293293
* @param {string} id
294-
* @param {boolean | undefined} sortByNewest
295294
*/
296-
export async function getLocalComments(id, sortByNewest = false) {
295+
export async function getLocalComments(id) {
297296
const innertube = await createInnertube()
298-
return innertube.getComments(id, sortByNewest ? 'NEWEST_FIRST' : 'TOP_COMMENTS')
297+
return innertube.getComments(id)
299298
}
300299

301300
// I know `type & type` is typescript syntax and not valid jsdoc but I couldn't get @extends or @augments to work

src/renderer/store/modules/utils.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ const state = {
5454
externalPlayerValues: [],
5555
externalPlayerCmdArguments: {},
5656
lastPopularRefreshTimestamp: '',
57-
lastTrendingRefreshTimestamp: '',
57+
lastTrendingRefreshTimestamp: {
58+
default: '',
59+
music: '',
60+
gaming: '',
61+
movies: ''
62+
},
5863
subscriptionFirstAutoFetchRunData: {
5964
videos: false,
6065
liveStreams: false,
@@ -905,21 +910,24 @@ const mutations = {
905910
state.trendingCache[page] = value
906911
},
907912

908-
setLastTrendingRefreshTimestamp (state, timestamp) {
909-
state.lastTrendingRefreshTimestamp = timestamp
913+
/**
914+
* @param {typeof state} state
915+
* @param {{page: 'default' | 'music' | 'gaming' | 'movies', timestamp: Date}} param1
916+
*/
917+
setLastTrendingRefreshTimestamp (state, { page, timestamp }) {
918+
state.lastTrendingRefreshTimestamp[page] = timestamp
910919
},
911920

912921
setLastPopularRefreshTimestamp (state, timestamp) {
913922
state.lastPopularRefreshTimestamp = timestamp
914923
},
915924

916-
clearTrendingCache(state) {
917-
state.trendingCache = {
918-
default: null,
919-
music: null,
920-
gaming: null,
921-
movies: null
922-
}
925+
/**
926+
* @param {typeof state} state
927+
* @param {'default' | 'music' | 'gaming' | 'movies'} page
928+
*/
929+
clearTrendingCache(state, page) {
930+
state.trendingCache[page] = null
923931
},
924932

925933
setCachedPlaylist(state, value) {

src/renderer/views/Trending/Trending.vue

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<template>
22
<div>
3-
<FtLoader
4-
v-if="isLoading"
5-
:fullscreen="true"
6-
/>
73
<FtCard
8-
v-else
94
class="card"
105
>
116
<h2>
@@ -106,14 +101,21 @@
106101
{{ $t("Trending.Movies").toUpperCase() }}
107102
</div>
108103
</FtFlexBox>
109-
<FtElementList
104+
<div
110105
id="trendingPanel"
111106
role="tabpanel"
112-
:data="shownResults"
113-
/>
107+
>
108+
<FtLoader
109+
v-if="isLoading[currentTab]"
110+
/>
111+
<FtElementList
112+
v-else
113+
:data="shownResults"
114+
/>
115+
</div>
114116
</FtCard>
115117
<FtRefreshWidget
116-
:disable-refresh="isLoading"
118+
:disable-refresh="isLoading[currentTab]"
117119
:last-refresh-timestamp="lastTrendingRefreshTimestamp"
118120
:title="$t('Trending.Trending')"
119121
@click="getTrendingInfo(true)"
@@ -152,7 +154,7 @@ const backendFallback = computed(() => {
152154
})
153155
154156
const lastTrendingRefreshTimestamp = computed(() => {
155-
return getRelativeTimeFromDate(store.getters.getLastTrendingRefreshTimestamp, true)
157+
return getRelativeTimeFromDate(store.getters.getLastTrendingRefreshTimestamp[currentTab.value], true)
156158
})
157159
158160
/** @type {import('vue').ComputedRef<string>} */
@@ -165,7 +167,7 @@ const trendingCache = computed(() => {
165167
return store.getters.getTrendingCache
166168
})
167169
168-
const isLoading = ref(false)
170+
const isLoading = ref({ default: false, music: false, gaming: false, movies: false })
169171
const shownResults = shallowRef([])
170172
171173
/** @type {import('vue').Ref<'default' | 'music' | 'gaming' | 'movies'>} */
@@ -190,7 +192,7 @@ function getTrendingInfo(refresh = false) {
190192
trendingInstance = null
191193
}
192194
193-
store.commit('clearTrendingCache')
195+
store.commit('clearTrendingCache', currentTab.value)
194196
}
195197
196198
if (!process.env.SUPPORTS_LOCAL_API || backendPreference.value === 'invidious') {
@@ -199,17 +201,17 @@ function getTrendingInfo(refresh = false) {
199201
getTrendingInfoLocal()
200202
}
201203
202-
store.commit('setLastTrendingRefreshTimestamp', new Date())
204+
store.commit('setLastTrendingRefreshTimestamp', { page: currentTab.value, timestamp: new Date() })
203205
}
204206
205207
async function getTrendingInfoLocal() {
206-
isLoading.value = true
208+
isLoading.value[currentTab.value] = true
207209
208210
try {
209211
const { results, instance } = await getLocalTrending(region.value, currentTab.value, trendingInstance)
210212
211213
shownResults.value = results
212-
isLoading.value = false
214+
isLoading.value[currentTab.value] = false
213215
trendingInstance = instance
214216
215217
store.commit('setTrendingCache', { value: results, page: currentTab.value })
@@ -226,21 +228,21 @@ async function getTrendingInfoLocal() {
226228
showToast(t('Falling back to Invidious API'))
227229
getTrendingInfoInvidious()
228230
} else {
229-
isLoading.value = false
231+
isLoading.value[currentTab.value] = false
230232
}
231233
}
232234
}
233235
234236
function getTrendingInfoInvidious() {
235-
isLoading.value = true
237+
isLoading.value[currentTab.value] = true
236238
237239
getInvidiousTrending(currentTab.value, region.value).then((items) => {
238240
if (!items) {
239241
return
240242
}
241243
242244
shownResults.value = items
243-
isLoading.value = false
245+
isLoading.value[currentTab.value] = false
244246
store.commit('setTrendingCache', { value: items, page: currentTab.value })
245247
nextTick(() => {
246248
focusTab(currentTab.value)
@@ -256,7 +258,7 @@ function getTrendingInfoInvidious() {
256258
showToast(t('Falling back to Local API'))
257259
getTrendingInfoLocal()
258260
} else {
259-
isLoading.value = false
261+
isLoading.value[currentTab.value] = false
260262
}
261263
})
262264
}
@@ -332,7 +334,7 @@ function keyboardShortcutHandler(event) {
332334
switch (event.key.toLowerCase()) {
333335
case 'f5':
334336
case KeyboardShortcuts.APP.SITUATIONAL.REFRESH:
335-
if (!isLoading.value) {
337+
if (!isLoading.value[currentTab.value]) {
336338
getTrendingInfo(true)
337339
}
338340
break

src/renderer/views/Watch/Watch.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ export default defineComponent({
416416
// extract localised title first and fall back to the not localised one
417417
this.videoTitle = result.primary_info?.title.text ?? result.basic_info.title
418418
this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : null)
419+
this.license = result.secondary_info.metadata.rows.find(element => element.title?.text === 'License')?.contents[0]?.text
419420

420421
this.channelId = result.basic_info.channel_id ?? result.secondary_info.owner?.author.id
421422
this.channelName = result.basic_info.author ?? result.secondary_info.owner?.author.name

src/renderer/views/Watch/Watch.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
v-if="!isLoading && !hideVideoDescription"
170170
:description="videoDescription"
171171
:description-html="videoDescriptionHtml"
172+
:license="license"
172173
class="watchVideo"
173174
:class="{ theatreWatchVideo: useTheatreMode }"
174175
@timestamp-event="changeTimestamp"

0 commit comments

Comments
 (0)