diff --git a/server.js b/server.js index 36ab84a..fea11f5 100644 --- a/server.js +++ b/server.js @@ -497,6 +497,37 @@ cache(function(data, match, sendBadge, request) { }); })); +// Bountysource integration. +camp.route(/^\/bountysource\/team\/([^\/]+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/, +cache(function(data, match, sendBadge, request) { + var team = match[1]; // eg, `mozilla-core`. + var type = match[2]; // eg, `activity`. + var format = match[3]; + var url = 'https://api.bountysource.com/teams/' + team; + var options = { + headers: { 'Accept': 'application/vnd.bountysource+json; version=2' } }; + var badgeData = getBadgeData('bounties', data); + request(url, options, function dealWithData(err, res, buffer) { + if (err != null) { + badgeData.text[1] = 'inaccessible'; + sendBadge(format, badgeData); + return; + } + try { + var data = JSON.parse(buffer); + if (type === 'activity') { + var activity = data.activity_total; + badgeData.colorscheme = 'brightgreen'; + badgeData.text[1] = activity; + } + sendBadge(format, badgeData); + } catch(e) { + badgeData.text[1] = 'invalid'; + sendBadge(format, badgeData); + } + }); +})); + // HHVM integration. camp.route(/^\/hhvm\/([^\/]+\/[^\/]+)(\/.+)?\.(svg|png|gif|jpg|json)$/, cache(function(data, match, sendBadge, request) { diff --git a/try.html b/try.html index 806c208..b76ed2e 100644 --- a/try.html +++ b/try.html @@ -89,69 +89,6 @@ I made the GitHub Badge Service.

Supported Services

-

Miscellaneous

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Gratipay: http://img.shields.io/gratipay/JSFiddle.svg
Code Climate: http://img.shields.io/codeclimate/github/kabisaict/flow.svg
Code Climate: http://img.shields.io/codeclimate/coverage/github/triAGENS/ashikawa-core.svg
Gemnasium: http://img.shields.io/gemnasium/mathiasbynens/he.svg
David: http://img.shields.io/david/strongloop/express.svg
David: http://img.shields.io/david/dev/strongloop/express.svg
David: http://img.shields.io/david/peer/webcomponents/generator-element.svg
Hackage-Deps: http://img.shields.io/hackage-deps/v/lens.svg
Packagist: http://img.shields.io/packagist/l/doctrine/orm.svg
npm: http://img.shields.io/npm/l/express.svg
PyPI: http://img.shields.io/pypi/l/Django.svg
Hex.pm: http://img.shields.io/hexpm/l/plug.svg
CocoaPods: http://img.shields.io/cocoapods/l/AFNetworking.svg
CocoaPods: http://img.shields.io/cocoapods/p/AFNetworking.svg
Wheelmap: http://img.shields.io/wheelmap/a/2323004600.svg

Build

@@ -174,8 +111,8 @@ I made the GitHub Badge Service. - - + + @@ -386,8 +323,72 @@ I made the GitHub Badge Service.
Travis: http://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/bt345.svg
TeamCity (full build status):
(full build status):   http://img.shields.io/teamcity/http/teamcity.jetbrains.com/e/bt345.svg
AppVeyor:
-

Issues

+

Miscellaneous

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Gratipay: http://img.shields.io/gratipay/JSFiddle.svg
Bountysource: http://img.shields.io/bountysource/team/mozilla-core/activity.svg
Code Climate: http://img.shields.io/codeclimate/github/kabisaict/flow.svg
Code Climate: http://img.shields.io/codeclimate/coverage/github/triAGENS/ashikawa-core.svg
Gemnasium: http://img.shields.io/gemnasium/mathiasbynens/he.svg
David: http://img.shields.io/david/strongloop/express.svg
David: http://img.shields.io/david/dev/strongloop/express.svg
David: http://img.shields.io/david/peer/webcomponents/generator-element.svg
Hackage-Deps: http://img.shields.io/hackage-deps/v/lens.svg
Packagist: http://img.shields.io/packagist/l/doctrine/orm.svg
npm: http://img.shields.io/npm/l/express.svg
PyPI: http://img.shields.io/pypi/l/Django.svg
Hex.pm: http://img.shields.io/hexpm/l/plug.svg
CocoaPods: http://img.shields.io/cocoapods/l/AFNetworking.svg
CocoaPods: http://img.shields.io/cocoapods/p/AFNetworking.svg
Wheelmap: http://img.shields.io/wheelmap/a/2323004600.svg
GitHub: http://img.shields.io/github/issues/badges/shields.svg