fluidd-core / fluidd

Fluidd, the klipper UI.
https://docs.fluidd.xyz
GNU General Public License v3.0
1.33k stars 398 forks source link

feat: backup and restore settings #1427

Closed pedrolamas closed 2 months ago

pedrolamas commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

Following the comments, I made output filename is now "backupfluidd_.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!

Escrich commented 2 weeks ago

Good Job!, great job!