So, remotely-save is a plugin that allows saving to dropbox and onedrive and webdav. I was using it but it didn't match my workflow with dillinger. So i patched it to save vaults in the root (i.e. /) of the cloud storages.
As remotely-save is opensource i looked up the source code and found that there's a method in settings.ts that uses the plugin id.
I then used notepad3 (a notepad alternative for windows) to open the large main.js from my obsidian vault folder. I then searched for it, and sure enough it was there.
So I edited, this line:
("settings_dropbox_folder",{pluginID:this.plugin.manifest.id,vaultName:this.app.vault.getName()}to
("settings_dropbox_folder",{pluginID:"",vaultName:this.app.vault.getName()}Also meanwhile i also found out OneDrive was also using the same. I decided to repeat it for one drive too.
("settings_onedrive_folder",{pluginID:this.plugin.manifest.id,vaultName:this.app.vault.getName()})to
("settings_onedrive_folder",{pluginID:"",vaultName:this.app.vault.getName()})If you've used Dropbox and Oauth apps then you'll know that auth scopes are usually limited. Especially for cloud storage oauth providers restrict apps to their own directories.
So to access the root of the drive we need to give full access to the plugin. So we need a new oauth app.
For Dropbox I had to visit Dropbox App Console and make a new app with Full Dropbox Access.
Then i visited the app scopes and gave it files and folder read write access.
Lastly i copied the api key (dropbox api key is also called client id) to a safe place.
To patch the keys from the script we need to find the keys first.
I let my browser open the auth url, then copied the url. Usually Oauth urls have client id and redirect uri in them.
I copied it and pasted it into a online url decoder and copied the plugin's production client id from there.
Then i searched it from notepad3 and replaced it with my new app key from Dropbox App Console.
For our app to work properly we need to add the same redirect url as the plugin. Following from the recent steps we used url decoder to obtain the client id, we also got the redirect url there.
The decoded url had a query redirect_uri=obsidian://remotely-save-cb-dropbox so obsidian://remotely-save-cb-dropbox is the redirect uri.
We simply add the same redirect uri from the Dropbox App Console.
Now save the file from notepad3 and run obsidian. Delete data.json. Choose the cloud provider and Authenticate from an account. The synced files should now be saved in the root folder inside a folder having the vault name.
Thanks to remotely-sync devs for the plugin, I hope the plugin adds more features :)