Coder Social home page Coder Social logo

stravo1 / obsidian-gdrive-sync Goto Github PK

View Code? Open in Web Editor NEW
230.0 8.0 3.0 155 KB

sync notes across devices in Obsidian via Google Drive

JavaScript 11.83% TypeScript 86.38% CSS 1.80%
google-drive-api obsidian obsidian-plugin obsidian-vault typescript google-drive obsidian-sync obsidian-gdrive obsidian-google-drive

obsidian-gdrive-sync's Introduction

Obsidian Google Drive Sync Plugin

GitHub last commit GitHub Release Date GitHub commit activity Discord

Overview

The Obsidian Google Drive Sync Plugin is a plugin that allows you to seamlessly sync your notes across devices with Google Drive. It is a free alternative to the paid Obsidian Sync service. With just a few simple steps, you can enable auto sync and enjoy the convenience of accessing your notes from any device, be it mobile or dekstop, always up-to-date!

This plugin is designed to be easy to install and configure compared to other plugins, no need to tackle git repos or manage Google Cloud Projects or setup any other external app.

โš ๏ธ The plugin is under active development, new releases might introduce bugs, old releases maybe be incompatible with the new ones. This might lead to data loss. Do read the FAQs before trying out the plugin. Please create a BACKUP of your vault before you install and try this plugin.

Features

  • Simple Installation: Although the plugin is not yet listed in the official Obsidian Plugins List, still it's relatively easy to install.

  • User-Friendly Configuration: Set up your Google Drive synchronization with just a few clicks. No complex setup required.

  • Automatic Sync: Your notes will automatically sync to Google Drive while you edit them, ensuring that you have the latest version of your notes on all your devices.

  • Access Anywhere: Access your notes from any device, be it mobile or desktop.

  • Secure and Reliable: Your notes are securely stored on YOUR Google Drive, and the plugin does NOT store/collect any data whatsoever.

Installation

To install the Obsidian Google Drive Auto Sync Plugin, follow these steps (if you have previoulsy installed any unofficial plugin the steps are identical):

  1. Download the "obsidian-gdrive-sync.zip" from the latest release and unzip it. After unzipping you should have a folder named "obsidian-gdrive-sync" containing 3 files. If after unzipping you end up with 3 different files (main.js, styles.css, manifest.json), place them under a new folder called "obsidian-gdrive-sync".

  2. Navigate to your vault's location. Open the .obsidian folder (Turn on "Show Hidden Files and Folders" in your file manager if this folder is not visible). Go to plugins (You might have to create this folder if you never installed any plugin before). Paste the folder containing 3 files. The path to the plugin should look like this: /$PATH_TO_VAULT/.obsidian/plugins/obsidian-gdrive-sync

  3. Open the required vault in Obsidian. Enable Community Plugins under Settings (If you are opening the vault for the first time you might be asked to confirm to "Trust Author and Enable Plugin", click to enable it).

  4. Enable the Google Drive Sync plugin under Installed Plugins. Wait for a few seconds. Make sure to have a good internet connection.

  5. Click on the Google Drive Sync settings under Community Plugins section that becomes visible.

Configuration

Configuring the plugin is straightforward:

  1. Under the plugin settings you will be provided with a link to Login. Clicking the link will open a new browser window.

  2. Choose the Google account whose Drive space will be used. Provide access to all the permissions (See, edit, create, and delete only the specific Google Drive files you use with this app).

  3. You will be provided with a code/token (Refresh Token). Copy the code and paste it in the space provided (Set Refresh Token) under the plugin settings and click on Checkmark button. As prompted, reload the plugin by turing it on and off under Communtiy Plugins.

  4. If you are using this plugin for the first time with a vault, you will be prompted to Initialize vault. This creates a folder with the same name as your vault in your Google Drive and copies all the files into it. You might need to reload the plugin again once initialization is complete.

  5. Once the previous steps are complete, set your preferred synchronization interval.

  6. Enjoy auto sync, for free!

FAQs

Q. Does this plgin work for Android/iOS?

