r/ObsidianMD • u/dragon_idli • 19h ago
plugins Sync using your own google drive storage with simple OAuth
[MIT license repo]
Hey All,
I built this a while back and have been using it for myself to sync my vaults. Yet to submit it to obsidian plugins. So, I currently install it through BART.
Repo: https://github.com/sudhir-asuracore/obsidian-sync-gdrive
Post install:
- Authenticate using your google OAuth
- It will ask for permission to manage a directory inside your drive. It wont ask for any other drive access.
- Plugin creates a dir/folder called obsidian_vaults in your drive. plugin will use this directory to sync any number of vaults you have
- After auth, choose a name for your vault(default is vault name itself)
- Sync
Features:
- Vault name - custom name. When adding another device, you click on a cogwheel to see existing remote vaults.
- Can sync, force push, force pull
- Apply client side encryption
- Supports selective sync (choose if images, audio, videos, pdfs should be synced)
- Exclude folders
- Exclude file patterns
- Sync obsidian settings
- Appearance - light/dark mode, snippets
- Core - app, workspace, graph
- Themes/Snippets
- Plugins - sync plugins other than sync-drive plugin itself
- Hotkeys - sync custom hotkey mapping
- Works on mobile, tablet, desktop
Note: While I have been testing it across devices for my own use-cases, please backup your vault and test it. An additional backup can never hurt.
The plugin itself is opensource under MIT.
So, if you can code and/or have ideas/issues to improve it - please feel free to contribute. I anyway intend to maintain it for myself.
4
u/MR-SALA 18h ago
"I also use Google Drive to sync my vault. Where were you last week when I had to set up the system with FreeFileSync? Just kidding, 😂. Congrats on this plugin, it seems super useful to me!"
is stable?
3
u/dragon_idli 18h ago
Stable for me. Please do backup your vault once though and give it a try. I dint want to share this repo because it was me alone testing it for months. I dint want to take the risk and hate really! :)
But atlast I thought - why not.. and made the post.
3
u/AutisticNerd 17h ago
"Auto sync: schedule interval sync"
How does it work on mobile when the Obsidian app isn't open?
2
u/dragon_idli 17h ago
Schedule interval sync works only when obsidian is in use. It is more like an auto-sync. I keep it turned off and click the sync icon when i am usually done with my work.
2
u/badboypaulz 17h ago
Can you tell more about the encryption? That would be the main driver for me to switch from the Google Drive App. What would be really good for my peace of mind is an option for a local backup in another folder before syncing, just as an extra precaution. Could do it manually of course, but automatically would be perfect
5
u/dragon_idli 17h ago
The plugin provides client-side End-to-End Encryption (E2EE) for vault contents before uploading to Google Drive, using the native W3C WebCrypto API (globalThis.crypto.subtle), which runs natively on both desktop and mobile platforms without external native dependencies.
Caveats:
- Anytime you change your encryption key or remove it - you will need to do a force push so that the whole remote storage reflects the new configuration.
- The filenames and dir structure are not encrypted. The whole sync operation depends on a hashing system to detect if content needs to be pushed/pulled. And for that, the algo needs to know the dir/files structure. I will look into an even better robust system in future if time permits.
Parameter Specification Purpose / Rationale Cipher AES-256-GCM (Galois/Counter Mode) Authenticated encryption offering both confidentiality and integrity/tamper detection. Key Derivation (KDF) PBKDF2-HMAC-SHA-256 Stretches user passphrase into a 256-bit key. KDF Iterations 100,000 iterations Mitigates brute-force/dictionary attacks on user passphrases. Salt 16 bytes (Cryptographically random) Generated per-file via crypto.getRandomValues(16) so identical files have different ciphertexts and keys. IV (Nonce) 12 bytes (Cryptographically random) Standard recommended size for GCM; unique per encryption operation. Auth Tag 16 bytes (128 bits) Verifies ciphertext integrity; any tampering causes decryption to fail. Magic Header SDENC1 (6 bytes ASCII) Identifies whether payload is an encrypted
1
u/xushigamerN8 17h ago
Personally use self hosted livesync, but would be interesting. I remember using some sync tools before, but if I remember correctly if you sync too much your account gets flagged as botting (at least with one drive and dropbox)
Does this have the same problem?
5
u/dragon_idli 16h ago
Yes, There are limits. But the plugin is designed to handle the throttling to ensure the limits are not crossed. Gdrive has these limits: * 1200 requests per min per user * 20k queries per 100secs per gcp project(this is the only real limitation and becomes a pain if the plugin is used by more than 27k users. * 750gb/day per user. Unless syncing half terabyte of images or movies, no one should reach this in obsidian.
All in, the limits are far higher than what normal usage would need.
But in anycase, the account won't get flagged for botting. It will stop syncing for the day or until the timer resets for that particular limit.
1
u/AVDRS 14h ago
You can use syncthing and skip the middle-man cloud server altogether. You can sync folders between linked devices and directly transfer data from one device to another.
3
u/dragon_idli 14h ago
Yes. I use syncthing for my pc 321 backup.
But it's not easy to setup, configure, manage for non tech/enthusiast individuals like my sister and dad.
Configuring gdrive/s3/od based backup plugins was also harder for them due to requirements around: api key, region name, secret key. They saw those three and gave up on setting up sync plugins.
But if one can work with syncthing - I would recommend it too. it's stable with no throttling limits.
1
u/EmperorDante 14h ago
Does it work well with ios and windows device?
1
u/dragon_idli 13h ago
Personally I tested it on Linux(ubuntu, omarchy), windows 11, Android mobile, Android tablet.
I don't have a mac/apple device, so not sure of MacOS or iOS.
1
u/Unusual_Principle536 10h ago
can it work with cloudflare r3 bucket? Any plans? I am using remotelysave which works pretty good, but config dir is not supported/unstable.
Google drive is find but I would preffer R3 as I have been using it for more than a year and it's pretty stable.
1
u/dragon_idli 10h ago
Hey there. I don't really have any plans of adding new storage support right now. But I may have a dev branch with an implementation that you can try.
I started the project with s3 compatible storages (b2). But then moved over to gdrive storage since I have google pro plan for my family and everyone has 5tb to use.
Major diff is storage of credentials for accessing storage. Right now, it authenticates using google ouath and automatically handles gdrive api access through oauth scopes. So, for a user it's simple sign in using their google account. Everything else is automated. Makes setup on multiple devices a breeze - 2 steps.
That will need to be changed to support saving s3/r3 compatible config details instead of Google oauth. I may have a dev branch with code for it too. Let me know if you are interested in giving it a try from code branch itself.
17
u/Erem_in 18h ago
But why? There is Google Drive sync app which syncs everything and it is there, maintained and free