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

Commit

Permalink
Contrib (#15)
Browse files Browse the repository at this point in the history
* refactored footer + navbar
* fixed main nano node monitor link
* styled donation buttons
* removed hover effect
* added version information 
* added contribution page with configurable brainblocks donations; minor fixes and additions
* updated README
  • Loading branch information
dbachm123 authored Mar 17, 2018
1 parent 482fc43 commit e8696d6
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 41 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Currently, the following information is displayed:
* Representative
* Market data from coinmarketcap.com

## Installation
## First Installation

To use Nano Node Monitor, you will need to setup a Nano node (either [standalone](https://github.com/nanocurrency/raiblocks/releases) or as a [docker image](https://github.com/nanocurrency/raiblocks/wiki/Docker-node)), and a webserver on the same (Linux) machine. See the "Links" section below for tutorials on that.

Expand Down Expand Up @@ -85,6 +85,9 @@ $nanoNodeRPCIP = '[::1]';
$nanoNodeRPCPort = '7076';
```

## Updating
Switch to your installation directory and execute `git pull`.

## Links

* [How to run your own Nano node on DigitalOcean](https://medium.com/@seanomlor/how-to-run-your-own-raiblocks-node-on-digitalocean-6a5a2492c29b)
Expand Down
114 changes: 114 additions & 0 deletions contribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php

// include required files
require_once __DIR__.'/modules/includes.php';

session_start();

$_SESSION["nanoNodeMonDonationAccount"]=NODEMON_DON_ACCOUNT;
$_SESSION["nanoDonationAccount"]=$nanoDonationAccount;
$_SESSION["verifyUrl"]=BB_VERIFY_URL;

?>

<!DOCTYPE html>
<html lang="en">

<script src="static/js/jquery-3.3.1.min.js"></script>

<head>
<meta charset="utf-8">

<title>Nano Node Monitor - <?php echo $nanoNodeName; ?></title>

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="robots" content="noindex" />
<link rel="stylesheet" href="static/css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="static/css/custom.css" media="screen">
</head>
<body>

<!--- add the navbar -->
<?php include 'modules/navbar.php'; ?>


<!--- logo -->
<div class="container">

<div class="page-header mb-3" id="banner">
<div class="row">
<div class="col-lg-8 col-md-7 col-sm-6">
<a href="https://nano.org" target="_blank">
<img src="static/img/logo-white.svg" width="220" alt="Nano Logo"/>
</a>
<p class="lead">Nano Node Monitor</p>
</div>
</div>
</div>

<div id="content"></div>

<h2>Contribute</h2>
<p>
If you want to contribute to Nano Node Monitor and further improve it, your help is very welcome. Have a look at its <a href="https://github.com/dbachm123/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.
</p>

<h2>Donate</h2>

<?php
$verifyUrl=$_SESSION["verifyUrl"];
$cancelUrl=(isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
?>

Donations support the efforts of the Nano community to further decentralize the Nano network by running representative nodes.


<!-- donate to the maintainer -->
<p>
Donate to the maintainer of this Nano node to help cover some of its costs.
</p>
<a id ="bbPaymentUrlNode" href="https://brainblocks.io/checkout?payment.destination=<?php echo $_SESSION["nanoDonationAccount"]; ?>&payment.currency=rai&urls.return=<?php echo $verifyUrl; ?>&urls.cancel=<?php echo $cancelUrl; ?>&payment.amount=" target="_blank" class="donationButton">Donate</a>
<input id="bbAmountNode" type="number" value="1"/> Nano

<p>&nbsp;</p>


<!-- donate to the maintainer -->
<p>
Donate to the developers of <a href="https://github.com/dbachm123/nanoNodeMonitor" target="_blank">Nano Node Monitor</a> to support further development.
</p>
<a id ="bbPaymentUrlDev" href="https://brainblocks.io/checkout?payment.destination=<?php echo $_SESSION["nanoNodeMonDonationAccount"]; ?>&payment.currency=rai&urls.return=<?php echo $verifyUrl; ?>&urls.cancel=<?php echo $cancelUrl; ?>&payment.amount=" target="_blank" class="donationButton">Donate</a>
<input id="bbAmountDev" type="number" value="1"/> Nano

<script>
$(function() {
$('#bbPaymentUrlNode').click( function() {
window.open($(this).attr('href') + $('#bbAmountNode').val() * 1000000); // *1000000 --> "Nano" units
return false;
});
});

$(function() {
$('#bbPaymentUrlDev').click( function() {
window.open($(this).attr('href') + $('#bbAmountDev').val() * 1000000); // *1000000 --> "Nano" units
return false;
});
});

</script>


</p>

<!--- add the footer -->
<?php include 'modules/footer.php'; ?>

</div>

<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/handlebars-v4.0.11.js"></script>
<script src="https://files.coinmarketcap.com/static/widget/currency.js"></script>
<script src="static/js/index.js"></script>
</body>
</html>
38 changes: 7 additions & 31 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,12 @@
</head>
<body>
<script>var GLOBAL_REFRESH = <?php echo $autoRefreshInSeconds; ?></script>
<div class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<a href="../" class="navbar-brand">Nano Node Monitor</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">

<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="https://www.nanode.co/account/<?php echo $nanoDonationAccount; ?>" target="_blank">Donate</a>
</li>
<li class="nav-item">

<a class="nav-link" href="https://github.com/dbachm123/nanoNodeMonitor" target="_blank">Source on GitHub</a>

</li>
</ul>

</div>
</div>
</div>

<!--- add the navbar -->
<?php include 'modules/navbar.php'; ?>

<!-- logo and ticker -->
<div class="container">

<div class="page-header mb-3" id="banner">
Expand Down Expand Up @@ -77,18 +59,11 @@
</div>
</div>

<!-- main content -->
<div id="content"></div>

<footer id="footer">
<div class="row">
<div class="col-lg-12">

<p>Version: <?php echo PROJECT_VERSION; ?></p>

<p>Contributors: <a href="https://github.com/dbachm123">dbachm123</a>, <a href="https://github.com/BitDesert">BitDesert</a>, <a href="https://github.com/NiFNi">NiFNi</a></p>
</div>
</div>
</footer>
<!--- add the footer -->
<?php include 'modules/footer.php'; ?>

</div>

Expand All @@ -97,5 +72,6 @@
<script src="static/js/handlebars-v4.0.11.js"></script>
<script src="https://files.coinmarketcap.com/static/widget/currency.js"></script>
<script src="static/js/index.js"></script>

</body>
</html>
10 changes: 6 additions & 4 deletions modules/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

// FIRST USE
// Please copy this file as config.php
// To edit a config uncomment the line

// To edit a config uncomment the line, otherwise
// defaults will be used for each variable.

// ----------- General Variables -----------

Expand Down Expand Up @@ -35,8 +37,8 @@
// ip address for RPC (default: 7076)
// $nanoNodeRPCPort = '7076';

// node account
// account of this node
// $nanoNodeAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';

// donation account
// $nanoDonationAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';
// donation account for maintaining this node
// $nanoDonationAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';
14 changes: 13 additions & 1 deletion modules/constants.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<?php

// the project version
define('PROJECT_VERSION', '1.3.2');
define('PROJECT_VERSION', '1.3.3');

// project URL
define('PROJECT_URL', 'https://github.com/dbachm123/nanoNodeMonitor');

// URL to get version of latest release from github
define('GITHUB_LATEST_API_URL', 'https://api.github.com/repos/dbachm123/nanoNodeMonitor/releases/latest');

// donation account for Nano Node Monitor development
define ('NODEMON_DON_ACCOUNT', 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj');

// brainblocks verify URL
define ('BB_VERIFY_URL', 'http://138.197.179.164/nanoBBVerify/bbVerify.php');
6 changes: 3 additions & 3 deletions modules/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// autorefresh interval for the status webpage in seconds
$autoRefreshInSeconds = 5;

// name of your node
// Name of your node (default: your hostname)
$nanoNodeName = gethostname();

// a welcome message shown on top
Expand All @@ -35,8 +35,8 @@
// ip address for RPC (default: 7076)
$nanoNodeRPCPort = '7076';

// node account
// account of this node
$nanoNodeAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';

// donation account
// donation account for maintaining this node
$nanoDonationAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';
10 changes: 10 additions & 0 deletions modules/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<footer id="footer">
<div class="row">
<div class="col-lg-12">

<p><?php print getVersionInformation(); ?></p>

<p>Contributors: <a href="https://github.com/dbachm123">dbachm123</a>, <a href="https://github.com/BitDesert">BitDesert</a>, <a href="https://github.com/NiFNi">NiFNi</a></p>
</div>
</div>
</footer>
62 changes: 61 additions & 1 deletion modules/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,66 @@ function returnJson($data)
}

// converts boolean to a string
function bool2string($boolean){
function bool2string($boolean)
{
return ($boolean) ? 'true' : 'false';
}

// get version of latest release from github
function getLatestReleaseVersion()
{

// get release tag of "latest" from github
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => GITHUB_LATEST_API_URL,
CURLOPT_HTTPHEADER => [
"Accept: application/vnd.github.v3+json",
"Content-Type: text/plain",
"User-Agent: Chrome/47.0.2526.111"
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_GET => true
]);
$output = curl_exec($ch);
curl_close($ch);

// decode json
$decoded = json_decode($output);

// tag string
if (array_key_exists("tag_name", $decoded))
{
$tagString = $decoded->tag_name;

// search for version name x.x.x
if (0 != preg_match('/(\d+\.?)+$/', $tagString, $versionString))
{
return $versionString[0];
}
}

return "";
}

// get a string with information about the
// current version and possible updates

function getVersionInformation()
{
$currentVersion = PROJECT_VERSION;
$latestVersion = getLatestReleaseVersion();

$versionInfo = "Version: " . $currentVersion;

if ( version_compare($currentVersion, $latestVersion) < 0 )
{
$versionInfo .= ". A new version " . $latestVersion;
$versionInfo .= " is available for update at ";
$versionInfo .= "<a href=\"" . PROJECT_URL . "\" target=\"_blank\">GitHub.</a>";
}

return $versionInfo;

}
26 changes: 26 additions & 0 deletions modules/navbar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<a href="index.php" class="navbar-brand">Nano Node Monitor</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="index.php" target="_self">Node Monitor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contribute.php" target="_self">Contribute &amp; Donate</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/dbachm123/nanoNodeMonitor" target="_blank">Source on GitHub</a>
</li>
</ul>
</div>
</div>
</div>
25 changes: 25 additions & 0 deletions static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,28 @@ h2 {
margin-top: 1em;
color: #ea882e
}

a.donationButton { /* Nano orange */
background-color: #ea882e;
color: #f7f7f9;
padding: 8px 16px;
text-align: center;
font-size: 16px;
margin: 4px 2px;
text-decoration: none;
transition: 0.3s;
display: inline-block;
}



input[type=number] { /* Nano orange */
border: 6px solid #ea882e;
color: black;
width: 20%;
padding: 5px 5px;
font-size: 14px;
margin: 4px 2px;
box-sizing: border-box;
border-radius: 4px;
}

0 comments on commit e8696d6

Please sign in to comment.