Share Finder Files on Dropbox More Securely (Keyboard Maestro, Alfred, LaunchBar)
I’ve just pushed a new script to my LaunchBar (and Alfred and Keyboard Maestro1) Scripts repo: Share on Dropbox (API).
The script is “based”2 on Share on Dropbox. Share on Dropbox takes the Finder selection, moves the files to a folder on your Dropbox locally and then uses their name to generate their public link.
While this is all fine and good for most cases, it’s not very secure. If you want to share files from a current project that can’t be public, you still have to do some work on your own.
Ever since Dropbox introduced their Share URLs I wanted something that uses their API. The reason is that these URLs are generated whenever a file is shared. This way it becomes very hard for a potential attacker to simply guess a file’s name.
Unfortunately I’m not smart. Without Andrea Fabrizi’s Dropbox-Uploader, which is actually a Dropbox client, if you will, by itself, this wouldn’t be possible. It can do list, get quota, get share URL, upload and download. So it does way more than I need, but it does what I want, easy enough so that it becomes usable for a DAU like me. It is not as secure as if all tokens3 were saved to a secure storage like Keychain, but it’s good enough.
Share on Dropbox (API) takes the files selected in Finder and uses Dropbox-Uploader to upload the files to a folder that you can define. Note that because this is all done trough the API, the file will be downloaded once it’s uploaded.
The script will remember the file names and use them in the second step to, again, use Dropbox-Uploader to get their Share URLs.
Doing it this way was actually necessary. The script can’t just move a file into
~/Dropbox/Shared Files/ and get a Share URL (which would be quicker) before the upload has finished. It would have to find some intelligent way to magically tell when the upload is done. Therefore it’s best to use the API for upload already.
Also note that after each upload is done, every file will be deleted from the Finder and moved to the Trash. The original script moved the files to Dropbox in order to share them. I figured users want to have similar functionality from a similar script.