Coder Social home page Coder Social logo

cgcel / obsidian-local-backup Goto Github PK

View Code? Open in Web Editor NEW
37.0 2.0 1.0 737 KB

Automatically creates a local backup of the vault.

License: MIT License

JavaScript 4.48% TypeScript 94.92% CSS 0.60%
obsidian obsidian-plugin obsidian-vault backup lifecycle interval-backups

obsidian-local-backup's Introduction

Local Backup

GitHub Github all releases GitLab latest release CodeQL

Automatically creates a local backup of the vault.

Features

  • Backup on startup
  • Setup backups' lifecycle
  • Customize output path
  • Interval backups
  • Backup by calling archiver (7-Zip, WinRAR, Bandizip)
  • Retry after failures
  • Create specific file

How to use

Setup the plugin

General Settings

general-settings

Hints
  1. Setup the output path depends on your computer platform.
  2. Setup the Windows and Unix output path while you using these two platforms.

If you turn on interval backups, it is recommended to set a reasonable bakcup frequency, e.g. >=10min, this plugin costs CPU resources and Disk I/O resources, backup frequently might cause lagging.

File Archiver Settings (Optional)

file-archiver-settings

Hints
  1. (Experimental) If you have a large size vault and Obsidian stucks on backing up, please try the experimental feature in setting page.

For user who owns a vault with large size, it is recommended to turn on Backup by calling external file archiver in setting page, the experimental feature of the latest version, then setup the rest of settings of archiver.

Run a local backup command

Command panel

Enter the command panel using Ctrl + P.

run-command

Create a specific backup

As you can see in the command panel screenshot above, you are available to create a specific backup file if you want to keep the file. The file created by this command would not delete by the plugin. But you have to name it different from the File name setting. (eg. File name: dev-Backup-%Y_%m_%d-%H_%M_%S, and your specific file name should not be the same format as File name).

Sidebar icon

Click the sidebar icon.

sidebar-icon

Installation

Install from plugin store

  • Search Local Backup at Obsidian Community Plugins and install it.
  • Enable Local Backup.
  • Setup Local Backup.
  • Apply settings or restart Obsidian.
  • Enjoy! ๐ŸŽ‰

Manually installing the plugin

  • Copy over main.js, styles.css, manifest.json to your vault VaultFolder/.obsidian/plugins/your-plugin-id/.
  • Open Obsidian and enable Local Backup.
  • Follow the guiding above.

Contributing

Build

Code contributing is welcome! Just make a PR to master branch directly:)

  • Clone this repo.
  • Make sure your NodeJS is at least v16 (node --version).
  • npm i or yarn to install dependencies.
  • npm run dev to start compilation in watch mode.
  • npm run build to build the main.js in ./build.

Reference

Sponsor this project

You could consider buy me a coffee if the plugin saves your time!

Buy Me A Coffee

License

Obsidian Local Backup is licensed under the MIT license. Refer to LICENSE for more information.

obsidian-local-backup's People

Contributors

cgcel avatar decaf-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

decaf-dev

obsidian-local-backup's Issues

[REFACTOR] Confusing naming in English

Problem

Some of the titles and descriptions do not make sense to me as a native English speaker

image image image image

Suggestions

  • "Backup history length" - "Specify the number of days backups should be retained"
  • "File name" - "Name of the backup ZIP file"
  • "Interval backups" - Enable to create backups at regular intervals
  • "Backup frequency" - Set the frequency of backups in minutes

Use of environment variables in backup path

Hello
I'd like to backup my vault on different computers with different backup paths.
I tried to create an environment variable %obsidian_backup_path% but it seems that your local backup can't parse this.

Does anybody have an idea how to define different backup paths?
Yes, I sync my plugins and I think I can't turn off the sync for just one plugin. That would be a solution as well.

Thanks
Daniel

[FEAT] Console log statements spam the console

Problem

I do a lot of plugin development for Obsidian.md, so I frequently open the console. I would like to disable console log messages for this plugin.

Solution

Add a setting that will enable/disable console log statements. Something like Enable debug messages. or Enable log messages

Error EISDIR

Hi,

I am getting the error "Failed to create vault backup after 1 attempts: Error: EISDIR: illegal operation on a directory, read"

Any thoughts?

Thank you

Implement MacOS/UNIX Filesystem support

Hi,

Could you please implement support for MacOS filesystems?

Right now you can only set one output path. On my Windows 10 machine I have set a custom output path, but when the plugin and configuration sync to my MacOS machine the plugin does not work as the file output path is not the same structure since MacOS uses a UNIX filesystem structure.

A solution would be to convert the user inputted output path to the operating system file path structure.

Thanks!
Matt

Plugin tab is duplicated when "Apply settings" is pressed

Problem

When I click "Apply Settings" on desktop, another tab is produced in the plugin list for some reason
image

Solution

I am not sure what is causing this.

EDIT: it seem like it is await this.plugin.onload(); that is being called on the button click. I don't think this plugin is meant to be called like this.

Failed to create vault backup error

Failed to create vault backup after 1
attempts: RangeError
[ERR_CHILD_PROCESS_STDIO_MAXBUFFER]:
stdout maxBuffer length exceeded
proper

even after it shows the error, i can see the backup file made in the local folder.

this is my settings
image

[BUG] For some reason the backed up zip can't be found

Hi there, as the title suggests, for some reason the plugin shows me that "File X was created in X directory" but I can't find those created backups in that directory, even restoring it to default settings won't solve this problem.

This bug applies to backup on start, backup on interval or backup command (command palette).

Obsidian lags on startup

With backups set to run on startup, Obsidian hangs on "Loading plugins". For now, I've switched it off and using 60 minute intervals.

