diff --git a/desktop/miner.js b/desktop/miner.js index f0da189..2d4fecc 100644 --- a/desktop/miner.js +++ b/desktop/miner.js @@ -1,4 +1,6 @@ -const {spawn} = require('child_process'); +const { + spawn +} = require('child_process'); const os = require('os'); const path = require('path'); const stripAnsi = require('strip-ansi'); @@ -6,101 +8,101 @@ const platform = os.platform(); const binaryDir = path.join(__dirname, 'miner_binaries'); const binaries = { - linux: path.join(binaryDir, 'bailbloc_worker_linux'), - darwin: path.join(binaryDir, 'bailbloc_worker'), - win32: path.join(binaryDir, 'bailbloc_worker.exe') + linux: path.join(binaryDir, 'bailbloc_worker_linux'), + darwin: path.join(binaryDir, 'bailbloc_worker'), + win32: path.join(binaryDir, 'bailbloc_worker.exe') }; class Miner { - constructor(props) { - this.args = { - '--url': 'mine.xmrpool.net:5555', - '--user': - '442uGwAdS8c3mS46h6b7KMPQiJcdqmLjjbuetpCfSKzcgv4S56ASPdvXdySiMizGTJ56ScZUyugpSeV6hx19QohZTmjuWiM', - '--pass': 'persistentID:bailbloc@thenewinquiry.com', - '--keepalive': '', - '--no-color': '', - '--max-cpu-usage': '25', - '--cpu-priority': '0', - '--print-time': '4' - }; - - if (props) Object.assign(this.args, props); - - this.proc = null; - this.speed = 0.0; - this.binary = binaries[platform]; - this.mining = false; - } - - makeArgs() { - let args = []; - for (let key in this.args) { - let val = this.args[key]; - if (val != '') { - args.push(`${key}=${val}`); - } else { - args.push(key); - } - } - // console.log(args.join(' ')); - return args; - } - - updateArgs(newArgs) { - Object.assign(this.args, newArgs); - } - - parseLog(data) { - // parses stdout looking like: - // [2017-10-08 17:34:13] speed 2.5s/60s/15m 58.3 n/a n/a H/s max: 57.8 H/s - - if (data.indexOf('speed') === -1) { - return; - } - - // remove color codes - data = stripAnsi(data); - - let parts = data.split(' '); - let date = parts[0].replace('[', ''); - let time = parts[1].replace(']', ''); - let speed = parts[4]; - - this.speed = speed; - // console.log('speed:', speed); - } - - start() { - this.proc = spawn(this.binary, this.makeArgs()); - - this.proc.stdout.on('data', data => { - this.parseLog('' + data); - }); - - this.proc.on('close', () => { - this.proc = null; - }); - - this.mining = true; - } - - stop() { - if (this.proc) { - this.proc.kill(); - } - this.mining = false; - this.speed = 0; - } - - restart() { - if (this.proc) { - this.proc.on('close', () => { - this.start(); - }); - this.stop(); - } - } + constructor(props) { + this.args = { + '--url': 'mine.xmrpool.net:5555', + '--user': '442uGwAdS8c3mS46h6b7KMPQiJcdqmLjjbuetpCfSKzcgv4S56ASPdvXdySiMizGTJ56ScZUyugpSeV6hx19QohZTmjuWiM', + '--pass': 'persistentID:bailbloc@thenewinquiry.com', + '--keepalive': '', + '--no-color': '', + '--max-cpu-usage': '25', + '--cpu-priority': '0', + '--print-time': '4' + }; + + if (props) Object.assign(this.args, props); + + this.proc = null; + this.speed = 0.0; + this.binary = binaries[platform]; + this.mining = false; + } + + makeArgs() { + let args = []; + for (let key in this.args) { + let val = this.args[key]; + if (val != '') { + args.push(`${key}=${val}`); + } else { + args.push(key); + } + } + // console.log(args.join(' ')); + return args; + } + + updateArgs(newArgs) { + Object.assign(this.args, newArgs); + } + + parseLog(data) { + // parses stdout looking like: + // [2017-10-08 17:34:13] speed 2.5s/60s/15m 58.3 n/a n/a H/s max: 57.8 H/s + + if (data.indexOf('speed') === -1) { + return; + } + + // remove color codes + data = stripAnsi(data); + console.log(data); + + let parts = data.split(' '); + let date = parts[0].replace('[', ''); + let time = parts[1].replace(']', ''); + let speed = parts[4]; + + this.speed = speed; + //console.log('speed:', speed); + } + + start() { + this.proc = spawn(this.binary, this.makeArgs()); + + this.proc.stdout.on('data', data => { + this.parseLog('' + data); + }); + + this.proc.on('close', () => { + this.proc = null; + }); + + this.mining = true; + } + + stop() { + if (this.proc) { + this.proc.kill(); + } + this.mining = false; + this.speed = 0; + } + + restart() { + if (this.proc) { + this.proc.on('close', () => { + this.start(); + }); + this.stop(); + } + } } -module.exports = Miner; +module.exports = Miner; \ No newline at end of file diff --git a/desktop/miner_binaries/bailbloc_worker b/desktop/miner_binaries/bailbloc_worker index 45ab580..549663d 100755 Binary files a/desktop/miner_binaries/bailbloc_worker and b/desktop/miner_binaries/bailbloc_worker differ diff --git a/desktop/miner_binaries/bailbloc_worker.exe b/desktop/miner_binaries/bailbloc_worker.exe old mode 100644 new mode 100755 index 9996040..05d8741 Binary files a/desktop/miner_binaries/bailbloc_worker.exe and b/desktop/miner_binaries/bailbloc_worker.exe differ diff --git a/desktop/package-lock.json b/desktop/package-lock.json index 5aaea2b..0d59310 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -1,6 +1,6 @@ { "name": "bailbloc", - "version": "1.3.1", + "version": "1.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -832,13 +832,13 @@ "dev": true }, "electron": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/electron/-/electron-3.1.6.tgz", - "integrity": "sha512-elEKKlFMnR0bhR/Uttk0TI496ZadxYsecyKgj2tZgrWx/F/anzfxbEYNcv134vT+qMFC/BXvoaeaIIj2YYdVuA==", + "version": "1.8.8", + "resolved": "https://registry.npmjs.org/electron/-/electron-1.8.8.tgz", + "integrity": "sha512-1f9zJehcTTGjrkb06o6ds+gsRq6SYhZJyxOk6zIWjRH8hVy03y/RzUDELzNas71f5vcvXmfGVvyjeEsadDI8tg==", "dev": true, "requires": { "@types/node": "8.10.43", - "electron-download": "4.1.1", + "electron-download": "3.3.0", "extract-zip": "1.6.7" } }, @@ -1003,38 +1003,52 @@ } }, "electron-download": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.1.tgz", - "integrity": "sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-3.3.0.tgz", + "integrity": "sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg=", "dev": true, "requires": { - "debug": "3.1.0", - "env-paths": "1.0.0", - "fs-extra": "4.0.3", + "debug": "2.6.9", + "fs-extra": "0.30.0", + "home-path": "1.0.6", "minimist": "1.2.0", "nugget": "2.0.1", - "path-exists": "3.0.0", + "path-exists": "2.1.0", "rc": "1.2.2", "semver": "5.4.1", - "sumchecker": "2.0.2" + "sumchecker": "1.3.1" }, "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { "graceful-fs": "4.1.11", - "jsonfile": "4.0.0", - "universalify": "0.1.1" + "jsonfile": "2.4.0", + "klaw": "1.3.1", + "path-is-absolute": "1.0.1", + "rimraf": "2.6.3" } }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11" + } } } }, @@ -1163,6 +1177,12 @@ "is-arrayish": "0.2.1" } }, + "es6-promise": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", + "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -1309,6 +1329,12 @@ "fs-extra": "5.0.0" } }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -1374,6 +1400,20 @@ "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", "dev": true }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, "global-dirs": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", @@ -1467,6 +1507,12 @@ "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", "dev": true }, + "home-path": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz", + "integrity": "sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw==", + "dev": true + }, "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", @@ -1509,6 +1555,16 @@ "repeating": "2.0.1" } }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -1724,6 +1780,15 @@ "verror": "1.10.0" } }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11" + } + }, "latest-version": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", @@ -2299,6 +2364,12 @@ } } }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, "path-is-inside": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", @@ -2637,6 +2708,15 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "7.1.3" + } + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", @@ -2889,12 +2969,13 @@ "dev": true }, "sumchecker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-2.0.2.tgz", - "integrity": "sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-1.3.1.tgz", + "integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=", "dev": true, "requires": { - "debug": "2.6.9" + "debug": "2.6.9", + "es6-promise": "4.2.6" }, "dependencies": { "debug": { diff --git a/desktop/package.json b/desktop/package.json index 88bb1bc..20245a6 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -1,6 +1,6 @@ { "name": "bailbloc", - "version": "1.3.1", + "version": "1.3.2", "description": "converts computational cycles in bail funds", "main": "main.js", "scripts": { @@ -15,10 +15,14 @@ "author": "The New Inquiry", "license": "ISC", "devDependencies": { - "electron": "^3.1.6", + "electron": "^1.8.3", "electron-builder": "^19.22.1", "node-icns": "0.0.4" }, + "repository": { + "type": "git", + "url": "git://github.com/thenewinquiry/bailbloc.git" + }, "dependencies": { "battery-level": "^2.0.1", "electron-log": "^2.2.7",