alanshaw / david-www

:eyeglasses: David helps keep your Node.js project dependencies up to date.
https://david-dm.org
MIT License
730 stars 131 forks source link

Adds auto-detect badges and deep links #362

Open makii42 opened 7 years ago

makii42 commented 7 years ago

This PR is my first pass to fix #356. Please have a look and give feedback.

It adds a bunch of routes to /src/routes/badge.js that generate either a redirect or send an unknown badge when the Referer-header could not be parsed successfully. The parsing logic is a rather crude regex and handled in /src/routes/referer.js with accompanying unit tests.

Besides this, there is a new /detect route added in /src/main.js to redirect deep to the appropriate dependencies page, passing along an optional type parameter.

E.g. the following badge URLs and links could be placed in a README on github: