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

Desktop: Resolves #9857: Back up to a subdirectory of the home directory by default #9942

Merged

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Feb 15, 2024

Summary

Updates the built-in Simple Backup plugin to apply the following upstream pull requests:

Resolves #9857.

Testing

Manual testing:

  1. Start an existing installation of Joplin with the default backup plugin installed
  2. Verify that the "create subfolder for Joplin profile" setting is unchecked (in Simple Backup's advanced settings)
  3. Verify that a README.md file is created in the existing backup directory (if using the new setting, ~/JoplinBackup/default/... or ~/JoplinBackup/default-dev/..., otherwise, may be in a subdirectory of the profile directory)
  4. Close Joplin
  5. Remove the profile directory
  6. Start Joplin
  7. Create a backup
  8. Verify that the backup is created in the home directory
  9. Create a new profile
  10. Create a backup from that profile
    • A notebooke/note may need to be created first
  11. Verify that the backup is created in a subdirectory of JoplinBackup in the home directory (e.g. /home/user/JoplinBackup/profile-a5ix52ns)
  12. Restore from all_notebooks.jex in the profile's backup directory with file > import JEX

Note: The latest commit has only been tested on OpenSUSE (dev mode).

The above tests testing have also been done with commit 2e7b466 on:

  • Ubuntu 23.10 (dev mode)
  • MacOS (dev mode)
  • Windows 11 (dev mode)

It has also been verified (commit 2e7b466) that Joplin Portable launches on Windows and Simple Backup is still initially disabled. After enabling it, backups seem to be created in the profile directory.

Possible to-dos/considerations

  • Currently, devmode and production mode backups will use the same JoplinBackup directory and may overwrite one another (as both use default as the ID of the default profile).
    • Fixed by adding a -dev to the end of the backup directory (e.g. ~/JoplinBackup/default-dev) when Joplin is in dev mode.
  • What happens when a user has both a snap version of Joplin and an AppImage version? Do they both back up to the same place?
    • I suspect that the snap version will back up to a hidden home directory in /home/primary/user/joplin-desktop/[[version here]]/, which will likely be difficult to restore from. Something similar may be true with the Flatpak.

@@ -146,6 +146,7 @@ export interface Constants {
pluginDataDir: string;
cacheDir: string;
pluginDir: string;
homeDir: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure that homeDir is the best name for this setting...

Currently, homeDir points to os.homedir() only when not using the portable application (or the --profile flag).

@personalizedrefrigerator personalizedrefrigerator marked this pull request as draft February 17, 2024 15:46
@personalizedrefrigerator
Copy link
Collaborator Author

personalizedrefrigerator commented Feb 17, 2024

Converting to a draft for the next several hours — feedback was given on the upstream pull requests. I plan to make changes requested by that feedback and apply the changes here. Edit: Done. Now waiting for additional feedback.

@personalizedrefrigerator personalizedrefrigerator marked this pull request as ready for review February 19, 2024 14:17
@personalizedrefrigerator
Copy link
Collaborator Author

personalizedrefrigerator commented Feb 19, 2024

TODO:

  • Fix merge conflicts upstream, wait about 1 day. Notify @ JackGruber.

@personalizedrefrigerator
Copy link
Collaborator Author

personalizedrefrigerator commented Feb 22, 2024

Upstream pull requests have been merged! I'm in the process of updating and testing this PR! This should be done in the next hour or two.

@laurent22
Copy link
Owner

Great, thanks for the update! And thanks @JackGruber for reviewing and merging the pull requests!

@laurent22 laurent22 merged commit e5e1911 into laurent22:dev Feb 22, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backup Plugin: Backup to a subdirectory of the home directory by default
2 participants