Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #122 from NanoTools/develop
Browse files Browse the repository at this point in the history
1.5.1
  • Loading branch information
BitDesert authored Jun 30, 2019
2 parents 868e432 + c8c7800 commit 1f93a6f
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 119 deletions.
7 changes: 6 additions & 1 deletion api.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
$data->nanoNodeAccountUrl = getAccountUrl($data->nanoNodeAccount, $blockExplorer);

// -- Get Version String from nano node and node monitor
$data->version = getVersion($ch);
$version = getVersion($ch);
$data->version = $version->{'node_vendor'};
$data->store_version = (int) $version->{'store_version'} ?: 0;
$data->protocol_version = (int) $version->{'protocol_version'} ?: 0;

// Cache the github query for latest node version
global $nodeVersionCache;
Expand All @@ -57,6 +60,7 @@
$rpcBlockCount = getBlockCount($ch);
$data->currentBlock = (int) $rpcBlockCount->{'count'};
$data->uncheckedBlocks = (int) $rpcBlockCount->{'unchecked'};
$data->cementedBlocks = (int) $rpcBlockCount->{'cemented'} ?: 0;

if ($currency == 'nano') {
$data->blockSync = getSyncStatus($data->currentBlock);
Expand Down Expand Up @@ -138,6 +142,7 @@
$data->totalMem = getSystemTotalMem();
//$data->uname = getUname();
$data->nanoNodeName = $nanoNodeName;
$data->nodeUptimeStartup = (int) getUptime($ch)->{'seconds'} ?: 0;

// get the node uptime (if we have a api key)
if ($uptimerobotApiKey) {
Expand Down
63 changes: 7 additions & 56 deletions contribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<h3>Contribute to <?php echo currencyName($currency); ?> Node Monitor</h3>
<p>
If you want to contribute to <?php echo currencyName($currency); ?> Node Monitor and further improve it, your help is very welcome. Have a look at its <a href="https://github.com/NanoTools/nanoNodeMonitor" target="_blank">GitHub page</a>, browse through open issues, check out the source code, create a branch, develop features, fix some bugs, and open pull requests. Development follows the standard <a href="https://guides.github.com/introduction/flow/" target="_blank">GitHub Flow</a> method.
If you want to contribute to <?php echo currencyName($currency); ?> Node Monitor and further improve it, your help is very welcome. Have a look at its <a href="https://github.com/NanoTools/nanoNodeMonitor" target="_blank" rel="noopener">GitHub page</a>, browse through open issues, check out the source code, create a branch, develop features, fix some bugs, and open pull requests. Development follows the standard <a href="https://guides.github.com/introduction/flow/" target="_blank" rel="noopener">GitHub Flow</a> method.
</p>

<br>
Expand All @@ -17,64 +17,15 @@

<p>
Donations support the efforts of the <?php echo currencyName($currency); ?> community to further decentralize the <?php echo currencyName($currency); ?> network by running representative nodes.
Please consider donating to the maintainer of this <?php echo currencyName($currency); ?> node to help cover some of its costs. Simply click the BrainBlocks button below.
Please consider donating to the maintainer of this <?php echo currencyName($currency); ?> node to help cover some of its costs. Simply scan the QR code with your wallet app.
</p>


<div class="row">
<div class="col-3">

<div class="form-group">
<div class="input-group mb-3">
<input id="bbAmountNode" class="form-control" aria-label="Amount" type="text" value="0.1">
<div class="input-group-append">
<span class="input-group-text">NANO</span>
</div>
</div>
</div>

</div>
</div>

<div id="bb-button"></div>

<div id="donateMessage" class="alert alert-dismissible alert-success" style="display:none;">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>Thanks!</strong> Your support helps a lot!
</div>

<script>
init.push(function(){
$( "#bbAmountNode" ).keyup(updateBrainButton);
updateBrainButton();
});

function updateBrainButton() {
$('#bb-button').empty();
brainblocks.Button.render({
// Pass in payment options
payment: {
destination: '<?php echo $nanoDonationAccount; ?>',
currency: 'rai',
amount: $('#bbAmountNode').val() * 1000000
},

// Handle successful payments

onPayment: function(data) {
$('#donateMessage').show();
console.log('Payment successful!', data.token);
}

}, '#bb-button');
};

</script>

<script src="https://brainblocks.io/brainblocks.min.js"></script>

<a href="nano:<?php echo $nanoNodeAccount; ?>">
<img src="https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=nano:<?php echo $nanoNodeAccount; ?>&choe=UTF-8"
title="QR code for <?php echo $nanoNodeAccount; ?>"
style="max-width:250px; display:block;" />
</a>
<br>

<!--- add the footer -->

<?php include 'modules/footer.php'; ?>
6 changes: 4 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
<div class="page-header mb-3" id="banner">
<div class="row">
<div class="col-lg-8 col-md-6 col-sm-6">
<a href="<?php echo $coinURL; ?>" target="_blank">
<a href="<?php echo $coinURL; ?>" target="_blank" rel="noopener">
<img src="static/img/nano-full-<?php echo $themeChoice; ?>.svg" width="220" alt="Logo"/>
</a>
<p class="lead mt-2"><?php echo currencyName($currency); ?> Node Monitor</p>
<p><?php echo $welcomeMsg; ?></p>

<div class="btn-group mb-3">
<?php foreach ($socials as $socialkey => $socialvalue): ?>
<a href="<?php echo $socialvalue; ?>" target="_blank" class="btn btn-secondary"><i class="fab fa-<?php echo $socialkey; ?>"></i></a>
<a href="<?php echo $socialvalue; ?>" target="_blank" rel="noopener" class="btn btn-secondary" aria-label="Social Media">
<i class="fab fa-<?php echo $socialkey; ?>"></i>
</a>
<?php endforeach; ?>
</div>

Expand Down
2 changes: 1 addition & 1 deletion modules/constants.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// the project version
define('PROJECT_VERSION', '1.5.0');
define('PROJECT_VERSION', '1.5.1');

// project URL
define('PROJECT_URL', 'https://github.com/NanoTools/nanoNodeMonitor');
Expand Down
13 changes: 6 additions & 7 deletions modules/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
?>

<br>
Made by <a href="https://github.com/NanoTools" target="_blank">Nano Tools</a>.
Made by <a href="https://github.com/NanoTools" target="_blank" rel="noopener">Nano Tools</a>.
<br>
GitHub: <a href="<?php echo PROJECT_URL; ?>" target="_blank">Source</a> | <a href="<?php echo PROJECT_URL . '/wiki'; ?>" target="_blank">Wiki</a> | <a href="<?php echo PROJECT_URL . '/wiki/API-Description'; ?>" target="_blank">API</a>
GitHub: <a href="<?php echo PROJECT_URL; ?>" target="_blank" rel="noopener">Source</a> | <a href="<?php echo PROJECT_URL . '/wiki'; ?>" target="_blank" rel="noopener">Wiki</a> | <a href="<?php echo PROJECT_URL . '/wiki/API-Description'; ?>" target="_blank" rel="noopener">API</a>
</p>

<hr class=light>
Expand All @@ -42,18 +42,17 @@
}
?>

Donations to <?php echo currencyName($currency); ?> Node Monitor: <a href="<?php echo getAccountUrl($donAccount, $blockExplorer); ?>" target="_blank"><?php echo $donAccount; ?></a>
Donations to <?php echo currencyName($currency); ?> Node Monitor: <a href="<?php echo getAccountUrl($donAccount, $blockExplorer); ?>" target="_blank" rel="noopener"><?php echo $donAccount; ?></a>
</small>
<button id="copyAccount" class="btn btn-sm btn-link btn-clipboard-light" data-clipboard-text="<?php echo $donAccount; ?>" title="Copy"><i class="fas fa-clipboard fa-lg"></i></button>
</p>
</footer>

</div><!-- /container -->

<script src="static/js/jquery-3.3.1.min.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/popper.min.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/bootstrap.min.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/handlebars-v4.0.11.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/axios.min.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/bootstrap-native-v4.min.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/handlebars-v4.1.2.js?v=<?php echo PROJECT_VERSION; ?>"></script>
<script src="static/js/main.js?v=<?php echo PROJECT_VERSION; ?>"></script>

<?php
Expand Down
4 changes: 2 additions & 2 deletions modules/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function getVersionInformation($latestVersion)
{
$versionInfo .= "<br>A new version " . $latestVersion;
$versionInfo .= " is available on ";
$versionInfo .= "<a href=\"" . PROJECT_URL . "\" target=\"_blank\">GitHub.</a>";
$versionInfo .= "<a href=\"" . PROJECT_URL . "\" target=\"_blank\" rel=\"noopener\">GitHub.</a>";
}

return $versionInfo;
Expand Down Expand Up @@ -534,5 +534,5 @@ function getConfirmationsDurationPercentile($percentile, $array) {
else {
$result = $array[floor($index)]->{'duration'};
}
return $result;
return (int) $result;
}
24 changes: 22 additions & 2 deletions modules/functions_rpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ function getVersion($ch)
$data = array("action" => "version");

// post curl
return postCurl($ch, $data)->{'node_vendor'};
return postCurl($ch, $data);
}

