added last update of workers info

This commit is contained in:
rdavidek 2021-05-27 11:07:16 +02:00
parent 2810fb8b24
commit 81ce678364
3 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,8 @@ package cz.kamma.mining;
public interface Constants {
public static final String APP_VERSION = "v0.7";
public static final String APP_VERSION = "v0.8";
public static final String COPYRIGHT = "2021";
public static final int DEFAULT_HTTP_TIMEOUT = 2000;
public static final int RELOAD_TIME = 20000;
}

View File

@ -1,8 +1,6 @@
package cz.kamma.mining.bean;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@ -21,6 +19,7 @@ import cz.kamma.mining.vo.KeyValue;
public class MiningBean {
public static String updateAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
java.lang.System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
List<KeyValue> prices = new ArrayList<>();
List<KeyValue> workers = new ArrayList<>();
@ -56,7 +55,7 @@ public class MiningBean {
String resultStr;
String restRequest;
for (int i = 0; i < cryptoCur.length; i++) {
String ccur = cryptoCur[i];
restRequest = HttpHelper
@ -314,7 +313,6 @@ public class MiningBean {
long time = block.getLong("time");
String finder = block.getString("finder");
double amount = block.getDouble("amount");
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
wi.setValue("" + sdf.format(new Date(time*1000)) + " - "+finder + " - "+amount);
} else
wi.setValue("Unknown");
@ -388,6 +386,11 @@ public class MiningBean {
}
}
KeyValue wi = new KeyValue();
wi.setKey("Last Update");
wi.setValue("" + sdf.format(new Date(System.currentTimeMillis())));
workers.add(0, wi);
String res = "<response><prices>#PRICES#</prices><workers>#WORKERS#</workers><pool>#POOL#</pool><network>#NETWORK#</network></response>";

View File

@ -25,7 +25,7 @@
<script language=javascript type='text/javascript'>
function asynchUpdate() {
AX_asynchUpdate("<%=request.getParameter("ltcapikey")%>", "<%=request.getParameter("dogapikey")%>", "<%=request.getParameter("ltc")%>", "<%=request.getParameter("eth")%>", "<%=request.getParameter("xrp")%>", "<%=request.getParameter("cur")%>");
setTimeout('asynchUpdate();', 15000);
setTimeout('asynchUpdate();', <%=Constants.RELOAD_TIME%>);
}
asynchUpdate();
</script>