Add encrypted backup generation and restore with progress tracking#3
Add encrypted backup generation and restore with progress tracking#3
Conversation
Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>
Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>
Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>
|
@copilot Please continue to implement the logic for re-importing the backup. Please note that this operation should be divided into the following steps:
Note that the permissions controlling export and import are named "export_backup" and "import_backup" respectively. |
Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>
Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>
Implemented the complete backup import/restore functionality as requested: Commit: 234228f Implementation:
Permissions:
Testing: Complete backup→clear→restore cycle verified with data integrity checks. Documentation: See BACKUP_IMPORT.md for complete API reference and client flow examples. |
Implements complete backup and restore system that exports and imports database entries (documents, folders, revisions, access rules) and associated files using AES-256-CBC encrypted archives with separate key storage.
Changes
Backup Export
include/util/backup.py: Backup generation utilityinclude/handlers/management/system.py:RequestGenerateBackupHandlerexport_backuppermissionbackup_nameparameterBackup Import/Restore
include/util/backup.py: Backup restore utilityinclude/database/models/file.py:BackupTaskmodelinclude/handlers/management/system.py: Import request handlersRequestInitiateBackupImportHandler: Creates file upload tasksRequestStartBackupImportHandler: Begins async import processingRequestGetBackupImportStatusHandler: Queries import progressAPI Integration
include/connection_handler.py: Registered actionsgenerate_backup: Export backupinitiate_backup_import: Setup file uploadsstart_backup_import: Begin importget_backup_import_status: Query progressArchive Structure
Import Process Flow
Step 1: Initiate - Client requests import, server creates upload tasks
{ "action": "initiate_backup_import", "data": {"timeout_seconds": 1800}, "username": "admin", "token": "<token>" } // Returns: backup_task_id, archive_task_id, key_task_idStep 2: Upload - Client uploads files using existing transfer mechanism
{ "action": "upload_file", "data": {"task_id": "<archive_task_id>"}, "username": "admin", "token": "<token>" } // Upload encrypted archive chunks, then key fileStep 3: Start - Client starts import, server processes in background
{ "action": "start_backup_import", "data": {"backup_task_id": "<backup_task_id>"}, "username": "admin", "token": "<token>" } // Returns immediately, import runs asynchronouslyProgress Monitoring - Poll status or wait for broadcast notification
{ "action": "get_backup_import_status", "data": {"backup_task_id": "<backup_task_id>"}, "username": "admin", "token": "<token>" } // Returns: status, current_step, progress_percent, countsFeatures
Permissions
export_backup: Generate backup archivesimport_backup: Import and restore backupsTesting
See BACKUP_IMPORT.md for complete API reference and usage examples.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.