forked from Matoking/ScryptMiner-GUI
-
Notifications
You must be signed in to change notification settings - Fork 5
/
poolparse.cpp
50 lines (40 loc) · 1.24 KB
/
poolparse.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "poolparse.h"
PoolParse::PoolParse(QObject *parent) :
QObject(parent)
{
}
QString PoolParse::getURL(QString poolName, QString apiKey)
{
QString url;
if (poolName == "pom.m-hash.com")
url = "http://pom.m-hash.com/index.php?page=api&action=getuserstatus&api_key=";
else if (poolName == "suprnova.cc")
url = "https://xmg.suprnova.cc/index.php?page=api&action=getuserstatus&api_key=";
else if (poolName == "suchpool.pw")
url = "https://www.suchpool.pw/xmg/index.php?page=api&action=getuserstatus&api_key=";
else if (poolName == "-")
url = "-";
url.append(apiKey);
return url;
}
QString PoolParse::parseData(QString poolName, QVariantMap apidata)
{
QString message;
double hashrate = -1;
QVariantMap userStatus, userData;
if (poolName == "pom.m-hash.com")
{
userStatus = apidata.value("getuserstatus").toMap();
userData = userStatus.value("data").toMap();
hashrate = userStatus.value("hashrate").toDouble();
}
else if (poolName == "-")
{
}
if (hashrate != -1)
{
QString totalString = QString("<b>Pool hashrate:</b><br/>%1 kh/s<br/><br/>").arg(hashrate);
message.append(totalString);
}
return message;
}