2018-08-12 13:46:08 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
font-family: "Courier New", Courier, monospace;
|
|
|
|
}
|
|
|
|
header {
|
|
|
|
font-size: larger;
|
|
|
|
font-weight: bold;
|
|
|
|
padding-bottom: 1em;
|
|
|
|
}
|
2019-03-21 03:55:09 +00:00
|
|
|
table {
|
2019-03-08 03:50:58 +00:00
|
|
|
padding-bottom: 1em;
|
|
|
|
}
|
2019-05-04 04:00:27 +00:00
|
|
|
td {
|
|
|
|
vertical-align: top;
|
2019-05-04 20:21:46 +00:00
|
|
|
white-space: nowrap;
|
2019-05-04 04:00:27 +00:00
|
|
|
}
|
|
|
|
td:last-child {
|
|
|
|
white-space: unset;
|
|
|
|
}
|
2020-01-05 09:33:56 +00:00
|
|
|
.miner {
|
2018-08-12 13:46:08 +00:00
|
|
|
display: none;
|
|
|
|
}
|
2020-01-05 09:33:56 +00:00
|
|
|
td.address {
|
|
|
|
min-width: 10ch;
|
|
|
|
max-width: 10ch;
|
|
|
|
overflow: hidden;
|
|
|
|
border-bottom: 1px dashed black;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
word-wrap: unset;
|
|
|
|
}
|
|
|
|
td.address:focus {
|
|
|
|
outline: 0px solid transparent;
|
|
|
|
text-overflow: initial;
|
|
|
|
white-space: initial;
|
|
|
|
word-wrap: break-word;
|
|
|
|
}
|
2018-08-12 13:46:08 +00:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2019-03-08 03:50:58 +00:00
|
|
|
<header>Monero Mining Pool</header>
|
2018-08-12 13:46:08 +00:00
|
|
|
<table>
|
2019-03-03 20:26:11 +00:00
|
|
|
<tr><td>Pool HR: </td><td id="pool_hashrate"></td></tr>
|
|
|
|
<tr><td>Network HR: </td><td id="network_hashrate"></td></tr>
|
2019-05-04 04:00:27 +00:00
|
|
|
<tr><td>Network height: </td><td id="network_height"></td></tr>
|
2019-03-03 20:26:11 +00:00
|
|
|
<tr><td>Blocks found: </td><td id="pool_blocks_found"></td></tr>
|
|
|
|
<tr><td>Last block found: </td><td id="last_block_found"></td></tr>
|
2019-05-12 16:50:40 +00:00
|
|
|
<tr><td>Last template: </td><td id="last_template_fetched"></td></tr>
|
2019-03-03 20:26:11 +00:00
|
|
|
<tr><td>Payment threshold: </td><td id="payment_threshold"></td></tr>
|
|
|
|
<tr><td>Pool fee: </td><td id="pool_fee"></td></tr>
|
|
|
|
<tr><td>Pool port: </td><td id="pool_port"></td></tr>
|
2019-07-05 21:28:04 +00:00
|
|
|
<tr><td>Allow self-select: </td><td id="allow_self_select"></td></tr>
|
2019-03-03 20:26:11 +00:00
|
|
|
<tr><td>Miners connected: </td><td id="connected_miners"></td></tr>
|
2020-01-05 09:33:56 +00:00
|
|
|
<tr class="miner"><td>Your HR: </td><td id="miner_hashrate"></td></tr>
|
|
|
|
<tr class="miner"><td>Balance due: </td><td id="miner_balance"></td></tr>
|
|
|
|
<tr><td>Miner address: </td><td class="address" contenteditable="true"></td></tr>
|
2018-08-12 13:46:08 +00:00
|
|
|
</table>
|
2019-03-08 03:50:58 +00:00
|
|
|
<small><a href="https://github.com/jtgrassie/monero-pool">https://github.com/jtgrassie/monero-pool</a></small>
|
2018-08-12 13:46:08 +00:00
|
|
|
<script>
|
2019-05-12 16:50:40 +00:00
|
|
|
function format_last_time(last)
|
2019-03-03 20:26:11 +00:00
|
|
|
{
|
|
|
|
var now = new Date().getTime() / 1000;
|
|
|
|
var diff = now - last;
|
2019-05-12 16:50:40 +00:00
|
|
|
var v;
|
2019-03-03 20:26:11 +00:00
|
|
|
if (last == 0)
|
|
|
|
return "None yet";
|
|
|
|
else if (diff < 60)
|
2019-05-12 16:50:40 +00:00
|
|
|
{
|
|
|
|
v = parseInt(diff);
|
|
|
|
return v + " second" + (v != 1 ? "s" : "") + " ago";
|
|
|
|
}
|
2019-03-03 20:26:11 +00:00
|
|
|
else if (diff < 3600)
|
2019-05-12 16:50:40 +00:00
|
|
|
{
|
|
|
|
v = parseInt(diff/60);
|
|
|
|
return v + " minute" + (v != 1 ? "s" : "") + " ago";
|
|
|
|
}
|
2019-03-03 20:26:11 +00:00
|
|
|
else if (diff < 86400)
|
2019-05-12 16:50:40 +00:00
|
|
|
{
|
|
|
|
v = parseInt(diff/3600);
|
|
|
|
return v + " hour" + (v != 1 ? "s" : "") + " ago";
|
|
|
|
}
|
2019-03-03 20:26:11 +00:00
|
|
|
else
|
2019-05-12 16:50:40 +00:00
|
|
|
{
|
|
|
|
v = parseInt(diff/86400);
|
|
|
|
return v + " day" + (v != 1 ? "s" : "") + " ago";
|
|
|
|
}
|
2019-03-03 20:26:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function format_hashrate(hr)
|
|
|
|
{
|
|
|
|
if (hr < 1000)
|
|
|
|
return parseInt(hr) + " H/s";
|
|
|
|
else if (hr < 1000000)
|
|
|
|
return parseFloat(hr/1000).toFixed(2) + " KH/s";
|
2019-12-30 04:56:48 +00:00
|
|
|
else if (hr < 1000000000)
|
2019-03-03 20:26:11 +00:00
|
|
|
return parseFloat(hr/1000000).toFixed(2) + " MH/s";
|
|
|
|
else
|
2019-12-30 04:56:48 +00:00
|
|
|
return parseFloat(hr/1000000000).toFixed(2) + " GH/s";
|
2019-03-03 20:26:11 +00:00
|
|
|
}
|
|
|
|
|
2020-01-05 09:33:56 +00:00
|
|
|
var wf = document.querySelector(".address");
|
2019-03-03 20:26:11 +00:00
|
|
|
var xhr = new XMLHttpRequest();
|
2019-03-21 03:55:09 +00:00
|
|
|
|
2019-03-03 20:26:11 +00:00
|
|
|
xhr.onload = function()
|
|
|
|
{
|
|
|
|
var stats = JSON.parse(xhr.responseText);
|
|
|
|
for (var e in stats)
|
|
|
|
{
|
|
|
|
var el = document.querySelector("#"+e);
|
2019-03-21 03:55:09 +00:00
|
|
|
if (!el)
|
|
|
|
continue;
|
2019-05-12 16:50:40 +00:00
|
|
|
if (e == "last_block_found" || e == "last_template_fetched")
|
|
|
|
el.innerHTML = format_last_time(stats[e]);
|
2019-03-03 20:26:11 +00:00
|
|
|
else if (/hashrate/.test(e))
|
|
|
|
el.innerHTML = format_hashrate(stats[e]);
|
2019-05-12 21:31:54 +00:00
|
|
|
else if (e == "pool_fee")
|
|
|
|
el.innerHTML = (stats[e]*100) + "%";
|
2019-07-05 21:28:04 +00:00
|
|
|
else if (e == "allow_self_select")
|
|
|
|
el.innerHTML = stats[e] == 1 ? "Yes" : "No";
|
2019-03-03 20:26:11 +00:00
|
|
|
else
|
|
|
|
el.innerHTML = stats[e];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-01-05 09:33:56 +00:00
|
|
|
wf.onblur = function(e)
|
2018-08-12 13:46:08 +00:00
|
|
|
{
|
|
|
|
var d = new Date();
|
|
|
|
d.setTime(d.getTime() + (86400 * 365 * 1000));
|
2020-01-05 09:33:56 +00:00
|
|
|
document.cookie = "wa=" + this.innerText + ";expires=" + d.toGMTString();
|
2018-08-12 13:46:08 +00:00
|
|
|
window.location.reload();
|
|
|
|
return false;
|
|
|
|
};
|
2019-03-21 03:55:09 +00:00
|
|
|
|
2018-08-12 13:46:08 +00:00
|
|
|
window.onload = function()
|
|
|
|
{
|
|
|
|
if (/wa=[0-9a-fA-F]+/.test(document.cookie))
|
|
|
|
{
|
2020-01-05 09:33:56 +00:00
|
|
|
var m = document.querySelectorAll(".miner");
|
|
|
|
for (var i=0; i<m.length; i++)
|
2018-08-12 13:46:08 +00:00
|
|
|
{
|
2020-01-05 09:33:56 +00:00
|
|
|
m[i].style = "display: table-row;";
|
|
|
|
}
|
2018-08-12 13:46:08 +00:00
|
|
|
var c = document.cookie.split("=");
|
2020-01-05 09:33:56 +00:00
|
|
|
wf.innerText = c[1];
|
2018-08-12 13:46:08 +00:00
|
|
|
}
|
2019-03-07 22:17:11 +00:00
|
|
|
var get_stats = function()
|
2018-08-12 13:46:08 +00:00
|
|
|
{
|
2019-03-07 22:17:11 +00:00
|
|
|
xhr.open("GET", "/stats");
|
2019-03-03 20:26:11 +00:00
|
|
|
xhr.send(null);
|
2019-03-07 22:17:11 +00:00
|
|
|
};
|
|
|
|
setInterval(get_stats, 30000);
|
|
|
|
get_stats();
|
2018-08-12 13:46:08 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|