Node.js server that serves a public folder of media files on Dropbox
Dropbox is a great means of hosting large files, but you can share only individual files, not individual links for a directory of files - the URLs for files are obfuscated for within folders.
This is a node.js server you can run on Heroku that exposes a directory without obfuscated paths, and redirects you to the appropriate file on Dropbox whenever you try to access a file.
Create a new app on Dropbox
Create a new app on Heroku
(Optional) Add either MongoHQ or MongoLab or MongoSoup to the app
Add to the Heroku app the config vars APP_KEY and APP_SECRET with the app key and secret from Dropbox (or if you added mongodb, you can alternatively specify the app key and secret by visiting the site after deploying it).
Deploy this repository to Heroku via git push:
git clone https://github.com/gkovacs/dropbox-media-server
cd dropbox-media-server
git remote add myapp [email protected]:myapp.git
git push myapp master
Visit your site at http://myapp.herokuapp.com and give it authorization. If you did not add mongodb, you will have to set the ACCESS_TOKEN heroku config var to output of the following:
heroku logs --app myapp | grep 'ACCESS_TOKEN'
Now you can add some files to the Dropbox folder at Dropbox/Apps/myapp and if you visit your site at http://myapp.herokuapp.com then it will show them.
To list the files as JSON: /listfiles
To access a file: /f/path/to/file.txt
To see if mongo db has an error: /mongostatus
To password-protect with HTTP Basic Auth over HTTPS: Add Heroku config var "PASSWORDS", which is JSON with usernames as keys and values as passwords, ie {"user1": "password1", "user2": "password2"}
MIT License