Is it possible to have the Obsidian backup process a little after launching, this way the startup experience is fast, but backup still occurs?

Feature request: disable backup notifications

When periodic backups are enabled, the periodic notification is distracting. And they happen even when the vault is unchanged.

It would be great to be able to disable notifications, or only show them when something goes wrong.

The options pane could show when was the last time the backup ran.

[BUG] Save path isn't updating

My save path isn't updating even though I have changed it. I looked in the data.json file created by the plugin settings and it looks like there's a bunch of duplicates.

I have it set to backups but it still saving in second_brain-backups

I had updated the config and did press "Apply && Save"

image image

[FEAT] Support for file name with custom date

Problem

I would like a custom date format to appear at the end of the file name e.g. my-backup-2023_10_24-12_00

Solution

I think some form of parsing for the % symbol would be good.

For example, in Bash you might have

printf -v date '%(%Y-%m-%d %H:%M:%S)T\n' -1 

Where %Y represents year,
%m represents month,
etc

I think all of the those in the string would be good to implement

  • %Y - year
  • %m - month
  • %d - day
  • %H - hour
  • %M - minute
  • %S - second

If you have another format that you would prefer that would work as well

Feature Request: custom archiver command

I would like to customize the archiver I use.

(Actually I would like to make a plain copy with cp, but I imagine that many people will want slightly different archivers or options; so I guess it'd make sense to allow any arbitrary command)

So, maybe it would be possible to have an option to call a given path, with one argument as the destination directory, and another as the source/s? something like
$CUSTOM_COMMAND $SOURCE $DESTINATION

In this way, anyone can write their own script and have it called by the plugin.

I guess this would also fix e.g. #29 .

[FEAT] Specify number of backups per day to retain

Problem

Right now you can specify the number of days you want backups for, the frequency of backups, but you cannot specify how many backups per day to keep.

For example, if you backup every 30 minutes you will get

  • backup 1 - 10:30 am
  • backup 2 - 11:00 am
  • backup 3 - 11:30 am
    ... until you close Obsidian

This will lead to dozens of backups for a period of 7 days.

Solution

Add an input to specify the number of backups per day to retain.

For example, if I had the value to 1 backup per day with a frequency of backup of 30 minutes

I would get

  • backup 1 - 10:30 am
  • backup 2 - 11:00 am - AND delete backup 1
  • backup 3 - 11:30 am - AND delete backup 2

After 3 days I would have

  • 1 backup from Tuesday
  • 1 backup from Wednesday
  • 1 backup from Thursday

Feature request: 7z arguments?

So, first off, great plugin, it's nice to be able to automatically make an archive of your whole vault.

Now, I don't know if I might just be blind (and there is actually a way to), but I tried to add a few arguments to the 7z path but noticed that it just does this 7z *argument/s* a <archive_name> <vault_path> which obviously makes it fail as a needs to be before the arguments.
I would think it would make sense to be able to add some arguments so that one could specify the threads 7z should use or what password it should put on the archive.

Failed to update

Hi, Obsidian is telling me that there is an update for the plugin but when I try to upload it I encounter an error.

image

Feature Request: Backup once on close

Hi,
I love your plugin and wanted to feedback on a feature I think would improve it. (Apologies if this is not the best way to make a feature request.)
I was wondering if it would be possible to add an option in the plugin settings for running a backup when the application is closed as opposed to when it opens.
This is how several other word-processing applications that I use run their backups, for example, Scrivener. It just makes more sense to me to have a backup of everything as it was when you used it last. (If you used Obsidian for several hours, closed it, and then some time later had a system failure or the local files were corrupted, you would lose all of that work. If a zip backup was created when the application was closed, everything would be backed up.)
Thanks!

Unable to find 7z on Linux, "No such file or directory"

OS: Linux Mint 21.2

In a terminal:

$ whereis 7z
7z: /usr/bin/7z /usr/share/man/man1/7z.1.gz

Then I enable external archiver in settings and set /usr/bin/7z as the file archiver path for Unix. When I make a backup or one is made automatically, I get the "No such file or directory /usr/bin/7z

For me, /usr/bin/7z is a shell script just containing
exec /usr/lib/p7zip/7z, but when I try that path I get the same error

[Feature Request] Handle user created backup differently

Add an option to handle user created backup differently such that, it can be backed up by different name, than default. For example if I am taking a backup before installing a specific plugin. I can name it accordingly while taking backup

An option to keep user generated backups forever and not remove them as per the limits defined in the options

Obsidian hangs on Windows 10

Thanks for your plugin.

I installed it -> I reconfigured it to 0 and tried to restart Obsidian. -> Obsidian freezes. -> I deleted the folder with your plugin -> Obsidian starts.

Unclear: Backup history length (days)

Hi,

It is not clear how the backup's are being made. There is a switch that allows one to specify the days a backup should be retained... but does it do so even when there is only one backup remaining?

For example, when in one day three backups are made, but then Obsidian is not used for a week, at the start up of Obsidian a week later, are the three backups deleted before or after a new "fresh" backup has been made?

Thanks in advance for clarifying!

Backup on interval

Hi @cgcel,

This tool is fantastic for pairing with Google Drive/File Stream, iCloud, Dropbox, etc without having to setup complex syncers like other plugins.

However, I wish it had a backup on interval function rather than just a backup on startup. Is this something you'd be interested in adding?

For example, backing up the vault every 10 minutes while deleting previous backups to save on storage.

Thanks!
Matt

Customize the backup name

I had made myself a little script with cron jobs for local backups, but I love the idea of having an Obsidian plugin to do this instead.

Problem

I would like to be able to customize the backup name

Solution

A setting where you could specify the file name including the date format.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.