|
@ -379,6 +379,8 @@ shepherd.updateAgama = function() { |
|
|
localFile: rootLocation + 'patch.zip', |
|
|
localFile: rootLocation + 'patch.zip', |
|
|
onProgress: function(received, total) { |
|
|
onProgress: function(received, total) { |
|
|
const percentage = (received * 100) / total; |
|
|
const percentage = (received * 100) / total; |
|
|
|
|
|
if (Math.floor(percentage) % 5 === 0 || |
|
|
|
|
|
Math.floor(percentage) % 10 === 0) { |
|
|
console.log('patch ' + percentage + '% | ' + received + ' bytes out of ' + total + ' bytes.'); |
|
|
console.log('patch ' + percentage + '% | ' + received + ' bytes out of ' + total + ' bytes.'); |
|
|
cache.io.emit('patch', { |
|
|
cache.io.emit('patch', { |
|
|
'msg': { |
|
|
'msg': { |
|
@ -390,6 +392,7 @@ shepherd.updateAgama = function() { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then(function() { |
|
|
.then(function() { |
|
|
remoteFileSize('https://github.com/pbca26/dl-test/raw/master/patch.zip', function(err, remotePatchSize) { |
|
|
remoteFileSize('https://github.com/pbca26/dl-test/raw/master/patch.zip', function(err, remotePatchSize) { |
|
@ -402,7 +405,14 @@ shepherd.updateAgama = function() { |
|
|
console.log('extracting contents'); |
|
|
console.log('extracting contents'); |
|
|
|
|
|
|
|
|
const zip = new AdmZip(rootLocation + 'patch.zip'); |
|
|
const zip = new AdmZip(rootLocation + 'patch.zip'); |
|
|
zip.extractAllTo(/*target path*/rootLocation, /*overwrite*/true); |
|
|
|
|
|
|
|
|
if (shepherd.appConfig.dev) { |
|
|
|
|
|
if (!fs.existsSync(`${rootLocation}/patch`)) { |
|
|
|
|
|
fs.mkdirSync(`${rootLocation}/patch`); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
zip.extractAllTo(/*target path*/rootLocation + (shepherd.appConfig.dev ? '/patch' : ''), /*overwrite*/true); |
|
|
// TODO: extract files in chunks
|
|
|
// TODO: extract files in chunks
|
|
|
cache.io.emit('patch', { |
|
|
cache.io.emit('patch', { |
|
|
'msg': { |
|
|
'msg': { |
|
|