Skip to content

Commit 8ef7b92

Browse files
committed
Merge branch 'development' into feature/subscription-cache
* development: (29 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 58c6b19 + 3529520 commit 8ef7b92

34 files changed

+1709
-718
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
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,7 +87,7 @@
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.2",
90+
"electron": "^32.1.0",
9191
"electron-builder": "^25.0.5",
9292
"eslint": "^8.57.0",
9393
"eslint-config-prettier": "^9.1.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.45",
110+
"postcss": "^8.4.47",
111111
"postcss-scss": "^4.0.9",
112112
"prettier": "^2.8.8",
113113
"rimraf": "^6.0.1",
114114
"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",

src/constants.js

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

5555
HISTORY: {
56+
OVERWRITE: 'db-action-history-overwrite',
5657
UPDATE_WATCH_PROGRESS: 'db-action-history-update-watch-progress',
5758
UPDATE_PLAYLIST: 'db-action-history-update-playlist',
5859
},
@@ -88,6 +89,7 @@ const SyncEvents = {
8889
},
8990

9091
HISTORY: {
92+
OVERWRITE: 'sync-history-overwrite',
9193
UPDATE_WATCH_PROGRESS: 'sync-history-update-watch-progress',
9294
UPDATE_PLAYLIST: 'sync-history-update-playlist',
9395
},

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/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-shaka-video-player/ft-shaka-video-player.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@
3737
flex-direction: column-reverse;
3838
}
3939

40-
/*
41-
With the legacy formats, shaka hands over the captions to the browser,
42-
that causes issues like the captions being displayed under the player controls.
43-
The browser positions captions based on the video element as it doesn't know about shaka's custom controls.
44-
To solve that we use shaka's caption displayer (UITextDisplayer), so we need to hide the browser's ones
45-
*/
46-
.player::-webkit-media-text-track-container {
47-
display: none;
48-
}
49-
5040
.sixteenByNine {
5141
aspect-ratio: 16 / 9;
5242
}

0 commit comments

Comments
 (0)