Socket
Socket
Sign inDemoInstall

coin-hive

Package Overview
Dependencies
150
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 1.5.0

4

config/defaults.js

@@ -7,3 +7,5 @@ module.exports = {

threads: -1,
username: null
username: null,
minerUrl: 'https://coinhive.com/lib/coinhive.min.js',
puppeteerUrl: null
}
{
"name": "coin-hive",
"version": "1.4.0",
"version": "1.5.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -51,8 +51,10 @@ # Coin-Hive [![Build Status](https://travis-ci.org/cazala/coin-hive.svg?branch=master)](https://travis-ci.org/cazala/coin-hive)

--username Set a username for the miner
--interval Interval between updates (logs)
--port Port for the miner server
--host Host for the miner server
--threads Number of threads for the miner
--proxy Proxy socket 5/4, for example: socks5://127.0.0.1:9050
--username Set a username for the miner
--interval Interval between updates (logs)
--port Port for the miner server
--host Host for the miner server
--threads Number of threads for the miner
--proxy Proxy socket 5/4, for example: socks5://127.0.0.1:9050
--puppeteer-url URL where puppeteer will point to, by default is miner server (host:port)
--miner-url URL of CoinHive's JavaScript miner, can be set to use a proxy
```

@@ -118,2 +120,4 @@

- `COINHIVE_USERNAME`: Set a username to the miner. See [CoinHive.User](https://coinhive.com/documentation/miner#coinhive-user).
- `COINHIVE_INTERVAL`: The interval on which the miner reports an update

@@ -129,8 +133,8 @@

- `COINHIVE_MINER_URL`: Set the CoinHive JavaScript Miner url. By defualt this is `https://coinhive.com/lib/coinhive.min.js`. You can set this to use a [CoinHive Proxy](https://github.com/cazala/coin-hive-proxy).
- `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+

@@ -9,3 +9,3 @@ const server = require('./server');

const miner = await new Promise((resolve, reject) => {
const minerServer = server().listen(options.port, options.host, async (err) => {
const minerServer = server(options.minerUrl).listen(options.port, options.host, async (err) => {
if (err) {

@@ -24,3 +24,4 @@ return reject(err);

proxy: options.proxy,
username: options.username
username: options.username,
url: options.puppeteerUrl
})

@@ -27,0 +28,0 @@ );

@@ -6,3 +6,3 @@ const EventEmitter = require('events');

constructor({siteKey, interval, host, port, server, threads, proxy, username}) {
constructor({ siteKey, interval, host, port, server, threads, proxy, username, url }) {
super();

@@ -17,3 +17,4 @@ this.inited = false;

this.proxy = proxy;
this.options = {siteKey, interval, threads, username};
this.url = url;
this.options = { siteKey, interval, threads, username };
}

@@ -25,3 +26,3 @@

}
this.browser = await puppeteer.launch({ args: this.proxy ? ['--no-sandbox','--proxy-server='+this.proxy] : ['--no-sandbox'] });
this.browser = await puppeteer.launch({ args: this.proxy ? ['--no-sandbox', '--proxy-server=' + this.proxy] : ['--no-sandbox'] });
return this.browser;

@@ -49,3 +50,3 @@ }

const page = await this.getPage();
const url = process.env.COINHIVE_PUPPETEER_URL || `http://${this.host}:${this.port}`;
const url = process.env.COINHIVE_PUPPETEER_URL || this.url || `http://${this.host}:${this.port}`;
await page.goto(url);

@@ -55,3 +56,3 @@ await page.exposeFunction('found', () => this.emit('found'));

await page.exposeFunction('update', (data, interval) => this.emit('update', data, interval));
await page.evaluate(({siteKey, interval, threads, username}) => window.init({siteKey, interval, threads, username}), this.options);
await page.evaluate(({ siteKey, interval, threads, username }) => window.init({ siteKey, interval, threads, username }), this.options);

@@ -58,0 +59,0 @@ this.inited = true;

var Express = require('express');
var path = require('path');
var fs = require('fs');
var defaults = require('../config/defaults');
var html = `
<script src=\"https://coinhive.com/lib/coinhive.min.js\"></script>
<script src=\"/miner.js\" /></script>
`;
module.exports = function getServer() {
module.exports = function getServer(minerUrl = defaults.minerUrl) {
var html = `<script src=\"${minerUrl}\"></script><script src=\"/miner.js\" /></script>`;
var app = new Express();

@@ -17,3 +14,3 @@ app.get('/miner.js', (req, res) => {

app.use('*', (req, res) => res.send(html));
return app
return app;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc