Fixed Uptime column in Dashboard
Implemented HTTPS for miner -> server and server -> dashboard
This commit is contained in:
parent
054b302ab5
commit
1330ffae0b
3 changed files with 14 additions and 6 deletions
14
index.html
14
index.html
|
@ -46,7 +46,7 @@
|
||||||
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.0/js/buttons.bootstrap.min.js"></script>
|
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.0/js/buttons.bootstrap.min.js"></script>
|
||||||
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.2.4/js/dataTables.select.min.js"></script>
|
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.2.4/js/dataTables.select.min.js"></script>
|
||||||
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.6.1/jquery.timeago.min.js"></script>
|
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.6.1/jquery.timeago.min.js"></script>
|
||||||
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment-duration-format/2.2.1/moment-duration-format.min.js"></script>
|
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script>
|
||||||
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
|
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||||
<script src="https://use.fontawesome.com/6b3cdfc597.js"></script>
|
<script src="https://use.fontawesome.com/6b3cdfc597.js"></script>
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
{data: "client_status.avg_time", className: "right"},
|
{data: "client_status.avg_time", className: "right"},
|
||||||
{data: "client_status.shares_good", className: "right"},
|
{data: "client_status.shares_good", className: "right"},
|
||||||
{data: "client_status.shares_total", className: "right"},
|
{data: "client_status.shares_total", className: "right"},
|
||||||
{data: "client_status.uptime", render: uptime},
|
{data: "client_status.uptime", render: uptime, className: "right"},
|
||||||
{data: "client_status.last_status_update", render: laststatus},
|
{data: "client_status.last_status_update", render: laststatus},
|
||||||
{
|
{
|
||||||
data: null,
|
data: null,
|
||||||
|
@ -454,7 +454,13 @@
|
||||||
|
|
||||||
function uptime( data, type, row ) {
|
function uptime( data, type, row ) {
|
||||||
if (type !== 'sort') {
|
if (type !== 'sort') {
|
||||||
return moment.duration(data, "milliseconds");
|
var lastStatus = row.client_status.last_status_update * 1000;
|
||||||
|
|
||||||
|
if (isOnline(lastStatus)) {
|
||||||
|
return numeral(data/1000).format('00:00:00:00');
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -604,6 +610,7 @@
|
||||||
|
|
||||||
<th>Shares Good</th>
|
<th>Shares Good</th>
|
||||||
<th>Shares Total</th>
|
<th>Shares Total</th>
|
||||||
|
<th>Uptime</th>
|
||||||
<th>Last Update</th>
|
<th>Last Update</th>
|
||||||
<th>Edit</th>
|
<th>Edit</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -625,6 +632,7 @@
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -297,7 +297,7 @@ std::shared_ptr<httplib::Response> CCClient::performRequest(const std::string& r
|
||||||
void CCClient::refreshUptime()
|
void CCClient::refreshUptime()
|
||||||
{
|
{
|
||||||
std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
|
std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
|
||||||
auto uptime = std::chrono::duration_cast<std::chrono::milliseconds>(m_self->m_startTime - now);
|
auto uptime = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_self->m_startTime);
|
||||||
|
|
||||||
m_self->m_clientStatus.setUptime(static_cast<uint64_t>(uptime.count()));
|
m_self->m_clientStatus.setUptime(static_cast<uint64_t>(uptime.count()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,8 @@ bool Httpd::start()
|
||||||
m_daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL,
|
m_daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL,
|
||||||
static_cast<uint16_t>(m_options->ccPort()), nullptr, nullptr, &Httpd::handler,
|
static_cast<uint16_t>(m_options->ccPort()), nullptr, nullptr, &Httpd::handler,
|
||||||
this, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 10,
|
this, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 10,
|
||||||
MHD_OPTION_HTTPS_MEM_KEY, m_keyPem,
|
MHD_OPTION_HTTPS_MEM_KEY, m_keyPem.c_str(),
|
||||||
MHD_OPTION_HTTPS_MEM_CERT, m_certPem,
|
MHD_OPTION_HTTPS_MEM_CERT, m_certPem.c_str(),
|
||||||
MHD_OPTION_END);
|
MHD_OPTION_END);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue