diff --git a/index.html b/index.html
index d1550e7..2286a66 100644
--- a/index.html
+++ b/index.html
@@ -168,6 +168,18 @@ Pixel-perfect Retina-ready Fast Consistent Hackable
Downloads
+ Github Releases: |
+  |
+ https://img.shields.io/github/downloads/atom/atom/latest/total.svg |
+
+ Github Releases (by Release): |
+  |
+ https://img.shields.io/github/downloads/atom/atom/v0.190.0/total.svg |
+
+ Github Releases (by Asset): |
+  |
+ https://img.shields.io/github/downloads/atom/atom/latest/atom-amd64.deb.svg |
+
npm: |
 |
https://img.shields.io/npm/dm/localeval.svg |
diff --git a/server.js b/server.js
index 4818493..3258a0c 100644
--- a/server.js
+++ b/server.js
@@ -1971,10 +1971,11 @@ camp.route(/^\/github\/downloads\/([^\/]+)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.(svg|p
cache(function(data, match, sendBadge, request) {
var user = match[1]; // eg, qubyte/rubidium
var repo = match[2];
- var id = match[3];
+ var tag = match[3];
var asset_name = match[4].toLowerCase(); // eg. total, atom-amd64.deb, atom.x86_64.rpm
var format = match[5];
- var apiUrl = 'https://api.github.com/repos/' + user + '/' + repo + '/releases/' + id;
+ var release_path = tag !== 'latest' ? 'tags/' + match[3] : 'latest';
+ var apiUrl = 'https://api.github.com/repos/' + user + '/' + repo + '/releases/' + release_path;
// Using our OAuth App secret grants us 5000 req/hour
// instead of the standard 60 req/hour.
if (serverSecrets) {
@@ -2000,7 +2001,11 @@ cache(function(data, match, sendBadge, request) {
downloads += asset.download_count;
}
});
- badgeData.text[1] = metric(downloads) + (asset_name? ' ' + asset_name: ' total');
+ var label = tag === 'latest' ? 'latest version' : tag;
+ if (asset_name !== 'total') {
+ label += ' ' + '[' + asset_name + ']';
+ }
+ badgeData.text[1] = metric(downloads) + ' ' + label;
badgeData.colorscheme = 'brightgreen';
sendBadge(format, badgeData);
} catch(e) {
diff --git a/try.html b/try.html
index 4472935..4886d2b 100644
--- a/try.html
+++ b/try.html
@@ -167,10 +167,18 @@ Pixel-perfect Retina-ready Fast Consistent Hackable
---|
Downloads
- Github: |
+
---|
Github Releases: |
 |
https://img.shields.io/github/downloads/atom/atom/latest/total.svg |
+ Github Releases (by Release): |
+  |
+ https://img.shields.io/github/downloads/atom/atom/v0.190.0/total.svg |
+
+ Github Releases (by Asset): |
+  |
+ https://img.shields.io/github/downloads/atom/atom/latest/atom-amd64.deb.svg |
+
npm: |
 |
https://img.shields.io/npm/dm/localeval.svg |
---|