Пример #1
0
 def open_restore_files(self):
     email = config["meta"]["email"]
     if verify_password(email):
         password = get_password_from_keyring()
         computer_id = config["meta"]["computer_id"]
         dialog = RestoreDialog(email, password, computer_id)
         dialog.exec()
Пример #2
0
 def has_other_computers(self):
     email = config["meta"]["email"]
     password = get_password_from_keyring()
     computers = get_computers(email, password)
     if computers:
         return len(computers) > 1
     return False
Пример #3
0
 def restore_different_computer(self):
     email = config["meta"]["email"]
     if verify_password(email):
         password = get_password_from_keyring()
         choose_computer_dialog = ChooseComputerDialog(
             email,
             password,
             "Choose the computer you want to restore from.",
         )
         if choose_computer_dialog.exec():
             computer_id = choose_computer_dialog.computer_id
             dialog = RestoreDialog(email, password, computer_id)
             dialog.exec()
Пример #4
0
    def pre_backup(self):
        self.process = None
        self.backup_terminated = False
        self.initial_selected_files = get_selected_files()

        self.update_client_version()

        self.update_status(current_status="Preparing for backup")
        self.write_inclusion_exclusion_files()

        email = config["meta"]["email"]
        password = get_password_from_keyring()
        computer = get_computer(email, password, config["meta"]["computer_id"])

        if not computer:
            raise ApiError()

        return password, computer
Пример #5
0
 def inherit_backup_history(self):
     email = config["meta"]["email"]
     if verify_password(email):
         password = get_password_from_keyring()
         choose_computer_dialog = ChooseComputerDialog(
             email,
             password,
             "Choose the computer to inherit backup history from.",
         )
         if choose_computer_dialog.exec():
             computer_id = choose_computer_dialog.computer_id
             computer = get_computer(email, password, computer_id)
             computer_name = computer["name"]
             reply = QMessageBox.information(
                 self,
                 "Inherit Backup History?",
                 f"You are about to inherit the backup history of the computer '{computer_name}'. Your current computer's backups will be replaced by the backups of '{computer_name}'. This is an irreversible operation. Continue?",
                 QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
                 QMessageBox.StandardButton.No,
             )
             if reply == QMessageBox.StandardButton.Yes:
                 self.main_window.stop_backup()
                 current_computer_id = config["meta"]["computer_id"]
                 inherit_computer(email, password, computer_id, current_computer_id)
                 QMessageBox.information(
                     self,
                     "Inherited Backup History",
                     f"Successfully inherited the backup history of '{computer_name}'. Note that settings like inclusions, exclusions, schedule, etc. were not inherited.",
                 )
                 save_last_backed_up(
                     "Backup history inherited. Creating first backup of this computer."
                 )
                 if computer["last_backed_up_at"]:
                     save_selected_files(
                         format_selected_files(
                             int(computer["last_backed_up_num_files"]),
                             int(computer["last_backed_up_size"]),
                         )
                     )
                 self.main_window.toggle_backup()
                 self.reject()
Пример #6
0
import subprocess

from blobbackup.util import RESTIC_PATH, get_restic_env, get_password_from_keyring
from blobbackup.config import config
from blobbackup.api import get_computer

if __name__ == "__main__":
    email = config["meta"]["email"]
    password = get_password_from_keyring()
    computer_id = config["meta"]["computer_id"]
    computer = get_computer(email, password, computer_id)
    subprocess.run(
        [RESTIC_PATH, "stats", "--mode", "raw-data"],
        env=get_restic_env(computer, password),
    )
Пример #7
0
 def update_computer_name_online(self, computer_name):
     computer_id = config["meta"]["computer_id"]
     email = config["meta"]["email"]
     password = get_password_from_keyring()
     update_computer(email, password, computer_id, {"name": computer_name})
Пример #8
0
 def update_computer_helper(self, fields):
     email = config["meta"]["email"]
     password = get_password_from_keyring()
     computer_id = config["meta"]["computer_id"]
     update_computer(email, password, computer_id, fields)