// get block count from nano_node
function getBlockCount($ch)
{
// get block count
$data = array("action" => "block_count");
$data = array("action" => "block_count", "include_cemented" => "true");

// post curl
return postCurl($ch, $data);
Expand Down Expand Up @@ -112,3 +112,23 @@ function getConfirmationHistory($ch)
// post curl
return postCurl($ch, $data);
}

// get node uptime
function getUptime($ch)
{
// get uptime
$data = array("action" => "uptime");

// post curl
return postCurl($ch, $data);
}

// get active difficulty
function getActiveDifficulty($ch)
{
// get uptime
$data = array("action" => "active_difficulty");

// post curl
return postCurl($ch, $data);
}
8 changes: 7 additions & 1 deletion modules/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@

<title><?php echo currencyName($currency); ?> Node Monitor - <?php echo $nanoNodeName; ?></title>

<meta name="Description" content="Nano Node Monitor is a server-side PHP-based monitor for Nano nodes.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="robots" content="noindex" />
<meta name="robots" content="all" />
<link rel="stylesheet" href="static/css/bootstrap.min.css?v=<?php echo PROJECT_VERSION; ?>" media="screen">
<link rel="stylesheet" href="static/css/fontawesome-all.min.css?v=<?php echo PROJECT_VERSION; ?>" media="screen">
<link rel="stylesheet" href="static/css/main.css?v=<?php echo PROJECT_VERSION; ?>" media="screen">
<link rel="stylesheet" href="static/themes/<?php echo $themeChoice; ?>/css/theme.css?v=<?php echo PROJECT_VERSION; ?>" media="screen">
<link rel="icon" href="static/img/nano-mark-light.png">
<meta property="og:title" content="<?php echo currencyName($currency); ?> Node Monitor - <?php echo $nanoNodeName; ?>">
<meta property="og:description" content="Nano Node Monitor">
<meta property="og:type" content="website">
<meta property="og:image" content="static/img/nano-mark-light.png">
<meta name="nano" content="<?php echo $nanoDonationAccount; ?>">
</head>
<body>
<script>
Expand Down
2 changes: 1 addition & 1 deletion modules/navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</li>

<li class="nav-item">
<a class="nav-link" href="<?php echo PROJECT_URL; ?>" target="_blank">GitHub Project</a>
<a class="nav-link" href="<?php echo PROJECT_URL; ?>" target="_blank" rel="noopener">GitHub Project</a>
</li>
</ul>

Expand Down
8 changes: 4 additions & 4 deletions static/css/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/css/bootstrap.min.css.map

Large diffs are not rendered by default.

Loading

0 comments on commit 1f93a6f

Please sign in to comment.