added ETH
This commit is contained in:
parent
00f5522167
commit
3fde5d7f1d
@ -2,7 +2,7 @@ package cz.kamma.mining;
|
||||
|
||||
public interface Constants {
|
||||
|
||||
public static final String APP_VERSION = "v0.4";
|
||||
public static final String APP_VERSION = "v0.5";
|
||||
public static final String COPYRIGHT = "2021";
|
||||
public static final int DEFAULT_HTTP_TIMEOUT = 2000;
|
||||
}
|
||||
|
||||
@ -16,266 +16,301 @@ import cz.kamma.mining.vo.KeyValue;
|
||||
|
||||
public class MiningBean {
|
||||
|
||||
public static String updateAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
java.lang.System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
|
||||
List<KeyValue> prices = new ArrayList<>();
|
||||
List<KeyValue> workers = new ArrayList<>();
|
||||
List<KeyValue> pool = new ArrayList<>();
|
||||
List<KeyValue> network = new ArrayList<>();
|
||||
public static String updateAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
java.lang.System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
|
||||
List<KeyValue> prices = new ArrayList<>();
|
||||
List<KeyValue> workers = new ArrayList<>();
|
||||
List<KeyValue> pool = new ArrayList<>();
|
||||
List<KeyValue> network = new ArrayList<>();
|
||||
|
||||
String[] cryptoCur = new String[] { "btc", "ltc", "xrp", "eth" };
|
||||
double[] lastPrices = new double[] { 0, 0, 0, 0 };
|
||||
String[] cryptoCur = new String[] { "btc", "ltc", "xrp", "eth" };
|
||||
double[] lastPrices = new double[] { 0, 0, 0, 0 };
|
||||
|
||||
String apikey = request.getParameter("apikey");
|
||||
String ltcWallet = request.getParameter("ltc");
|
||||
String xrpWallet = request.getParameter("xrp");
|
||||
String currency = request.getParameter("cur");
|
||||
String apikey = request.getParameter("apikey");
|
||||
String ltcWallet = request.getParameter("ltc");
|
||||
String xrpWallet = request.getParameter("xrp");
|
||||
String ethWallet = request.getParameter("eth");
|
||||
String currency = request.getParameter("cur");
|
||||
|
||||
if (request.getParameter("apikey") == null) {
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Invalid API key");
|
||||
return null;
|
||||
}
|
||||
if (request.getParameter("apikey") == null) {
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Invalid API key");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (currency == null || currency.equals("null") || currency.length() == 0)
|
||||
currency = "usd";
|
||||
else
|
||||
currency = currency.toLowerCase();
|
||||
if (currency == null || currency.equals("null") || currency.length() == 0)
|
||||
currency = "usd";
|
||||
else
|
||||
currency = currency.toLowerCase();
|
||||
|
||||
String curSym = "$";
|
||||
String curSym = "$";
|
||||
|
||||
if (currency.equals("usd"))
|
||||
curSym = "$";
|
||||
else if (currency.equals("eur"))
|
||||
curSym = "€";
|
||||
if (currency.equals("usd"))
|
||||
curSym = "$";
|
||||
else if (currency.equals("eur"))
|
||||
curSym = "€";
|
||||
|
||||
workers.clear();
|
||||
prices.clear();
|
||||
network.clear();
|
||||
pool.clear();
|
||||
workers.clear();
|
||||
prices.clear();
|
||||
network.clear();
|
||||
pool.clear();
|
||||
|
||||
String resultStr;
|
||||
String restRequest;
|
||||
String resultStr;
|
||||
String restRequest;
|
||||
|
||||
for (int i = 0; i < cryptoCur.length; i++) {
|
||||
String ccur = cryptoCur[i];
|
||||
restRequest = HttpHelper.getStringResponse("https://www.bitstamp.net/api/v2/ticker/".concat(ccur).concat(currency));
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject tmp = new JSONObject(restRequest);
|
||||
double res = tmp.getDouble("last");
|
||||
lastPrices[i] = res;
|
||||
if (res > 0d)
|
||||
resultStr = curSym + res;
|
||||
else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey(ccur.toUpperCase().concat("/").concat(currency.toUpperCase()).concat(" (Bitstamp)"));
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < cryptoCur.length; i++) {
|
||||
String ccur = cryptoCur[i];
|
||||
restRequest = HttpHelper
|
||||
.getStringResponse("https://www.bitstamp.net/api/v2/ticker/".concat(ccur).concat(currency));
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject tmp = new JSONObject(restRequest);
|
||||
double res = tmp.getDouble("last");
|
||||
lastPrices[i] = res;
|
||||
if (res > 0d)
|
||||
resultStr = curSym + res;
|
||||
else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey(ccur.toUpperCase().concat("/").concat(currency.toUpperCase()).concat(" (Bitstamp)"));
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
|
||||
if (ltcWallet != null && !"null".equals(ltcWallet) && ltcWallet.length() > 0) {
|
||||
restRequest = HttpHelper.getStringResponse("https://chain.so/api/v2/get_address_balance/LTC/".concat(ltcWallet));
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject full = new JSONObject(restRequest);
|
||||
JSONObject data = (JSONObject)full.get("data");
|
||||
String confirmedBalance = (String) data.get("confirmed_balance");
|
||||
if (ltcWallet != null && !"null".equals(ltcWallet) && ltcWallet.length() > 0) {
|
||||
restRequest = HttpHelper
|
||||
.getStringResponse("https://chain.so/api/v2/get_address_balance/LTC/".concat(ltcWallet));
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject full = new JSONObject(restRequest);
|
||||
JSONObject data = (JSONObject) full.get("data");
|
||||
String confirmedBalance = (String) data.get("confirmed_balance");
|
||||
|
||||
double res = Double.parseDouble(confirmedBalance);
|
||||
if (res > 0d) {
|
||||
resultStr = res + " LTC " + curSym + String.format("%.2f", (res * lastPrices[1]));
|
||||
} else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("My Balance LTC");
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
double res = Double.parseDouble(confirmedBalance);
|
||||
if (res > 0d) {
|
||||
resultStr = res + " LTC " + curSym + String.format("%.2f", (res * lastPrices[1]));
|
||||
} else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("My Balance LTC");
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
|
||||
if (xrpWallet != null && !"null".equals(xrpWallet) && xrpWallet.length() > 0) {
|
||||
restRequest = HttpHelper.getStringResponse("https://data.ripple.com/v2/accounts/".concat(xrpWallet).concat("/balances"));
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject full = new JSONObject(restRequest);
|
||||
JSONArray balances = (JSONArray) full.get("balances");
|
||||
double res = balances.getJSONObject(0).getDouble("value");
|
||||
if (res > 0d) {
|
||||
resultStr = res + " XRP " + curSym + String.format("%.2f", (res * lastPrices[2]));
|
||||
} else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("My Balance XRP");
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
if (xrpWallet != null && !"null".equals(xrpWallet) && xrpWallet.length() > 0) {
|
||||
restRequest = HttpHelper
|
||||
.getStringResponse("https://data.ripple.com/v2/accounts/".concat(xrpWallet).concat("/balances"));
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject full = new JSONObject(restRequest);
|
||||
JSONArray balances = (JSONArray) full.get("balances");
|
||||
double res = balances.getJSONObject(0).getDouble("value");
|
||||
if (res > 0d) {
|
||||
resultStr = res + " XRP " + curSym + String.format("%.2f", (res * lastPrices[2]));
|
||||
} else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("My Balance XRP");
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
|
||||
if (apikey != null && !"null".equals(apikey) && apikey.length() > 0) {
|
||||
String miningJson = HttpHelper.getStringResponse("https://www.litecoinpool.org/api?api_key=".concat(apikey));
|
||||
if (miningJson != null && miningJson.length() > 0) {
|
||||
JSONObject full = new JSONObject(miningJson);
|
||||
JSONObject user = (JSONObject) full.get("user");
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("HashRate");
|
||||
if (user.getInt("hash_rate") > 0)
|
||||
wi.setValue((user.getInt("hash_rate") / 1000) + " MH/s");
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
if (ethWallet != null && !"null".equals(ethWallet) && ethWallet.length() > 0) {
|
||||
restRequest = HttpHelper
|
||||
.getStringResponse("https://api.etherscan.io/api?module=account&action=balance&address=" + ethWallet
|
||||
+ "&tag=latest&apikey=N54NVXSVSISMQ4QIM2JVKJW56KHCKMU5T4");
|
||||
if (restRequest != null && restRequest.length() > 0) {
|
||||
JSONObject full = new JSONObject(restRequest);
|
||||
String confirmedBalance = (String) full.get("result");
|
||||
|
||||
JSONObject workersJson = (JSONObject) full.get("workers");
|
||||
for (Iterator<String> keys = workersJson.keys(); keys.hasNext();) {
|
||||
String key = keys.next();
|
||||
JSONObject worker = (JSONObject) workersJson.get(key);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("HashRate " + key);
|
||||
wi.setValue((worker.getInt("hash_rate") / 1000) + " MH/s");
|
||||
workers.add(wi);
|
||||
}
|
||||
double res = Double.parseDouble(confirmedBalance);
|
||||
res = res * 0.000000000000000001;
|
||||
if (res > 0d) {
|
||||
resultStr = res + " ETH " + curSym + String.format("%.2f", (res * lastPrices[3]));
|
||||
} else
|
||||
resultStr = "Unknown";
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("My Balance ETH");
|
||||
wi.setValue(resultStr);
|
||||
prices.add(wi);
|
||||
}
|
||||
}
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Paid");
|
||||
if (user.getDouble("paid_rewards") > 0)
|
||||
wi.setValue(user.getDouble("paid_rewards") + " LTC " + curSym + String.format("%.2f", (user.getDouble("paid_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
if (apikey != null && !"null".equals(apikey) && apikey.length() > 0) {
|
||||
String miningJson = HttpHelper
|
||||
.getStringResponse("https://www.litecoinpool.org/api?api_key=".concat(apikey));
|
||||
if (miningJson != null && miningJson.length() > 0) {
|
||||
JSONObject full = new JSONObject(miningJson);
|
||||
JSONObject user = (JSONObject) full.get("user");
|
||||
KeyValue wi = new KeyValue();
|
||||
wi.setKey("HashRate");
|
||||
if (user.getInt("hash_rate") > 0)
|
||||
wi.setValue((user.getInt("hash_rate") / 1000) + " MH/s");
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Unpaid");
|
||||
if (user.getDouble("unpaid_rewards") > 0)
|
||||
wi.setValue(user.getDouble("unpaid_rewards") + " LTC " + curSym + String.format("%.2f", (user.getDouble("unpaid_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
JSONObject workersJson = (JSONObject) full.get("workers");
|
||||
for (Iterator<String> keys = workersJson.keys(); keys.hasNext();) {
|
||||
String key = keys.next();
|
||||
JSONObject worker = (JSONObject) workersJson.get(key);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("HashRate " + key);
|
||||
wi.setValue((worker.getInt("hash_rate") / 1000) + " MH/s");
|
||||
workers.add(wi);
|
||||
}
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Total");
|
||||
if (user.getDouble("total_rewards") > 0)
|
||||
wi.setValue(user.getDouble("total_rewards") + " LTC " + curSym + String.format("%.2f", (user.getDouble("total_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Paid");
|
||||
if (user.getDouble("paid_rewards") > 0)
|
||||
wi.setValue(user.getDouble("paid_rewards") + " LTC " + curSym
|
||||
+ String.format("%.2f", (user.getDouble("paid_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Expected 24h");
|
||||
if (user.getDouble("expected_24h_rewards") > 0)
|
||||
wi.setValue(user.getDouble("expected_24h_rewards") + " LTC " + curSym + String.format("%.2f", (user.getDouble("expected_24h_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Unpaid");
|
||||
if (user.getDouble("unpaid_rewards") > 0)
|
||||
wi.setValue(user.getDouble("unpaid_rewards") + " LTC " + curSym
|
||||
+ String.format("%.2f", (user.getDouble("unpaid_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Past 24h");
|
||||
if (user.getDouble("past_24h_rewards") > 0)
|
||||
wi.setValue(user.getDouble("past_24h_rewards") + " LTC " + curSym + String.format("%.2f", (user.getDouble("past_24h_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Total");
|
||||
if (user.getDouble("total_rewards") > 0)
|
||||
wi.setValue(user.getDouble("total_rewards") + " LTC " + curSym
|
||||
+ String.format("%.2f", (user.getDouble("total_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
|
||||
JSONObject net = (JSONObject) full.get("network");
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Network HashRate");
|
||||
if (net.getLong("hash_rate") > 0)
|
||||
wi.setValue((net.getLong("hash_rate") / 1000000) + " GH/s");
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
network.add(wi);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Expected 24h");
|
||||
if (user.getDouble("expected_24h_rewards") > 0)
|
||||
wi.setValue(user.getDouble("expected_24h_rewards") + " LTC " + curSym
|
||||
+ String.format("%.2f", (user.getDouble("expected_24h_rewards") * lastPrices[1])));
|
||||
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("Past 24h");
|
||||
if (user.getDouble("past_24h_rewards") > 0)
|
||||
wi.setValue(user.getDouble("past_24h_rewards") + " LTC " + curSym
|
||||
+ String.format("%.2f", (user.getDouble("past_24h_rewards") * lastPrices[1])));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
workers.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Next Difficulty");
|
||||
if (net.getDouble("next_difficulty") > 0)
|
||||
wi.setValue("" + net.getDouble("next_difficulty"));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
network.add(wi);
|
||||
JSONObject net = (JSONObject) full.get("network");
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Network HashRate");
|
||||
if (net.getLong("hash_rate") > 0)
|
||||
wi.setValue((net.getLong("hash_rate") / 1000000) + " GH/s");
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
network.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Retarget time");
|
||||
if (net.getDouble("retarget_time") > 0)
|
||||
wi.setValue(splitToComponentTimes(net.getInt("retarget_time")));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
network.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);
|
||||
|
||||
JSONObject poolJson = (JSONObject) full.get("pool");
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Pool HashRate");
|
||||
if (poolJson.getLong("hash_rate") > 0)
|
||||
wi.setValue((poolJson.getLong("hash_rate") / 1000000) + " GH/s");
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
pool.add(wi);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Next Difficulty");
|
||||
if (net.getDouble("next_difficulty") > 0)
|
||||
wi.setValue("" + net.getDouble("next_difficulty"));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
network.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Active users");
|
||||
if (poolJson.getInt("active_users") > 0)
|
||||
wi.setValue("" + poolJson.getInt("active_users"));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
pool.add(wi);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Retarget time");
|
||||
if (net.getDouble("retarget_time") > 0)
|
||||
wi.setValue(splitToComponentTimes(net.getInt("retarget_time")));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
network.add(wi);
|
||||
|
||||
wi = new KeyValue();
|
||||
wi.setKey("PPS Ratio");
|
||||
if (poolJson.getDouble("pps_ratio") > 0)
|
||||
wi.setValue("" + poolJson.getDouble("pps_ratio"));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
pool.add(wi);
|
||||
}
|
||||
}
|
||||
JSONObject poolJson = (JSONObject) full.get("pool");
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Pool HashRate");
|
||||
if (poolJson.getLong("hash_rate") > 0)
|
||||
wi.setValue((poolJson.getLong("hash_rate") / 1000000) + " GH/s");
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
pool.add(wi);
|
||||
|
||||
String res = "<response><prices>#PRICES#</prices><workers>#WORKERS#</workers><pool>#POOL#</pool><network>#NETWORK#</network></response>";
|
||||
wi = new KeyValue();
|
||||
wi.setKey("Active users");
|
||||
if (poolJson.getInt("active_users") > 0)
|
||||
wi.setValue("" + poolJson.getInt("active_users"));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
pool.add(wi);
|
||||
|
||||
String tmp = "";
|
||||
for (KeyValue kv : prices) {
|
||||
tmp = tmp.concat("<pair><key>").concat(kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#PRICES#", tmp);
|
||||
wi = new KeyValue();
|
||||
wi.setKey("PPS Ratio");
|
||||
if (poolJson.getDouble("pps_ratio") > 0)
|
||||
wi.setValue("" + poolJson.getDouble("pps_ratio"));
|
||||
else
|
||||
wi.setValue("Unknown");
|
||||
pool.add(wi);
|
||||
}
|
||||
}
|
||||
|
||||
tmp = "";
|
||||
for (KeyValue kv : workers) {
|
||||
tmp = tmp.concat("<pair><key>").concat(kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#WORKERS#", tmp);
|
||||
String res = "<response><prices>#PRICES#</prices><workers>#WORKERS#</workers><pool>#POOL#</pool><network>#NETWORK#</network></response>";
|
||||
|
||||
tmp = "";
|
||||
for (KeyValue kv : pool) {
|
||||
tmp = tmp.concat("<pair><key>").concat(kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#POOL#", tmp);
|
||||
String tmp = "";
|
||||
for (KeyValue kv : prices) {
|
||||
tmp = tmp.concat("<pair><key>").concat(
|
||||
kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#PRICES#", tmp);
|
||||
|
||||
tmp = "";
|
||||
for (KeyValue kv : network) {
|
||||
tmp = tmp.concat("<pair><key>").concat(kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#NETWORK#", tmp);
|
||||
tmp = "";
|
||||
for (KeyValue kv : workers) {
|
||||
tmp = tmp.concat("<pair><key>").concat(
|
||||
kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#WORKERS#", tmp);
|
||||
|
||||
return res;
|
||||
}
|
||||
tmp = "";
|
||||
for (KeyValue kv : pool) {
|
||||
tmp = tmp.concat("<pair><key>").concat(
|
||||
kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#POOL#", tmp);
|
||||
|
||||
public String getVersion() {
|
||||
return Constants.APP_VERSION;
|
||||
}
|
||||
tmp = "";
|
||||
for (KeyValue kv : network) {
|
||||
tmp = tmp.concat("<pair><key>").concat(
|
||||
kv.getKey().concat("</key>").concat("<value>").concat(kv.getValue()).concat("</value></pair>"));
|
||||
}
|
||||
res = res.replace("#NETWORK#", tmp);
|
||||
|
||||
public static String splitToComponentTimes(int longVal) {
|
||||
int days = longVal / (24 * 3600);
|
||||
int remainder = longVal - (days * 24 * 3600);
|
||||
int hours = remainder / 3600;
|
||||
remainder = remainder - hours * 3600;
|
||||
int mins = remainder / 60;
|
||||
//remainder = remainder - mins * 60;
|
||||
//int secs = remainder;
|
||||
return res;
|
||||
}
|
||||
|
||||
return (days>0?days+"d ":"")+(hours>0?hours+"h ":"")+(mins>0?mins+"m ":"");
|
||||
}
|
||||
public String getVersion() {
|
||||
return Constants.APP_VERSION;
|
||||
}
|
||||
|
||||
public static String splitToComponentTimes(int longVal) {
|
||||
int days = longVal / (24 * 3600);
|
||||
int remainder = longVal - (days * 24 * 3600);
|
||||
int hours = remainder / 3600;
|
||||
remainder = remainder - hours * 3600;
|
||||
int mins = remainder / 60;
|
||||
// remainder = remainder - mins * 60;
|
||||
// int secs = remainder;
|
||||
|
||||
return (days > 0 ? days + "d " : "") + (hours > 0 ? hours + "h " : "") + (mins > 0 ? mins + "m " : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
<script language=javascript type='text/javascript'>
|
||||
function asynchUpdate() {
|
||||
AX_asynchUpdate("<%=request.getParameter("apikey")%>", "<%=request.getParameter("ltc")%>", "<%=request.getParameter("xrp")%>", "<%=request.getParameter("cur")%>");
|
||||
AX_asynchUpdate("<%=request.getParameter("apikey")%>", "<%=request.getParameter("ltc")%>", "<%=request.getParameter("eth")%>", "<%=request.getParameter("xrp")%>", "<%=request.getParameter("cur")%>");
|
||||
setTimeout('asynchUpdate();', 5000);
|
||||
}
|
||||
asynchUpdate();
|
||||
|
||||
@ -73,8 +73,8 @@ function ajaxGetXmlResponse() {
|
||||
}
|
||||
}
|
||||
|
||||
function AX_asynchUpdate(apikey, ltc, xrp, cur) {
|
||||
var data = 'ajaxMethod=asynchUpdate&apikey=' + apikey + '<c=' + ltc
|
||||
function AX_asynchUpdate(apikey, ltc, eth, xrp, cur) {
|
||||
var data = 'ajaxMethod=asynchUpdate&apikey=' + apikey + '<c=' + ltc + 'ð=' + eth
|
||||
+ '&xrp=' + xrp+ '&cur=' + cur;
|
||||
ajaxSendRequest(data, AX_asynchUpdateResponse);
|
||||
}
|
||||
|
||||
@ -27,6 +27,12 @@
|
||||
style='transition: text-shadow 0.7s ease-in-out;'><input
|
||||
type="text" name="ltc" size="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='group'>Ethereum wallet address (optional)</td>
|
||||
<td align="right" class='group'
|
||||
style='transition: text-shadow 0.7s ease-in-out;'><input
|
||||
type="text" name="eth" size="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='group'>Ripple wallet address (optional)</td>
|
||||
<td align="right" class='group'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user