mirror of
				https://github.com/kevinveenbirkenbach/splitted-secret.git
				synced 2025-11-04 11:18:03 +00:00 
			
		
		
		
	Optimized cleanup for encryption
This commit is contained in:
		@@ -4,13 +4,16 @@ class Cleanup():
 | 
			
		||||
    def __init__(self,cli,paths):
 | 
			
		||||
        self.cli = cli
 | 
			
		||||
        self.paths = paths
 | 
			
		||||
        
 | 
			
		||||
    def getAllFilePaths(self,file_type):
 | 
			
		||||
        all_file_paths = [
 | 
			
		||||
    
 | 
			
		||||
    def getMetaFilePaths(self,file_type):    
 | 
			
		||||
        return [
 | 
			
		||||
            self.paths.getGroupFilesFolderPath(file_type),
 | 
			
		||||
            self.paths.getUserFilesPath(file_type),
 | 
			
		||||
            self.paths.getAccumulatedFilePath(file_type)
 | 
			
		||||
            ]
 | 
			
		||||
        ]
 | 
			
		||||
    
 | 
			
		||||
    def getAllFilePaths(self,file_type):
 | 
			
		||||
        all_file_paths = self.getMetaFilePaths(file_type)
 | 
			
		||||
        if file_type == Paths.TYPE_DECRYPTED:
 | 
			
		||||
            all_file_paths.append(self.paths.getDecryptedMainDataStandartFolder())
 | 
			
		||||
        return all_file_paths
 | 
			
		||||
@@ -32,6 +35,10 @@ class Cleanup():
 | 
			
		||||
            pass
 | 
			
		||||
        self.cleanupFiles(Paths.TYPE_DECRYPTED)
 | 
			
		||||
 | 
			
		||||
    def cleanupMetaData(self,file_type):
 | 
			
		||||
        for folder_path in self.getMetaFilePaths(file_type):
 | 
			
		||||
            self.deleteAllFilesInFolder(folder_path)
 | 
			
		||||
 | 
			
		||||
    def deleteAll(self):
 | 
			
		||||
        self.cleanupFiles(Paths.TYPE_ENCRYPTED)
 | 
			
		||||
        self.cleanupFiles(Paths.TYPE_DECRYPTED)
 | 
			
		||||
@@ -166,6 +166,8 @@ try:
 | 
			
		||||
                        encrypt.addInformationToUser(user_id, label, str(input()))
 | 
			
		||||
            encrypt.compileData()
 | 
			
		||||
            if args.meta_data is True:
 | 
			
		||||
                print('Cleaning up encrypted meta data.')
 | 
			
		||||
                cleanup.cleanupMetaData(Paths.TYPE_ENCRYPTED)
 | 
			
		||||
                print("Create and encrypt meta data.")
 | 
			
		||||
                encrypt.encryptMetaData()
 | 
			
		||||
            if args.input_directory is not None:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user