Yes it does! The entire purpose of this plugin is to make sure that you have access to your notes no matter where you are and what device you are using. So how to install the plugin on:
Android: it's exactly how you would install it on your desktop: download the latest release zip, extract it, copy the folder to .obsidian/plugins under the location where you chose to create the vault. Here's a video walkthrough.
iOS: There's not a conventional way of installing these unofficial plugins on your iOS devices. The only option as of now is to create the vault, install the plugin and copy over the entire vault from desktop to the iOS device. If you have installed the plugin in an existing vault, you can copy over the vault as is. Here's some links: Github comment - Reddit Thread

Q. What's the lastSync: ... thing under properties/tags?

The plugin keeps track of the last time the file was synced on a particular device using a "property" or YAML tag named lastSync. This keeps changing as the note is continuously synced. Please refrain from editing that tag. Read more

Q. Why are my attachments being renamed? (SOLVED after beta-13)

If you are using a release older then beta-13 then the plugin renames the attachment to keep track of it: the attachments are renamed when they are uploaded because unlike in notes there's no "lastSync" tag that the plug-in can read from the note's content, so to differentiate between which attachments are synced and which are not it's renamed to "attachment_name-synced". I am actively trying to create a workaround for this, but it will take time. After beta-13 this is no more the case (read release notes).

Q. Can I manually add files in Drive? / Does the plug-in track files manually added to the Drive folder? / Can I import files manually to the Drive folder?

Unfortunately no, for security reasons the plug-in has access to only those files that it creates, and it has been made such that all vaults stay under the "obsidian" folder in Drive, and it can only access those files that it has created under that folder to make sure that it is not tampering/reading other sensitive files that the user might have. Here's some techincal details: .../auth/drive.appdata and ...auth/drive.file are the scopes the plug-in has access to.

Q. What about security and privacy?

The plug-in has limited access to only those files it creates itself, so it can't read any other files on your Drive. While giving the plug-in the necessary permissions you can confirm it yourself. And as for the token exchange part a server has to be unfortunately involved. I have a server hosted (whose link is the LogIn link) which does the code exchange for you, you can however implement your own Google Cloud Project and retrieve the refresh token. The plug-in just requires the refresh token to work, how it is retrieved is none of it's concern. More info at #24

Q. Notes created from templates get deleted automatically. How to solve it?

The plug-in uses the "lastSync" tag to keep track of synced files. So if a new note having the "lastSync" tag of the template from which it was created is detected by the plug-in it assumes that this "new" note was already synced as it has the "lastSync" tag (which is not true as it got the tag from the template) and as it can't find this "new" note on Drive (of cource it can't, it was never uploaded) it deletes the note to keep it in sync with Drive. Solution is to add the name of the template note/folder containing templates under the Blacklist option in settings and remove the "lastSync" tag from the template note(s) if it(they) has(have) the tag.

Q. Does the vault need to have the same name across devices?

A. Yes! The plug-in can be used to sync multiple vaults, and it uses the vault name to identify which vault is being currently worked on and need to be synced, you need to keep the vault name same across devices so that changes made under "sample-vault" on one device appears under "sample-vault" on your other devices as well.

Q. Why is this plugin not on the official Obsidian Plugin List?

A. It is very much in beta and not ready for "public" release, and will require a lot of testing and changes before it can be listed on the official plugins' list. there's a genuine risk of data loss (although i have tried my best to cover all edge cases but can't risk other people's data solely on my coding skills ๐Ÿ˜…). tldr: personally i don't want an unfinished plug-in with risk of data loss being listed as "official" :)

Troubleshooting & Support

If you encounter any issues with the plugin, check the following:

  • Ensure that the plugin has been properly installed.
  • Ensure that the refresh token has been properly copied and pasted.
  • Ensure you have a good internet connection.
  • Check for any error messages in the Obsidian console and report the same by creating an issue on GitHub.
  • Attach Error Logs and Verbose Logs while creating an issue. You can enable logging in settings.

If you need assistance or have questions, feel free to reach out by creating an issue on GitHub or you can also join the discord server.

Feedback and Contributions

If you have suggestions, encounter issues, or want to contribute to its development, please visit our GitHub repository and create an issue or pull request or you can also join the discord server.

Star History

Star History Chart

Happy syncing!

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.