Skip to content

Commit

Permalink
add alternative static badge
Browse files Browse the repository at this point in the history
  • Loading branch information
RedSparr0w committed Dec 26, 2017
1 parent 46a05e4 commit fb4fc0b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7572,6 +7572,25 @@ camp.route(/^\/maven-metadata\/v\/(https?)\/(.+\.xml)\.(svg|png|gif|jpg|json)$/,
});
}));

// User defined badge - Static
camp.route(/^\/badge\/static\.(svg|png|gif|jpg|json)$/,
cache({
queryParams: ['value', 'colorscheme'],
handler: function(query, match, sendBadge, request) {
const format = match[1];

var badgeData = getBadgeData(query.label, query);

try{
badgeData.text[1] = query.value || '';
badgeData.colorscheme = query.colorscheme || 'blue';
} catch(e) {
badgeData.text[1] = 'invalid';
}
sendBadge(format, badgeData);
}
}));

// User defined sources - JSON response
camp.route(/^\/badge\/dynamic\/(json)\.(svg|png|gif|jpg|json)$/,
cache({
Expand Down

0 comments on commit fb4fc0b

Please sign in to comment.