Skip to content

Commit 47222b9

Browse files
committed
Merge branch 'development' into feature/history/remember-search-query
* development: (74 commits) Translated using Weblate (Flemish (West)) Added translation using Weblate (Flemish (West)) Translated using Weblate (Slovak) Improve history import performance and fix some bugs (FreeTubeApp#5666) Bump electron from 32.0.2 to 32.1.0 (FreeTubeApp#5710) Local API: Use IOS HLS manifest for livestreams (FreeTubeApp#5705) Translated using Weblate (Slovak) Translated using Weblate (Japanese) Bump the stylelint group with 2 updates (FreeTubeApp#5706) Bump swiper from 11.1.12 to 11.1.14 (FreeTubeApp#5709) Fix a few memory leaks while tearing down the player (FreeTubeApp#5698) Fix audio track selection (FreeTubeApp#5697) Bump shaka-player from 4.10.12 to 4.11.1 (FreeTubeApp#5677) Translated using Weblate (Czech) Translated using Weblate (Serbian) Translated using Weblate (Polish) Translated using Weblate (German) Translated using Weblate (Chinese (Simplified Han script)) Bump express from 4.19.2 to 4.20.0 (FreeTubeApp#5687) Translated using Weblate (Turkish) ...
2 parents 2f8fa91 + 3529520 commit 47222b9

File tree

113 files changed

+5150
-1637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+5150
-1637
lines changed

.github/workflows/calibreapp-image-actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
compressOnly: true
2121
- name: Create New Pull Request If Needed
2222
if: steps.calibre.outputs.markdown != ''
23-
uses: peter-evans/create-pull-request@v6
23+
uses: peter-evans/create-pull-request@v7
2424
with:
2525
title: Compressed Images Nightly
2626
branch-suffix: timestamp

_scripts/ProcessLocalesPlugin.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ class ProcessLocalesPlugin {
4040
/** @type {(updatedLocales: [string, string][]) => void|null} */
4141
this.notifyLocaleChange = null
4242

43-
if (this.hotReload) {
44-
this.hotReloadScript = readFileSync(`${__dirname}/_hotReloadLocalesScript.js`, 'utf-8')
45-
}
46-
4743
this.loadLocales()
4844
}
4945

5046
/** @param {import('webpack').Compiler} compiler */
5147
apply(compiler) {
5248
const { CachedSource, RawSource } = compiler.webpack.sources;
53-
const { Compilation } = compiler.webpack
49+
const { Compilation, DefinePlugin } = compiler.webpack
50+
51+
new DefinePlugin({
52+
'process.env.HOT_RELOAD_LOCALES': this.hotReload
53+
}).apply(compiler)
5454

5555
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
5656
const IS_DEV_SERVER = !!compiler.watching
@@ -136,19 +136,6 @@ class ProcessLocalesPlugin {
136136
compilation.fileDependencies.addAll(this.filePaths)
137137
}
138138
})
139-
140-
compiler.hooks.emit.tap(PLUGIN_NAME, (compilation) => {
141-
if (this.hotReload) {
142-
// Find generated JavaScript output file (e.g. renderer.js or web.js)
143-
// and inject the code snippet that listens for locale updates and replaces vue-i18n's locales
144-
145-
/** @type {string} */
146-
const filename = [...[...compilation.chunks][0].files]
147-
.find(file => file.endsWith('.js'))
148-
149-
compilation.assets[filename]._source._children.push(`\n${this.hotReloadScript}`)
150-
}
151-
})
152139
}
153140

