kbin-kes icon indicating copy to clipboard operation
kbin-kes copied to clipboard

[FEAT] Add version headers to settings backup file

Open aclist opened this issue 9 months ago • 0 comments

Browser

Firefox-based

Script manager

Greasemonkey

KES version

5.0.0-beta.6

Describe the feature

When introducing breaking changes to the way settings are serialized and restored, it may be necessary to test the user's backup file for compatibility with the current MES version. Obviously, such breaking changes should be kept to a minimum, but if the user's backup file is so old that it contains a drastically different settings format, it's not going to be possible to import that JSON object in the expected way.

Additional headers should be introduced at the top of the settings JSON that list the version number these settings were exported with. This way, when rolling out breaking changes to the restore routine or fundamentally changing how settings are stored, we can test if the incoming file satisfies the minimum required version.

If the version is < X.X.X, reject the import process and draw a dialog stating that this backup file is too out of date.

Requirements

  • Add a version key to the outgoing JSON file
  • Add a function that splits a semver version string into integers
  • Add a supportedVersion variable that sets the minimum allowable version
  • Add a test to parseImportedFile() that tests for a minimum version
  • For convenience, add a custom dialog class with inheritances (FailDialog extends Dialog)
  • Pop a Dialog indicating failure that requires confirmation
  • Use the above dialog logic for a successful import, too, in lieu of native alert() dialogs

aclist avatar Mar 18 '25 09:03 aclist