Browse Source

Komodo Native Mode updates

ca333-dev
Satinder Grewal 8 years ago
parent
commit
1d886d7550
  1. BIN
      assets/bin/osx/iguana
  2. 4
      main.js
  3. 50
      routes/fetchparams.js
  4. 40
      routes/shepherd.js

BIN
assets/bin/osx/iguana

Binary file not shown.

4
main.js

@ -19,8 +19,8 @@ Promise = require('bluebird');
app.setName('Iguana');
process.env.ELECTRON_RUN_AS_NODE = true
console.log(process.env);
//process.env.ELECTRON_RUN_AS_NODE = true
//console.log(process.env);
// preload.js
const _setImmediate = setImmediate

50
routes/fetchparams.js

@ -0,0 +1,50 @@
var fs = require('fs');
var request = require('request');
var progress = require('request-progress');
const path = require('path')
const url = require('url')
const os = require('os')
const sha256 = require('sha256')
Promise = require('bluebird');
PARAMS_DIR="$HOME/Library/Application Support/ZcashParams"
SPROUT_PKEY_NAME='sprout-proving.key'
SPROUT_PKEY_NAME_HASH='8bc20a7f013b2b58970cddd2e7ea028975c88ae7ceb9259a5344a16bc2c0eef7'
SPROUT_VKEY_NAME='sprout-verifying.key'
SPROUT_VKEY_NAME_HASH='4bd498dae0aacfd8e98dc306338d017d9c08dd0918ead18172bd0aec2fc5df82'
SPROUT_PKEY_URL="https://z.cash/downloads/$SPROUT_PKEY_NAME"
SPROUT_VKEY_URL="https://z.cash/downloads/$SPROUT_VKEY_NAME"
// The options argument is optional so you can omit it
progress(request('https://az412801.vo.msecnd.net/vhd/VMBuild_20141027/VirtualBox/IE11/Windows/IE11.Win8.1.For.Windows.VirtualBox.zip'), {
// throttle: 2000, // Throttle the progress event to 2000ms, defaults to 1000ms
// delay: 1000, // Only start to emit after 1000ms delay, defaults to 0ms
// lengthHeader: 'x-transfer-length' // Length header to use, defaults to content-length
})
.on('progress', function (state) {
// The state is an object that looks like this:
// {
// percent: 0.5, // Overall percent (between 0 to 1)
// speed: 554732, // The download speed in bytes/sec
// size: {
// total: 90044871, // The total payload size in bytes
// transferred: 27610959 // The transferred payload size in bytes
// },
// time: {
// elapsed: 36.235, // The total elapsed seconds since the start (3 decimals)
// remaining: 81.403 // The remaining seconds to finish (3 decimals)
// }
// }
console.log('progress', state);
})
.on('error', function (err) {
// Do something with err
})
.on('end', function () {
// Do something after request finishes
})
.pipe(fs.createWriteStream('IE11.Win8.1.For.Windows.VirtualBox.zip'));

40
routes/shepherd.js

@ -100,6 +100,20 @@ shepherd.post('/setconf', function(req, res) {
});
shepherd.post('/getconf', function(req, res) {
console.log('======= req.body =======');
//console.log(req);
console.log(req.body);
//console.log(req.body.chain);
var confpath = getConf(req.body.chain);
console.log('got conf path is:')
console.log(confpath);
res.end('{"msg": "success","result": "' + confpath + '"}');
});
function herder(flock, data) {
//console.log(flock);
@ -341,4 +355,30 @@ function setConf(flock) {
})
}
function getConf(flock) {
console.log(flock);
if (os.platform() === 'darwin') {
var komodoDir = process.env.HOME + '/Library/Application Support/Komodo';
var ZcashDir = process.env.HOME + '/Library/Application Support/Zcash';
}
if (os.platform() === 'linux') {
var komodoDir = process.env.HOME + '/.komodo'
var ZcashDir = process.env.HOME + '/.zcash'
}
switch (flock) {
case 'komodod': var DaemonConfPath = komodoDir;
break;
case 'zcashd': var DaemonConfPath = ZcashDir;
break;
default: var DaemonConfPath = komodoDir + '/' + flock;
}
console.log(DaemonConfPath);
return DaemonConfPath
}
module.exports = shepherd;
Loading…
Cancel
Save