joemccann/dillinger — pull request #73 by DandyDev (2013-04-25 20:35:13+00:00)
Title: Dropbox fix using node-dbox

Hey Joe,

I tried my hand at fixing https://github.com/joemccann/dillinger/issues/63 While fixing it, I incorporated https://github.com/sintaxi/node-dbox for talking to the Dropbox api. The whole async code in the index-route seemed somewhat unstable to me, at least on my machine, so I refactored the whole oauth dance for both Dropbox and GitHub, so they both start from a separate route now, with the menu items for linking them, pointing to those new routes.

While refactoring dropbox.js to use the node-dbox lib, I also took a shot at fixing https://github.com/joemccann/dillinger/issues/72 The way I did it is as follows:

* An initial search gets performed for ".md"
* In the callback everything with a longer extension than ".md" gets filtered out using regex.
* Two additional searches get done, nested, for ".markdown" and ".mdown"
* result arrays get concatted and returned

In the process I also tried to make the code somewhat more readable. I hope you're not offended by that.

NOTE: This is my first time hacking away at Node.js, so if I made a mess out of it, I sincerely apologize! It works on my machine ;)
NOTE 2: GitHub doesn't work for me, but it doesn't work on dillinger.io either