xbrowsersync / api

Server-side REST API that serves requests from xBrowserSync client apps
GNU General Public License v3.0
796 stars 83 forks source link

Sync with Git repository #10

Closed thiagodp closed 5 years ago

thiagodp commented 6 years ago

Instead of synchronizing with a database such as MongoDB, it would be wonderful to have a way to do it with a Git repo. It would make it possible for one to create a local or a remote repository and get rid of external database-based sync servers.

An idea is to create a JSON file for every bookmark. For instance, https://github.com/xBrowserSync could be stored as https_github.com_xBrowserSync.json, that is, :// and / (and other characters, like ? and %) could be replaced by _. Each JSON file could have the same structure of the current MongoDB documents.

thiagodp commented 6 years ago

BTW, using NodeGit could help with that.

nero120 commented 6 years ago

@thiagodp it's an interesting idea, but if I'm being completely honest with you I simply don't have the time to implement this as I've got lots to do on the app side after spending a few months updating the API. I'm happy with the current API supporting only MongoDB as running off a NoSQL db is (I believe) by far the biggest use case and easiest to get up and running.

However, this would be a perfect case for a fork if you're willing to implement it, and I would happily link to your fork from the main README for those that would be interested in running the API from a git repo. Same goes for anyone else that might be willing.

I'll leave this issue open for anyone else that might be interested in using this functionality.

thiagodp commented 6 years ago

@nero120 Thank you. I understand and also don't have the time to implement this now, but I'm really considering to do it soon.

cjnaz commented 6 years ago

@thiagodp do you envision that this could be done while maintaining no clear text in the transport and storage? SSL/TLS can keep the transport hidden, and the Github storage would be in a private repo, so perhaps it doesn't matter. I personally like this aspect of the current implementation - that clear text only exists on the local machine browser (and in backups). Versioning of bookmarks is an attractive idea.

thiagodp commented 6 years ago

@cjnaz Maybe the values could be encrypted, while the keys couldn't. In this case, the file names would be replaced by a hash. Yes, the main use case is a remote private repo, like those free from GitLab.

BrutalSimplicity commented 5 years ago

This could possibly be simpler as a gist. Something like what Vs Code Settings Sync does.

nero120 commented 5 years ago

Good call @BrutalSimplicity!

Just to update this, I'm now planning on adding support to sync to popular, non-xBrowserSync web services, once support for major browsers has been added and sync for open tabs and history.

Obviously support specific services would need to be implemented, but once that's done you should be able to select the service at the login screen, supply your API credentials/options, then sync to that service.

As this will be implemented in the app rather than the api, I'll close this issue but ask that @thiagodp (or anyone else) request this in the app issues list then comment here with a link. 🙏