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 #64 from NanoTools/develop
Browse files Browse the repository at this point in the history
PR for v1.4.4
  • Loading branch information
dbachm123 authored Apr 30, 2018
2 parents 5248e6f + 0e165c7 commit b4b5b4b
Show file tree
Hide file tree
Showing 24 changed files with 482 additions and 103 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode/
modules/config.php
modules/config.php
.idea/
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@

Nano Node Monitor is a server-side PHP-based monitor for a Nano node. It connects to a running node via RPC and displays it's status on a simple webpage. Being server-side, it does not expose the RPC interface of the Nano node to the public.

Here is what it looks like on a desktop computer ...
![Light](https://i.imgur.com/fbaAFvC.png)

![Desktop screenshot](https://i.imgur.com/1k5BCfc.png)


... and on a mobile device:

![Mobile screenshot](https://i.imgur.com/PTSwL69.jpg)
![Dark](https://i.imgur.com/1Gu9ohX.png)


## Prerequisites
Expand Down Expand Up @@ -58,14 +53,19 @@ $nanoNodeRPCPort = '7076';

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

## Creating a Theme

If you're interested in creating your own theme in addition to the official Light and Dark themes, we've made it very simple for you to do so. Check out the [Wiki](https://github.com/NanoTools/nanoNodeMonitor/wiki/Create-a-theme) for more info.


## Links

* [Installation Official Nano Node with Docker (Official Nano Repo Wiki)](https://github.com/nanocurrency/raiblocks/wiki/Docker-node)
* [Easy-Nano-Node 5 minute installation](https://nanotools.github.io/easy-nano-node/)

## Support

Feel free to change your representative to my Nano node `xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj` to support further decentralization within the Nano network. In case of problems, please send an [issue](https://github.com/NanoTools/nanoNodeMonitor/issues).
Feel free to change your representative to the [Nano Node Monitor Rep](https://nanonode.ninja/account/xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj) `xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj` to support further decentralization within the Nano network. In case of problems, please send an [issue](https://github.com/NanoTools/nanoNodeMonitor/issues).

Donations to the development of Nano Node Monitor are very welcome to: [xrb_1nanomon9uycemhgonue4twmcqmsu7oxw43maro8amj751ozpus8r8gsic48](https://www.nanode.co/account/xrb_1nanomon9uycemhgonue4twmcqmsu7oxw43maro8amj751ozpus8r8gsic48)

Expand Down
12 changes: 9 additions & 3 deletions contribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
?>


<h2>Contribute to Nano Node Monitor</h2>
<h3>Contribute to Nano Node Monitor</h3>
<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/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.
</p>

<br>

<h2>Donate to the Maintainer of This Node</h2>
<h3>Donate to the Maintainer of This Node</h3>

<p>
Donations support the efforts of the Nano community to further decentralize the Nano network by running representative nodes.
Please consider donating to the maintainer of this Nano node to help cover some of its costs. Simply click the button below.
Please consider donating to the maintainer of this Nano node to help cover some of its costs. Simply click the BrainBlocks button below.
</p>


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

Expand Down Expand Up @@ -70,5 +72,9 @@ function updateBrainButton() {
</script>

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

<br>

<!--- add the footer -->

<?php include 'modules/footer.php'; ?>
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="row">
<div class="col-lg-8 col-md-6 col-sm-6">
<a href="https://nano.org" target="_blank">
<img src="static/img/logo-white.svg" width="220" alt="Nano Logo"/>
<img src="static/img/nano-full-<?php echo $themeChoice; ?>.svg" width="220" alt="Nano Logo"/>
</a>
<p class="lead mt-2">Nano Node Monitor</p>
<p><?php echo $welcomeMsg; ?></p>
Expand Down
2 changes: 2 additions & 0 deletions modules/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require_once __DIR__.'/cache/ApcCache.php';
require_once __DIR__.'/cache/ApcuCache.php';
require_once __DIR__.'/cache/FileCache.php';
require_once __DIR__.'/cache/RedisCache.php';
require_once __DIR__.'/cache/NullCache.php';

abstract class Cache {
Expand All @@ -12,6 +13,7 @@ public static function factory() {
case 'apc': return new ApcCache($cache['options']);
case 'apcu': return new ApcuCache($cache['options']);
case 'files': return new FileCache($cache['options']);
case 'redis': return new RedisCache($cache['options']);
default: return new NullCache();
}
}
Expand Down
29 changes: 29 additions & 0 deletions modules/cache/RedisCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

class RedisCache extends Cache {
private $ttl;

public function __construct(array $options = array()) {
$this->ttl = array_key_exists('ttl', $options) ? $options['ttl'] : 30;

if (array_key_exists('redis', $options)) {
$this->redis = $options['redis'];
} else {
$this->redis = new Redis();
$this->redis->connect(
array_key_exists('host', $options) ? $options['host'] : '127.0.0.1',
array_key_exists('port', $options) ? $options['port'] : 6379
);
}
}

public function read($key) {
$data = $this->redis->get($key);
if ($data) return json_decode($data);
return NULL;
}

public function write($key, $data) {
return $this->redis->setEx($key, $this->ttl, json_encode($data));
}
}
13 changes: 11 additions & 2 deletions modules/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

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

// Theme of your Node Monitor (dark or light)
// $themeChoice = 'light';

// autorefresh interval for the status webpage in seconds
// $autoRefreshInSeconds = 5;

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

// a welcome message shown on top
// $welcomeMsg = 'Nano rocks!';
// $welcomeMsg = 'Welcome to Nano Node Monitor';

// coinmarketcap widget
// market data base and second currency e.g. USD, EUR, BTC, ETH
Expand All @@ -32,7 +35,7 @@
// choice of Nano block explorer ('nanode', 'ninja', 'nanoexplorer', 'nano', 'nanowatch', 'meltingice')
// $blockExplorer = 'nanode';

// ----------- Cache Engine -----------
// ----------- Cache Engine -----------

// The cache engine allows for caching of RPC calls to reduce load on your Nano node.

Expand All @@ -46,6 +49,12 @@
// - Options: 'ttl' => cache time in seconds
// - "apcu" (APCu cache; requires extension; fast)
// - Options: 'ttl' => cache time in seconds
// - "redis" (Redis cache; requires extension; fast)
// - Options:
// - 'host' => optional; address of the Redis host (defaults to localhost)
// - 'port' => optional; port for the Redis host (defaults to 6379)
// - 'redis' => optional; an instantiated Redis instance (replaces use of host/port)
// - 'ttl' => optional; cache time in seconds

// $cache = [
// "engine" => "files",
Expand Down
5 changes: 4 additions & 1 deletion modules/constants.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?php

// the project version
define('PROJECT_VERSION', '1.4.3');
define('PROJECT_VERSION', '1.4.4');

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

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

// rep account for Nano Node Monitor
define ('NODEMON_REP_ACCOUNT', 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj');

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

Expand Down
3 changes: 3 additions & 0 deletions modules/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

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

// Theme of your Node Monitor (dark or light)
$themeChoice = 'dark';

// autorefresh interval for the status webpage in seconds
$autoRefreshInSeconds = 5;

Expand Down
19 changes: 12 additions & 7 deletions modules/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
<p><?php echo getVersionInformation(); ?><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></p>
<br>
<p class=small>Made by <a href="https://github.com/NanoTools" target="_blank">Nano Tools</a>.</p>
<p class=small>Donations to Nano Node Monitor: <a href="<?php echo getAccountUrl(NODEMON_DON_ACCOUNT, $blockExplorer); ?>" target="_blank"><?php echo NODEMON_DON_ACCOUNT; ?></a>
<button id="copyAccount" class="btn btn-sm btn-link" data-clipboard-text="<?php echo NODEMON_DON_ACCOUNT; ?>" title="Copy"><i class="fas fa-clipboard fa-lg"></i></button>
<p class=small>Made by <a href="https://github.com/NanoTools" target="_blank">Nano Tools</a>.
<br>
Representative: <a href="<?php echo getAccountUrl(NODEMON_REP_ACCOUNT, 'ninja'); ?>" target="_blank"><?php echo NODEMON_REP_ACCOUNT; ?></a>
<button id="copyAccount" class="btn btn-sm btn-link btn-clipboard-light" data-clipboard-text="<?php echo NODEMON_REP_ACCOUNT; ?>" title="Copy"><i class="fas fa-clipboard fa-lg"></i></button>
</p>
<p class=small>
Donations to Nano Node Monitor: <a href="<?php echo getAccountUrl(NODEMON_DON_ACCOUNT, $blockExplorer); ?>" target="_blank"><?php echo NODEMON_DON_ACCOUNT; ?></a>
<button id="copyAccount" class="btn btn-sm btn-link btn-clipboard-light" data-clipboard-text="<?php echo NODEMON_DON_ACCOUNT; ?>" 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"></script>
<script src="static/js/popper.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/handlebars-v4.0.11.js"></script>
<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/main.js?v=<?php echo PROJECT_VERSION; ?>"></script>

</body>
Expand Down
30 changes: 15 additions & 15 deletions modules/header.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<head>
<meta charset="utf-8">

<title>Nano Node Monitor - <?php echo $nanoNodeName; ?></title>
<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/fontawesome-all.min.css" media="screen">
<link rel="stylesheet" href="static/css/custom.css?v=<?php echo PROJECT_VERSION; ?>" media="screen">
<link rel="icon" href="static/img/logo-only-white.svg">
</head>
<body>
<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?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.svg">
</head>
<body>
<script>
var init = [];
var GLOBAL_REFRESH = <?php echo $autoRefreshInSeconds; ?>;
var init = [];
var GLOBAL_REFRESH = <?php echo $autoRefreshInSeconds; ?>;
var GLOBAL_DIGITS = <?php echo $nanoNumDecimalPlaces; ?>;
</script>


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

Expand Down
9 changes: 6 additions & 3 deletions modules/navbar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="navbar navbar-expand-lg n-navbar-theme fixed-top">
<div class="container">
<a href="index.php" class="navbar-brand"><img src="static/img/logo-only-white.svg" alt="Nano Logo" style="height: 1em;"/> Nano Node Monitor</a>
<a href="index.php" class="navbar-brand">
<img src="static/img/nano-mark-<?php echo $themeChoice; ?>.svg" alt="Nano Logo" style="height: 1em;"/>
<span class="n-logo-theme">Nano Node Monitor</span>
</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>
Expand All @@ -13,7 +16,7 @@
</li>

<li class="nav-item">
<a class="nav-link" href="contribute.php" target="_self">Contribute &amp; Donate</a>
<a class="nav-link" href="contribute.php" target="_self">Contribute</a>
</li>

<li class="nav-item">
Expand Down
11 changes: 3 additions & 8 deletions static/css/bootstrap.min.css

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,3 @@ input[type=number] { /* Nano orange */
background: #3e444c;
}

.truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
5 changes: 5 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
File renamed without changes
33 changes: 33 additions & 0 deletions static/img/nano-full-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
21 changes: 21 additions & 0 deletions static/img/nano-mark-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function updateStats(){
.done(function (apidata) {
$('#content').html(template(apidata));
new ClipboardJS('#copyAccount');
setTimeout(updateStats, GLOBAL_REFRESH * 1000);
//setTimeout(updateStats, GLOBAL_REFRESH * 1000);
})
.fail(function (apidata) {
$('#content').html(apidata.responseText);
Expand Down
Loading

0 comments on commit b4b5b4b

Please sign in to comment.