154141
loadLocales() {

_scripts/_hotReloadLocalesScript.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@
6363
"autolinker": "^4.0.0",
6464
"electron-context-menu": "^4.0.4",
6565
"lodash.debounce": "^4.0.8",
66-
"marked": "^14.1.0",
66+
"marked": "^14.1.2",
6767
"path-browserify": "^1.0.1",
6868
"portal-vue": "^2.1.7",
6969
"process": "^0.11.10",
70-
"shaka-player": "^4.10.12",
71-
"swiper": "^11.1.12",
70+
"shaka-player": "^4.11.1",
71+
"swiper": "^11.1.14",
7272
"vue": "^2.7.16",
7373
"vue-i18n": "^8.28.2",
7474
"vue-observe-visibility": "^1.0.0",
@@ -87,18 +87,18 @@
8787
"copy-webpack-plugin": "^12.0.2",
8888
"css-loader": "^7.1.2",
8989
"css-minimizer-webpack-plugin": "^7.0.0",
90-
"electron": "^32.0.1",
91-
"electron-builder": "^24.13.3",
90+
"electron": "^32.1.0",
91+
"electron-builder": "^25.0.5",
9292
"eslint": "^8.57.0",
9393
"eslint-config-prettier": "^9.1.0",
9494
"eslint-config-standard": "^17.1.0",
95-
"eslint-plugin-import": "^2.29.1",
95+
"eslint-plugin-import": "^2.30.0",
9696
"eslint-plugin-jsonc": "^2.16.0",
9797
"eslint-plugin-n": "^17.10.2",
9898
"eslint-plugin-prettier": "^5.2.1",
9999
"eslint-plugin-promise": "^7.1.0",
100100
"eslint-plugin-unicorn": "^55.0.0",
101-
"eslint-plugin-vue": "^9.27.0",
101+
"eslint-plugin-vue": "^9.28.0",
102102
"eslint-plugin-vuejs-accessibility": "^2.4.1",
103103
"eslint-plugin-yml": "^1.14.0",
104104
"html-webpack-plugin": "^5.6.0",
@@ -107,14 +107,14 @@
107107
"lefthook": "^1.7.15",
108108
"mini-css-extract-plugin": "^2.9.1",
109109
"npm-run-all2": "^6.2.2",
110-
"postcss": "^8.4.44",
110+
"postcss": "^8.4.47",
111111
"postcss-scss": "^4.0.9",
112112
"prettier": "^2.8.8",
113113
"rimraf": "^6.0.1",
114-
"sass": "^1.77.8",
114+
"sass": "^1.78.0",
115115
"sass-loader": "^16.0.1",
116116
"stylelint": "^16.9.0",
117-
"stylelint-config-sass-guidelines": "^12.0.0",
117+
"stylelint-config-sass-guidelines": "^12.1.0",
118118
"stylelint-config-standard": "^36.0.1",
119119
"stylelint-high-performance-animation": "^1.10.0",
120120
"stylelint-use-logical-spec": "^5.0.1",
@@ -124,7 +124,7 @@
124124
"vue-loader": "^15.10.0",
125125
"webpack": "^5.94.0",
126126
"webpack-cli": "^5.1.4",
127-
"webpack-dev-server": "^5.0.4",
127+
"webpack-dev-server": "^5.1.0",
128128
"yaml-eslint-parser": "^1.2.3"
129129
}
130130
}

src/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const DBActions = {
5151
},
5252

5353
HISTORY: {
54+
OVERWRITE: 'db-action-history-overwrite',
5455
UPDATE_WATCH_PROGRESS: 'db-action-history-update-watch-progress',
5556
UPDATE_PLAYLIST: 'db-action-history-update-playlist',
5657
},
@@ -78,6 +79,7 @@ const SyncEvents = {
7879
},
7980

8081
HISTORY: {
82+
OVERWRITE: 'sync-history-overwrite',
8183
UPDATE_WATCH_PROGRESS: 'sync-history-update-watch-progress',
8284
UPDATE_PLAYLIST: 'sync-history-update-playlist',
8385
},

src/datastores/handlers/base.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ class History {
5656
return db.history.updateAsync({ videoId: record.videoId }, record, { upsert: true })
5757
}
5858

59+
static async overwrite(records) {
60+
await db.history.removeAsync({}, { multi: true })
61+
62+
await db.history.insertAsync(records)
63+
}
64+
5965
static updateWatchProgress(videoId, watchProgress) {
6066
return db.history.updateAsync({ videoId }, { $set: { watchProgress } }, { upsert: true })
6167
}

