Merge pull request #50 from Didrole/xmr-proxy-support

Xmr proxy support
This commit is contained in:
Snipa22
2017-03-01 07:16:42 -08:00
committed by GitHub
+5 -4
View File
@@ -195,7 +195,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
let pass_split = pass.split(":"); let pass_split = pass.split(":");
this.error = ""; this.error = "";
this.identifier = pass_split[0]; this.identifier = pass_split[0];
if (agent.includes('MinerGate')){ if (agent && agent.includes('MinerGate')){
this.identifier = "MinerGate"; this.identifier = "MinerGate";
} }
this.paymentID = null; this.paymentID = null;
@@ -224,7 +224,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
this.fixed_diff = false; this.fixed_diff = false;
this.difficulty = startingDiff; this.difficulty = startingDiff;
this.connectTime = Date.now(); this.connectTime = Date.now();
if (agent.includes('NiceHash')){ if (agent && agent.includes('NiceHash')){
this.fixed_diff = true; this.fixed_diff = true;
this.difficulty = global.coinFuncs.niceHashDiff; this.difficulty = global.coinFuncs.niceHashDiff;
} }
@@ -457,7 +457,8 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
this.cachedJob = { this.cachedJob = {
blob: blob, blob: blob,
job_id: newJob.id, job_id: newJob.id,
target: target target: target,
id: this.id
}; };
return this.cachedJob; return this.cachedJob;
}; };
@@ -580,7 +581,7 @@ function handleMinerData(method, params, ip, portData, sendReply, pushMessage) {
} }
switch (method) { switch (method) {
case 'login': case 'login':
if (!params.login || (!params.pass && !params.agent.includes('MinerGate'))) { if (!params.login || (!params.pass && params.agent && !params.agent.includes('MinerGate'))) {
sendReply("No login/password specified"); sendReply("No login/password specified");
return; return;
} }