Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: backup and restore settings #1427

Merged

Conversation

pedrolamas
Copy link
Member

@pedrolamas pedrolamas commented Apr 29, 2024

Add a new Backup and Restore buttons to easily export and import Fluidd settings across multiple printers.

As a first implementation, this will backup/restore ALL Fluidd settings (there is no selections of specific parts of the settings).

image

Resolve #1113

@pedrolamas pedrolamas added the FR - Enhancement New feature or request label Apr 29, 2024
@pedrolamas pedrolamas added this to the 1.29.2 milestone Apr 29, 2024
@pedrolamas pedrolamas requested a review from matmen April 29, 2024 19:11
@pedrolamas pedrolamas force-pushed the pedrolamas/backup-restore-settings branch 2 times, most recently from 57958d8 to 57d6feb Compare April 30, 2024 09:27
@pedrolamas pedrolamas force-pushed the pedrolamas/backup-restore-settings branch from 57d6feb to 678a3b0 Compare April 30, 2024 14:30
matmen
matmen previously approved these changes Apr 30, 2024
Copy link
Member

@matmen matmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM functionality wise, but what do you think of adding an additional key to the export (e.g. "fluidd": "v1.2.3") and using it to check if the selected backup file actually is a fluidd config export before restoring it?

@pedrolamas
Copy link
Member Author

I like the idea of adding the version to it, that makes complete sense to me!

Confirming if it is a Fluidd backup or not is tricky, as this is just a JSON file... granted we could have some schema to check against but that makes versioning very tricky!

@matmen
Copy link
Member

matmen commented Apr 30, 2024

Well, using a fluidd key we could at least check if that's there - not a high chance a random json file will have one ;) No need to validate the entire schema IMO

@pedrolamas
Copy link
Member Author

Well, using a fluidd key we could at least check if that's there - not a high chance a random json file will have one ;) No need to validate the entire schema IMO

Agreed! 🙂

@pedrolamas
Copy link
Member Author

pedrolamas commented Apr 30, 2024

Following the comments, I made output filename is now "backup_fluidd__.json"

The JSON blob is now using this format:

{
  "meta": {
    "app": "Fluidd",
    "version": "1.2.3",
    "type": "settings-backup"
  },
  "data": {}
}

We will verify that meta.app === 'Fluidd' and that meta.type === 'settings-backup' so that we can match the expected format!

Should be enough to validate the expected format and that version will allow us flexibility in the future if we want to!

Copy link
Member

@matmen matmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pedrolamas pedrolamas merged commit 5029dab into fluidd-core:develop Apr 30, 2024
4 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/backup-restore-settings branch April 30, 2024 17:32
@Escrich
Copy link

Escrich commented Jun 14, 2024

Good Job!, great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FR - Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export the configuration file of Fluidd for easy recovery when reinstalling
3 participants