coin-hive
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -6,3 +6,4 @@ module.exports = { | ||
interval: 1000, | ||
threads: -1 | ||
threads: -1, | ||
username: null | ||
} |
{ | ||
"name": "coin-hive", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
# Coin-Hive [![Build Status](https://travis-ci.org/cazala/coin-hive.svg?branch=master)](https://travis-ci.org/cazala/coin-hive) | ||
Mine cryptocurrency [Monero (XMR)](https://getmonero.org/) using [Coin-Hive](https://coin-hive.com/) from node.js | ||
Mine cryptocurrency [Monero (XMR)](https://getmonero.org/) using [CoinHive](https://coinhive.com/) from node.js | ||
## Disclaimer | ||
This project is not endorsed by or affiliated with `coin-hive.com` in any way. | ||
This project is not endorsed by or affiliated with `coinhive.com` in any way. | ||
@@ -47,6 +47,7 @@ ## Install | ||
<site-key>: You CoinHive Site Key | ||
<site-key>: Your CoinHive Site Key | ||
Options: | ||
--username Set a username for the miner | ||
--interval Interval between updates (logs) | ||
@@ -63,2 +64,4 @@ --port Port for the miner server | ||
- `username`: Set a username for the miner. See [CoinHive.User](https://coinhive.com/documentation/miner#coinhive-user). | ||
- `interval`: Interval between `update` events in ms. Default is `1000`. | ||
@@ -124,8 +127,10 @@ | ||
- `COINHIVE_PUPPETEER_URL`: In case you don't want to point puppeteer to the local server, you can use this to make it point somewhere else where the miner is served (ie: `PUPPETEER_URL=http://coin-hive.herokuapp.com`) | ||
- `COINHIVE_PUPPETEER_URL`: In case you don't want to point puppeteer to the local server, you can use this to make it point somewhere else where the miner is served (ie: `COINHIVE_PUPPETEER_URL=http://coin-hive.herokuapp.com`) | ||
- `COINHIVE_PROXY`: Puppeteer's proxy socket 5/4 (ie: `COINHIVE_PROXY=socks5://127.0.0.1:9050`) | ||
- `COINHIVE_USERNAME`: Assign a Username to the Miner. | ||
## Requisites | ||
+ Node v8+ |
@@ -22,3 +22,4 @@ const server = require('./server'); | ||
server: minerServer, | ||
proxy: options.proxy | ||
proxy: options.proxy, | ||
username: options.username | ||
}) | ||
@@ -25,0 +26,0 @@ ); |
@@ -6,5 +6,9 @@ var miner = null; | ||
// Init miner | ||
function init({siteKey, interval = 1000, threads = null}) { | ||
function init({siteKey, interval = 1000, threads = null, username}) { | ||
// Create miner | ||
miner = new CoinHive.Anonymous(siteKey); | ||
if(!username){ | ||
miner = new CoinHive.Anonymous(siteKey); | ||
}else{ | ||
miner = new CoinHive.User(siteKey, username); | ||
} | ||
@@ -11,0 +15,0 @@ if (threads > 0) { |
@@ -6,3 +6,3 @@ const EventEmitter = require('events'); | ||
constructor({siteKey, interval, host, port, server, threads, proxy}) { | ||
constructor({siteKey, interval, host, port, server, threads, proxy, username}) { | ||
super(); | ||
@@ -17,3 +17,3 @@ this.inited = false; | ||
this.proxy = proxy; | ||
this.options = {siteKey, interval, threads}; | ||
this.options = {siteKey, interval, threads, username}; | ||
} | ||
@@ -53,3 +53,3 @@ | ||
await page.exposeFunction('update', (data, interval) => this.emit('update', data, interval)); | ||
await page.evaluate(({siteKey, interval, threads}) => window.init({siteKey, interval, threads}), this.options); | ||
await page.evaluate(({siteKey, interval, threads, username}) => window.init({siteKey, interval, threads, username}), this.options); | ||
@@ -56,0 +56,0 @@ this.inited = true; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17822
217
134