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:
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 anunknown
badge when theReferer
-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 optionaltype
parameter.E.g. the following badge URLs and links could be placed in a README on github:
https://david-dm.org/auto.svg
/https://david-dm.org/detect
https://david-dm.org/dev-auto.svg
/https://david-dm.org/detect?type=dev
https://david-dm.org/peer-auto.png
/https://david-dm.org/detect?type=peer