notgiven688 / webminerpool

Complete sources for a monero webminer.
262 stars 174 forks source link

Add function to specify login ID and password #153

Closed MexHigh closed 2 years ago

MexHigh commented 2 years ago

Adds the JavaScript function startMiningWithIdAndPassword(loginid, password, numThreads = -1, userid = "") (including the backend implementation).

It can be used if you mine on a pool which does not require a password, but where you must set the miner ID in the password field (like you need on the moneroocean.stream pool) to distinguish your miners. The function this PR introduced can then be used, so you don't need to specify your wallet address (username for the pool) and the pool in the frontend. Instead, the loginid is used to look them up.

Closes #152

MexHigh commented 2 years ago

I've tested this now, and it works like a charm :) Feel free to add reviews or merge it.

notgiven688 commented 2 years ago

Thanks for the PR. @MexHigh . Could we get away with having the following logic in the original if-branch in Program.cs (untested code):

if (msg.ContainsKey("loginid"))
{
    (...)

    // prefer message password if specified
    if (msg.ContainsKey("password")) client.Password = msg["password"].GetString();
    else client.Password = crdts.Password;

    (...)
}

Maybe this is a bit simpler(?)

MexHigh commented 2 years ago

@notgiven688 I thought about this, too. Yeah, maybe it is better to read. I'm going to test this.

MexHigh commented 2 years ago

Done :+1: