From 5f4ea74c162ffb3df812719723ffc9a1b30cafa8 Mon Sep 17 00:00:00 2001 From: Svallinn <41585298+Svallinn@users.noreply.github.com> Date: Wed, 21 Apr 2021 05:09:06 +0100 Subject: [PATCH] Prevent deleted history and profile data from being exported Closes: #934, #937 This assures that the profiles and history datastores are properly compacted before their respective exports --- src/renderer/components/data-settings/data-settings.js | 8 ++++++-- src/renderer/store/modules/history.js | 4 ++++ src/renderer/store/modules/profile.js | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/data-settings/data-settings.js b/src/renderer/components/data-settings/data-settings.js index 07a70744..eb99a75b 100644 --- a/src/renderer/components/data-settings/data-settings.js +++ b/src/renderer/components/data-settings/data-settings.js @@ -573,7 +573,8 @@ export default Vue.extend({ } }, - exportFreeTubeSubscriptions: function () { + exportFreeTubeSubscriptions: async function () { + await this.compactProfiles() const userData = app.getPath('userData') const subscriptionsDb = `${userData}/profiles.db` const date = new Date() @@ -949,7 +950,8 @@ export default Vue.extend({ }) }, - exportHistory: function () { + exportHistory: async function () { + await this.compactHistory() const userData = app.getPath('userData') const historyDb = `${userData}/history.db` const date = new Date() @@ -1106,8 +1108,10 @@ export default Vue.extend({ ...mapActions([ 'invidiousAPICall', 'updateProfile', + 'compactProfiles', 'updateShowProgressBar', 'updateHistory', + 'compactHistory', 'showToast', 'getRandomColor', 'calculateColorLuminance' diff --git a/src/renderer/store/modules/history.js b/src/renderer/store/modules/history.js index 3869c0c5..ca0ca742 100644 --- a/src/renderer/store/modules/history.js +++ b/src/renderer/store/modules/history.js @@ -76,6 +76,10 @@ const actions = { dispatch('grabHistory') } }) + }, + + compactHistory (_) { + historyDb.persistence.compactDatafile() } } diff --git a/src/renderer/store/modules/profile.js b/src/renderer/store/modules/profile.js index f190673b..141db832 100644 --- a/src/renderer/store/modules/profile.js +++ b/src/renderer/store/modules/profile.js @@ -141,6 +141,10 @@ const actions = { }) }, + compactProfiles (_) { + profileDb.persistence.compactDatafile() + }, + updateActiveProfile ({ commit }, index) { commit('setActiveProfile', index) }