A simple web app for watching a folder on dropbox and providing links to download what's in there.
Dropbox has public folders, so why this? There's a few reasons:
- You control it... it's your web, and everything that entails (like your own SSO?)
- Auth baked in
- Runs on the free heroku offer
- Clone this repo locally:
git clone https://github.com/kastner/droppy.git
- Make a new dropbox user (Optional, but a whole lot safer)
- Start an app in dropbox
- Create a new app here: dropbox.com/developers/apply
- Click "Create an App"
- Pick a unique app name (doesn't matter what it is)
- important pick "Full Dropbox" for Access Level
- Copy the KEY and SECRET
- Share one of your dropbox folders with this new user (It's a good idea to create a new one - by default, the app will use a folder named
droppy
) - Run this app (see Install below)
gem install bundler
gem install foreman
bundle install
- create
.env
put these lines in: DROPBOX_KEY=key_from_before
DROPBOX_SECRET=secret_from_before
foreman start
- open
http://localhost:5000
in the same browser you used to sign up the new dropbox account - It will take you to dropbox, authorize the app. You will be redirected back and it will tell you the new DROPBOX_TOKEN
- put
DROPBOX_TOKEN=that_token
in your .env file - restart foreman, and enjoy
gem install heroku
heroku create --stack cedar <whatever name you want>
git push heroku master
heroku config:add DROPBOX_KEY=app_key
heroku config:add DROPBOX_SECRET=app_secret
- alternate method if you have it working locally, you can just do
heroku config:add $(cat .env)
heroku open
- It will take you to dropbox, authorize the app. You will be redirected back and it will tell you the new DROPBOX_TOKEN
heroku config add DROPBOX_TOKEN=that_token
Droppy supports HTTP Basic auth. To add it, just add the following two environment variables (to .env
or heroku config:add
):
AUTH_USERNAME=user
AUTH_PASSWORD=pass
Heroku offers free "Piggy-back" ssl on "heroku.com" subdomains. All you need to do is this:
heroku addons:add piggyback_ssl
And boom, you can now use https for all of it :)
So you want to alert someone when a new file is there?
Add these to the environment settings (either .env
, or heroku config:add
):
EMAIL_NOTIFY_LIST
email address to send "to"GMAIL_USER
Gmail username (with @gmail.com, or whathaveyou)GMAIL_PASS
Gmail passwordDROPPY_URL
Web address for the email to link to
If you're doing this on Heroku, you then need to scale up the clock process:
heroku scale clock=1
It will warn you about billing your account. This is real :). A month for me cost around $30.
if you need to use irb:
open('.env').read.each_line {|l| m=l.scan(/(.*)=(.*)/); ENV[m[0][0]]=m[0][1] }