src/datastores/handlers/electron.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ class History {
3232
)
3333
}
3434

35+
static overwrite(records) {
36+
return ipcRenderer.invoke(
37+
IpcChannels.DB_HISTORY,
38+
{ action: DBActions.HISTORY.OVERWRITE, data: records }
39+
)
40+
}
41+
3542
static updateWatchProgress(videoId, watchProgress) {
3643
return ipcRenderer.invoke(
3744
IpcChannels.DB_HISTORY,

src/datastores/handlers/web.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class History {
2929
return baseHandlers.history.upsert(record)
3030
}
3131

32+
static overwrite(records) {
33+
return baseHandlers.history.overwrite(records)
34+
}
35+
3236
static updateWatchProgress(videoId, watchProgress) {
3337
return baseHandlers.history.updateWatchProgress(videoId, watchProgress)
3438
}

src/main/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,15 @@ function runApp() {
10751075
)
10761076
return null
10771077

1078+
case DBActions.HISTORY.OVERWRITE:
1079+
await baseHandlers.history.overwrite(data)
1080+
syncOtherWindows(
1081+
IpcChannels.SYNC_HISTORY,
1082+
event,
1083+
{ event: SyncEvents.HISTORY.OVERWRITE, data }
1084+
)
1085+
return null
1086+
10781087
case DBActions.HISTORY.UPDATE_WATCH_PROGRESS:
10791088
await baseHandlers.history.updateWatchProgress(data.videoId, data.watchProgress)
10801089
syncOtherWindows(

src/renderer/App.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,17 @@ export default defineComponent({
453453
break
454454
}
455455

456+
case 'post': {
457+
const { postId, query } = result
458+
459+
openInternalPath({
460+
path: `/post/${postId}`,
461+
query,
462+
doCreateNewWindow
463+
})
464+
break
465+
}
466+
456467
case 'channel': {
457468
const { channelId, subPath, url } = result
458469

src/renderer/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
>
2424
<span
2525
class="changeLogText"
26+
lang="en"
2627
v-html="updateChangelog"
2728
/>
2829
<ft-flex-box>

src/renderer/components/data-settings/data-settings.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export default defineComponent({
5050
allPlaylists: function () {
5151
return this.$store.getters.getAllPlaylists
5252
},
53+
historyCacheById: function () {
54+
return this.$store.getters.getHistoryCacheById
55+
},
5356
historyCacheSorted: function () {
5457
return this.$store.getters.getHistoryCacheSorted
5558
},
@@ -616,7 +619,7 @@ export default defineComponent({
616619
})
617620
},
618621

619-
importFreeTubeHistory(textDecode) {
622+
async importFreeTubeHistory(textDecode) {
620623
textDecode.pop()
621624

622625
const requiredKeys = [
@@ -630,20 +633,24 @@ export default defineComponent({
630633
'title',
631634
'type',
632635
'videoId',
633-
'viewCount',
634636
'watchProgress',
635637
]
636638

637639
const optionalKeys = [
638640
// `_id` absent if marked as watched manually
639641
'_id',
640642
'lastViewedPlaylistId',
643+
'lastViewedPlaylistItemId',
644+
'lastViewedPlaylistType',
645+
'viewCount',
641646
]
642647

643648
const ignoredKeys = [
644649
'paid',
645650
]
646651

652+
const historyItems = new Map(Object.entries(this.historyCacheById))
653+
647654
textDecode.forEach((history) => {
648655
const historyData = JSON.parse(history)
649656
// We would technically already be done by the time the data is parsed,
@@ -667,14 +674,16 @@ export default defineComponent({
667674
showToast(this.$t('Settings.Data Settings.History object has insufficient data, skipping item'))
668675
console.error('Missing Keys: ', missingKeys, historyData)
669676
} else {
670-
this.updateHistory(historyObject)
677+
historyItems.set(historyObject.videoId, historyObject)
671678
}
672679
})
673680

681+
await this.overwriteHistory(historyItems)
682+
674683
showToast(this.$t('Settings.Data Settings.All watched history has been successfully imported'))
675684
},
676685

677-
importYouTubeHistory(historyData) {
686+
async importYouTubeHistory(historyData) {
678687
const filterPredicate = item =>
679688
item.products.includes('YouTube') &&
680689
item.titleUrl != null && // removed video doesnt contain url...
@@ -722,6 +731,8 @@ export default defineComponent({
722731
'activityControls',
723732
].concat(Object.keys(keyMapping))
724733

734+
const historyItems = new Map(Object.entries(this.historyCacheById))
735+
725736
filteredHistoryData.forEach(element => {
726737
const historyObject = {}
727738

@@ -750,10 +761,12 @@ export default defineComponent({
750761
historyObject.watchProgress = 1
751762
historyObject.isLive = false
752763

753-
this.updateHistory(historyObject)
764+
historyItems.set(historyObject.videoId, historyObject)
754765
}
755766
})
756767

768+
await this.overwriteHistory(historyItems)
769+
757770
showToast(this.$t('Settings.Data Settings.All watched history has been successfully imported'))
758771
},
759772

@@ -1069,10 +1082,10 @@ export default defineComponent({
10691082
...mapActions([
10701083
'updateProfile',
10711084
'updateShowProgressBar',
1072-
'updateHistory',
10731085
'addPlaylist',
10741086
'addVideo',
10751087
'updatePlaylist',
1088+
'overwriteHistory'
10761089
]),
10771090

10781091
...mapMutations([

src/renderer/components/ft-community-post/ft-community-post.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import autolinker from 'autolinker'
77

88
import { A11y, Navigation, Pagination } from 'swiper/modules'
99

10-
import { createWebURL, deepCopy, toLocalePublicationString } from '../../helpers/utils'
10+
import { createWebURL, deepCopy, formatNumber, toLocalePublicationString } from '../../helpers/utils'
1111
import { youtubeImageUrlToInvidious } from '../../helpers/api/invidious'
1212

1313
export default defineComponent({
@@ -29,17 +29,23 @@ export default defineComponent({
2929
hideForbiddenTitles: {
3030
type: Boolean,
3131
default: true
32-
}
32+
},
33+
singlePost: {
34+
type: Boolean,
35+
default: false
36+
},
3337
},
3438
data: function () {
3539
return {
3640
postText: '',
3741
postId: '',
3842
authorThumbnails: null,
3943
publishedText: '',
40-
voteCount: '',
44+
voteCount: 0,
45+
formattedVoteCount: '',
4146
postContent: '',
42-
commentCount: '',
47+
commentCount: null,
48+
formattedCommentCount: '',
4349
author: '',
4450
authorId: '',
4551
}
@@ -56,6 +62,16 @@ export default defineComponent({
5662

5763
hideVideo() {
5864
return this.forbiddenTitles.some((text) => this.data.postContent.content.title?.toLowerCase().includes(text.toLowerCase()))
65+
},
66+
67+
backendPreference: function () {
68+
return this.$store.getters.getBackendPreference
69+
},
70+
backendFallback: function () {
71+
return this.$store.getters.getBackendFallback
72+
},
73+
isInvidiousAllowed: function() {
74+
return this.backendPreference === 'invidious' || this.backendFallback
5975
}
6076
},
6177
created: function () {
@@ -127,7 +143,9 @@ export default defineComponent({
127143
isRSS: this.data.isRSS
128144
})
129145
this.voteCount = this.data.voteCount
146+
this.formattedVoteCount = formatNumber(this.voteCount)
130147
this.commentCount = this.data.commentCount
148+
this.formattedCommentCount = formatNumber(this.commentCount)
131149
this.type = (this.data.postContent !== null && this.data.postContent !== undefined) ? this.data.postContent.type : 'text'
132150
this.author = this.data.author
133151
this.authorId = this.data.authorId

0 commit comments

Comments
 (0)