doge pool
This commit is contained in:
parent
3fde5d7f1d
commit
1c327e5832
@ -2,7 +2,7 @@ package cz.kamma.mining;
|
|||||||
|
|
||||||
public interface Constants {
|
public interface Constants {
|
||||||
|
|
||||||
public static final String APP_VERSION = "v0.5";
|
public static final String APP_VERSION = "v0.7";
|
||||||
public static final String COPYRIGHT = "2021";
|
public static final String COPYRIGHT = "2021";
|
||||||
public static final int DEFAULT_HTTP_TIMEOUT = 2000;
|
public static final int DEFAULT_HTTP_TIMEOUT = 2000;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,20 +23,16 @@ public class MiningBean {
|
|||||||
List<KeyValue> pool = new ArrayList<>();
|
List<KeyValue> pool = new ArrayList<>();
|
||||||
List<KeyValue> network = new ArrayList<>();
|
List<KeyValue> network = new ArrayList<>();
|
||||||
|
|
||||||
String[] cryptoCur = new String[] { "btc", "ltc", "xrp", "eth" };
|
String[] cryptoCur = new String[] { "btc", "ltc", "xrp", "eth"};
|
||||||
double[] lastPrices = new double[] { 0, 0, 0, 0 };
|
double[] lastPrices = new double[] { 0, 0, 0, 0 };
|
||||||
|
|
||||||
String apikey = request.getParameter("apikey");
|
String ltcapikey = request.getParameter("ltcapikey");
|
||||||
|
String dogapikey = request.getParameter("dogapikey");
|
||||||
String ltcWallet = request.getParameter("ltc");
|
String ltcWallet = request.getParameter("ltc");
|
||||||
String xrpWallet = request.getParameter("xrp");
|
String xrpWallet = request.getParameter("xrp");
|
||||||
String ethWallet = request.getParameter("eth");
|
String ethWallet = request.getParameter("eth");
|
||||||
String currency = request.getParameter("cur");
|
String currency = request.getParameter("cur");
|
||||||
|
|
||||||
if (request.getParameter("apikey") == null) {
|
|
||||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Invalid API key");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currency == null || currency.equals("null") || currency.length() == 0)
|
if (currency == null || currency.equals("null") || currency.length() == 0)
|
||||||
currency = "usd";
|
currency = "usd";
|
||||||
else
|
else
|
||||||
@ -135,9 +131,9 @@ public class MiningBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apikey != null && !"null".equals(apikey) && apikey.length() > 0) {
|
if (ltcapikey != null && !"null".equals(ltcapikey) && ltcapikey.length() > 0) {
|
||||||
String miningJson = HttpHelper
|
String miningJson = HttpHelper
|
||||||
.getStringResponse("https://www.litecoinpool.org/api?api_key=".concat(apikey));
|
.getStringResponse("https://www.litecoinpool.org/api?api_key=".concat(ltcapikey));
|
||||||
if (miningJson != null && miningJson.length() > 0) {
|
if (miningJson != null && miningJson.length() > 0) {
|
||||||
JSONObject full = new JSONObject(miningJson);
|
JSONObject full = new JSONObject(miningJson);
|
||||||
JSONObject user = (JSONObject) full.get("user");
|
JSONObject user = (JSONObject) full.get("user");
|
||||||
@ -264,6 +260,116 @@ public class MiningBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dogapikey != null && !"null".equals(dogapikey) && dogapikey.length() > 0) {
|
||||||
|
String miningJson = HttpHelper
|
||||||
|
.getStringResponse("https://aikapool.com/doge/index.php?page=api&action=getuserworkers&api_key="
|
||||||
|
+ dogapikey + "&id=282608&_=1621333944761", 5000);
|
||||||
|
if (miningJson != null && miningJson.length() > 0) {
|
||||||
|
JSONObject full = new JSONObject(miningJson);
|
||||||
|
JSONObject user = (JSONObject) full.get("getuserworkers");
|
||||||
|
JSONArray data = (JSONArray) user.get("data");
|
||||||
|
KeyValue wi = new KeyValue();
|
||||||
|
|
||||||
|
for (Iterator it = data.iterator(); it.hasNext();) {
|
||||||
|
JSONObject workersJson = (JSONObject) it.next();
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("HashRate " + workersJson.getString("username"));
|
||||||
|
double hr = workersJson.getDouble("hashrate");
|
||||||
|
wi.setValue(String.format("%.2f",(hr / 1000)) + " MH/s");
|
||||||
|
workers.add(wi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
miningJson = HttpHelper
|
||||||
|
.getStringResponse("https://aikapool.com/doge/index.php?page=api&action=getdashboarddata&api_key="
|
||||||
|
+ dogapikey + "&id=282608&_=1621333944761", 5000);
|
||||||
|
if (miningJson != null && miningJson.length() > 0) {
|
||||||
|
JSONObject full = new JSONObject(miningJson);
|
||||||
|
JSONObject user = (JSONObject) full.get("getdashboarddata");
|
||||||
|
JSONObject data = (JSONObject) user.get("data");
|
||||||
|
JSONObject net = (JSONObject) data.get("network");
|
||||||
|
JSONObject pers = (JSONObject) data.get("personal");
|
||||||
|
JSONObject estimates = (JSONObject) pers.get("estimates");
|
||||||
|
JSONObject raw = (JSONObject) data.get("raw");
|
||||||
|
KeyValue wi = new KeyValue();
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Next Payout");
|
||||||
|
if (estimates.getDouble("payout") > 0)
|
||||||
|
wi.setValue(estimates.getDouble("payout") + " DOG");
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
workers.add(wi);
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Difficulty");
|
||||||
|
if (net.getDouble("difficulty") > 0)
|
||||||
|
wi.setValue("" + net.getDouble("difficulty"));
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
network.add(wi);
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Next Difficulty");
|
||||||
|
if (net.getDouble("nextdifficulty") > 0)
|
||||||
|
wi.setValue("" + net.getDouble("nextdifficulty"));
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
network.add(wi);
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Pool Hashrate");
|
||||||
|
if (raw.getJSONObject("pool").getDouble("hashrate") > 0)
|
||||||
|
wi.setValue((raw.getJSONObject("pool").getDouble("hashrate") / 1000000) + " GH/s");
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
network.add(wi);
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Network Hashrate");
|
||||||
|
if (raw.getJSONObject("network").getDouble("hashrate") > 0)
|
||||||
|
wi.setValue((raw.getJSONObject("network").getDouble("hashrate") / 1000000) + " GH/s");
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
network.add(wi);
|
||||||
|
}
|
||||||
|
|
||||||
|
miningJson = HttpHelper
|
||||||
|
.getStringResponse("https://aikapool.com/doge/index.php?page=api&action=getuserbalance&api_key="
|
||||||
|
+ dogapikey + "&id=282608&_=1621333944761", 5000);
|
||||||
|
if (miningJson != null && miningJson.length() > 0) {
|
||||||
|
JSONObject full = new JSONObject(miningJson);
|
||||||
|
JSONObject user = (JSONObject) full.get("getuserbalance");
|
||||||
|
JSONObject data = (JSONObject) user.get("data");
|
||||||
|
KeyValue wi = new KeyValue();
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Paid");
|
||||||
|
if (data.getDouble("paid") >= 0)
|
||||||
|
wi.setValue(data.getDouble("paid") + " DOG");
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
workers.add(wi);
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Confirmed");
|
||||||
|
if (data.getDouble("confirmed") >= 0)
|
||||||
|
wi.setValue(data.getDouble("confirmed") + " DOG");
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
workers.add(wi);
|
||||||
|
|
||||||
|
wi = new KeyValue();
|
||||||
|
wi.setKey("Unconfirmed");
|
||||||
|
if (data.getDouble("unconfirmed") >= 0)
|
||||||
|
wi.setValue(data.getDouble("unconfirmed") + " DOG");
|
||||||
|
else
|
||||||
|
wi.setValue("Unknown");
|
||||||
|
workers.add(wi);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String res = "<response><prices>#PRICES#</prices><workers>#WORKERS#</workers><pool>#POOL#</pool><network>#NETWORK#</network></response>";
|
String res = "<response><prices>#PRICES#</prices><workers>#WORKERS#</workers><pool>#POOL#</pool><network>#NETWORK#</network></response>";
|
||||||
|
|
||||||
String tmp = "";
|
String tmp = "";
|
||||||
|
|||||||
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
<script language=javascript type='text/javascript'>
|
<script language=javascript type='text/javascript'>
|
||||||
function asynchUpdate() {
|
function asynchUpdate() {
|
||||||
AX_asynchUpdate("<%=request.getParameter("apikey")%>", "<%=request.getParameter("ltc")%>", "<%=request.getParameter("eth")%>", "<%=request.getParameter("xrp")%>", "<%=request.getParameter("cur")%>");
|
AX_asynchUpdate("<%=request.getParameter("ltcapikey")%>", "<%=request.getParameter("dogapikey")%>", "<%=request.getParameter("ltc")%>", "<%=request.getParameter("eth")%>", "<%=request.getParameter("xrp")%>", "<%=request.getParameter("cur")%>");
|
||||||
setTimeout('asynchUpdate();', 5000);
|
setTimeout('asynchUpdate();', 15000);
|
||||||
}
|
}
|
||||||
asynchUpdate();
|
asynchUpdate();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -73,8 +73,8 @@ function ajaxGetXmlResponse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function AX_asynchUpdate(apikey, ltc, eth, xrp, cur) {
|
function AX_asynchUpdate(ltcapikey, dogapikey, ltc, eth, xrp, cur) {
|
||||||
var data = 'ajaxMethod=asynchUpdate&apikey=' + apikey + '<c=' + ltc + 'ð=' + eth
|
var data = 'ajaxMethod=asynchUpdate<capikey=' + ltcapikey + '&dogapikey=' + dogapikey + '<c=' + ltc + 'ð=' + eth
|
||||||
+ '&xrp=' + xrp+ '&cur=' + cur;
|
+ '&xrp=' + xrp+ '&cur=' + cur;
|
||||||
ajaxSendRequest(data, AX_asynchUpdateResponse);
|
ajaxSendRequest(data, AX_asynchUpdateResponse);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,10 +16,16 @@
|
|||||||
<form action="ajaxview.jsp" method="GET">
|
<form action="ajaxview.jsp" method="GET">
|
||||||
<table border="0" width="100%">
|
<table border="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td class='group'>litecoinpool.org API key (mandatory)</td>
|
<td class='group'>litecoinpool.org LTC API key (optional)</td>
|
||||||
<td align="right" class='group'
|
<td align="right" class='group'
|
||||||
style='transition: text-shadow 0.7s ease-in-out;'><input
|
style='transition: text-shadow 0.7s ease-in-out;'><input
|
||||||
type="text" name="apikey" size="40" /></td>
|
type="text" name="ltcapikey" size="40" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class='group'>aikapool.org DOGE API key (optional)</td>
|
||||||
|
<td align="right" class='group'
|
||||||
|
style='transition: text-shadow 0.7s ease-in-out;'><input
|
||||||
|
type="text" name="dogapikey" size="40" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='group'>Litecoin wallet address (optional)</td>
|
<td class='group'>Litecoin wallet address (optional)</td>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user