node: match the updated SHASUMS file

Part of #365
This commit is contained in:
Thaddee Tyl 2015-02-08 11:50:43 +01:00
parent 321c725949
commit 3fdf355bb5

View File

@ -937,8 +937,11 @@ cache(function(data, match, sendBadge, request) {
regularUpdate('http://nodejs.org/dist/latest/SHASUMS.txt',
(24 * 3600 * 1000),
function(shasums) {
var firstLine = shasums.slice(0, shasums.indexOf('\n'));
var version = firstLine.split(' ')[1].split('-')[1];
// tarball index start, tarball index end
var taris = shasums.indexOf('node-v');
var tarie = shasums.indexOf('\n', taris);
var tarball = shasums.slice(taris, tarie);
var version = tarball.split('-')[1];
return version;
}, function(err, version) {
if (err != null) { sendBadge(format, badgeData); return; }