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
This commit is contained in:
Svallinn 2021-04-21 05:09:06 +01:00
parent c4afaaaf06
commit 5f4ea74c16
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
3 changed files with 14 additions and 2 deletions

View File

@ -573,7 +573,8 @@ export default Vue.extend({
} }
}, },
exportFreeTubeSubscriptions: function () { exportFreeTubeSubscriptions: async function () {
await this.compactProfiles()
const userData = app.getPath('userData') const userData = app.getPath('userData')
const subscriptionsDb = `${userData}/profiles.db` const subscriptionsDb = `${userData}/profiles.db`
const date = new Date() 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 userData = app.getPath('userData')
const historyDb = `${userData}/history.db` const historyDb = `${userData}/history.db`
const date = new Date() const date = new Date()
@ -1106,8 +1108,10 @@ export default Vue.extend({
...mapActions([ ...mapActions([
'invidiousAPICall', 'invidiousAPICall',
'updateProfile', 'updateProfile',
'compactProfiles',
'updateShowProgressBar', 'updateShowProgressBar',
'updateHistory', 'updateHistory',
'compactHistory',
'showToast', 'showToast',
'getRandomColor', 'getRandomColor',
'calculateColorLuminance' 'calculateColorLuminance'

View File

@ -76,6 +76,10 @@ const actions = {
dispatch('grabHistory') dispatch('grabHistory')
} }
}) })
},
compactHistory (_) {
historyDb.persistence.compactDatafile()
} }
} }

View File

@ -141,6 +141,10 @@ const actions = {
}) })
}, },
compactProfiles (_) {
profileDb.persistence.compactDatafile()
},
updateActiveProfile ({ commit }, index) { updateActiveProfile ({ commit }, index) {
commit('setActiveProfile', index) commit('setActiveProfile', index)
} }