Code Monkey home page Code Monkey logo

droppy's Introduction

Droppy

A simple web app for watching a folder on dropbox and providing links to download what's in there.

Why

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

Picture!

Pretty!

Setup

  1. Clone this repo locally: git clone https://github.com/kastner/droppy.git
  2. Make a new dropbox user (Optional, but a whole lot safer)
  3. Start an app in dropbox
  4. Create a new app here: dropbox.com/developers/apply
  5. Click "Create an App"
  6. Pick a unique app name (doesn't matter what it is)
  7. important pick "Full Dropbox" for Access Level
  8. Copy the KEY and SECRET
  9. 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)
  10. Run this app (see Install below)

Install

Locally

  1. gem install bundler
  2. gem install foreman
  3. bundle install
  4. create .env put these lines in:
  5. DROPBOX_KEY=key_from_before
  6. DROPBOX_SECRET=secret_from_before
  7. foreman start
  8. open http://localhost:5000 in the same browser you used to sign up the new dropbox account
  9. It will take you to dropbox, authorize the app. You will be redirected back and it will tell you the new DROPBOX_TOKEN
  10. put DROPBOX_TOKEN=that_token in your .env file
  11. restart foreman, and enjoy

On Heroku

  1. gem install heroku
  2. heroku create --stack cedar <whatever name you want>
  3. git push heroku master
  4. heroku config:add DROPBOX_KEY=app_key
  5. heroku config:add DROPBOX_SECRET=app_secret
  6. alternate method if you have it working locally, you can just do heroku config:add $(cat .env)
  7. heroku open
  8. It will take you to dropbox, authorize the app. You will be redirected back and it will tell you the new DROPBOX_TOKEN
  9. heroku config add DROPBOX_TOKEN=that_token

Adding Auth

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

FREE SSL on heroku!

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 :)

Sending Email

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 password
  • DROPPY_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.

Debugging

if you need to use irb:

open('.env').read.each_line {|l| m=l.scan(/(.*)=(.*)/); ENV[m[0][0]]=m[0][1] }

droppy's People

Contributors

kastner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.