giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.38k stars 461 forks source link

Feature suggestion: client sync to self-hosted server #266

Open fsnk opened 7 years ago

fsnk commented 7 years ago

I love love love CherryTree. It's become my go-to writing app (along with vim) and I'm really looking forward to the Android client.

I don't know what kind of file synchronization you're planning on implementing, if any. I assume maybe cloud storage like Google Docs and Dropbox, and I'd like to suggest it includes a self-hosted option also.

When the mobile client is available, the most valuable usage for me would be the ability to work on existing projects from different devices and so I'd like to be able to pull files hosted on a (Linux) server to the mobile and the desktop applications and sync back any changes. It would be important to have the ability to work offline (for use in remote locations without data; during air travel) and sync changes when I have network access.

It's not a high priority request or anything; I can definitely kludge together a system using rsync. It would be nice to have it integrated though. :)

And I just wanted to say how much I like CherryTree. Thanks for making it!

leggewie commented 7 years ago

I welcome the idea. For the sake of not bloating the app, I suggest to use an existing library or module and not reinvent the wheel. Synchronization is not trivial to do right.

livanh commented 6 years ago

I use Syncthing for this, once setup it works quite reliably, and doesn't even need a server. Try it! In case of a conflict (e.g. two nodes making modifications while offline) you will end up with two or more copies of the database (so as not to lose any data), so I suggest using the XML file format. It makes it easy to merge back everything, using standard text-based diff tools, e.g. Meld.

robotfactory commented 6 years ago

I think this should be revisited. Very simple sync is easily done with a synced folder to NextCloud/Owncloud, Dropbox, Box.com, Google Drive, etc. Unfortunately, if you use more than one machine it can be easy to accidentally overwrite your changes.

Example: I modify my notes on machine 1, save, then go to work. This file syncs to machine 2, a laptop. I modify my notes on machine 2 while offline on the bus/plane/nuclear bunker. I save locally. I return home and modify my notes on machine 1 again and save. Machine 2 is still offline. I bring machine 2 back online, it syncs, and now my last changes on machine 1 are overwritten.

Synchronization should be able to merge changes made on different machines, whether that's through built-in sync or some other method.

chadfurman commented 5 years ago

:+1: another vote for using syncthing. Would be nice if there were a streamline process for resolving conflicts in sync'd changes but otherwise syncthing is incredible

sinni800 commented 5 years ago

http://litesync.io/ is a commercial thing for syncing sqlite databases

But I also found this: https://github.com/otoolep/rqlite it's a solution to make sqlite databases distributed... https://www.symmetricds.org/ Another db agnostic thing I found.

I think Syncthing might not be a good solution especially because of the problem of desyncs and having to sync the full file which might become pretty big.

This is a point where a hierarchical structure in the file system itself would be advantageous, like KeepNote uses. Files aren't inserted into a DB here, either.

Another thing I found is this: https://github.com/moisseev/sqlite3-sync which is based on https://github.com/moisseev/sqlite3-rdiff, though this is problematic as soon as you have multiple clients syncing onto the same server db...

Betalord commented 4 years ago

I think syncing aspect is a very important one. It can't be currently done reliably by using external syncing tools, since CherryTree won't detect changes on file system and reload open file (hence user is risking to override automatically synced file).

The use case would be this: I have a single xml file shared between my two computers and my android phone. If I make a change on one of them, the other two would immediately update their local files (and if they are currently open in CherryTree, it would refresh them).

0xrushi commented 4 years ago

OMG this is pending since 2017, I hope it gets added soon. I'm forced to use onenote because of no sync in cherrytree ;-;.

souryap commented 4 years ago

This guy was able to sync somehow. https://www.youtube.com/watch?v=WkR1DFFOHhc

txe commented 4 years ago

It's really simple. He uses a script which

Like this

cd ~/github_files && git pull && cherrytree && git add . && git commit -m "Kali changes" && git push

On windows, he even added a cherrytree icon to this script, so it looks like he runs the original cherrytree app. Only a drawback here, if you change files on windows and linux together, you cannot push changes on one of these systems because git cannot merge them. On the other hand, it's good because you cannot lose your data.

sylvainfaivre commented 9 months ago

To anyone looking for a way to sync CherryTree documents on multiple computers, it works really well with Nextcloud client synchronization and a sqlite format file. When you save a file on a computer, open CherryTree instances automatically reload the new version on other computers.

The only problem is if you do an edit on a computer that is offline then another edit on a computer that is online, you will get a sync conflict when the Nextcloud client comes back online on the first computer. The changes are not lost since the Nextcloud client notices the conflict, but then I have to export both file versions to text, and compare the exports to make edits to the master file. I guess I should try the sqlite3-rdiff tool to see if it makes the compare process easier.

This also works well with Android clients using SourCherry along with the Nextcloud Android client (I use SourCherry read only, didn't try editing files with it, but it should probably work too).

kanehekili commented 8 months ago

Tomboy could sync 20 years ago. Strange that a note-taking software still struggles to do so... It simply created an (old) Version, so the user could merge it.. Who works on one computer only nowadays?