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:
		
							parent
							
								
									c4afaaaf06
								
							
						
					
					
						commit
						5f4ea74c16
					
				| 
						 | 
					@ -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'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,6 +76,10 @@ const actions = {
 | 
				
			||||||
        dispatch('grabHistory')
 | 
					        dispatch('grabHistory')
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  compactHistory (_) {
 | 
				
			||||||
 | 
					    historyDb.persistence.compactDatafile()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,6 +141,10 @@ const actions = {
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  compactProfiles (_) {
 | 
				
			||||||
 | 
					    profileDb.persistence.compactDatafile()
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  updateActiveProfile ({ commit }, index) {
 | 
					  updateActiveProfile ({ commit }, index) {
 | 
				
			||||||
    commit('setActiveProfile', index)
 | 
					    commit('setActiveProfile', index)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue