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 #126 from NanoTools/develop
Browse files Browse the repository at this point in the history
v1.5.2
  • Loading branch information
BitDesert authored Aug 4, 2019
2 parents 1f93a6f + 85ecd1e commit 6e67a1e
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 78 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You will have to add your node's account to the config file `config.php` by modi

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


Expand Down Expand Up @@ -67,8 +67,8 @@ If you're interested in creating your own theme in addition to the official Ligh

## Support

Feel free to change your representative to the [Nano Node Monitor Rep](https://mynano.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).
Feel free to change your representative to the [Nano Node Monitor Rep](https://mynano.ninja/account/nano_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj) `nano_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)
Donations to the development of Nano Node Monitor are very welcome to: [nano_1nanomon9uycemhgonue4twmcqmsu7oxw43maro8amj751ozpus8r8gsic48](https://nanocrawler.cc/explorer/account/nano_1nanomon9uycemhgonue4twmcqmsu7oxw43maro8amj751ozpus8r8gsic48)

Have fun! :)
3 changes: 3 additions & 0 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
$data->currency = $currency;
$data->currencySymbol = currencySymbol($currency);

// active_difficulty
$data->active_difficulty = getActiveDifficulty($ch);

// node statistics
// maybe we get more stats later
// so this is seperate object
Expand Down
8 changes: 4 additions & 4 deletions modules/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
// $themeChoice = 'light';

// Choice of block explorer
// Nano Explorers: 'nanode', 'ninja', 'nanoexplorer', 'nanowatch', 'nanocrawler', 'nifni'
// Nano Explorers: 'ninja', 'nanoodle', 'nanocrawler', 'nifni'
// Nano Beta Explorers: 'nanocrawler-beta', 'nano-beta'
// Banano Explorers: 'banano'
// $blockExplorer = 'nanode';
// $blockExplorer = 'nanocrawler';

// Autorefresh interval for the status webpage in seconds
// $autoRefreshInSeconds = 5;
Expand Down Expand Up @@ -77,10 +77,10 @@
// $nanoNodeRPCPort = '7076';

// Account of this node
// $nanoNodeAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';
// $nanoNodeAccount = 'nano_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';

// Donation account for maintaining this node
// $nanoDonationAccount = 'xrb_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';
// $nanoDonationAccount = 'nano_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj';

// Number of decimal places to display Nano balances, i.e.
// $nanoNumDecimalPlaces = 2;
Expand Down
6 changes: 3 additions & 3 deletions 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.1');
define('PROJECT_VERSION', '1.5.2');

// project URL
define('PROJECT_URL', 'https://github.com/NanoTools/nanoNodeMonitor');
Expand All @@ -10,13 +10,13 @@
define('GITHUB_LATEST_API_URL', 'https://api.github.com/repos/NanoTools/nanoNodeMonitor/releases/latest');

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

// banano rep account for Nano Node Monitor
define ('NODEMON_BAN_REP_ACCOUNT', 'ban_1kxnxi5zurj6h7dfb87ik6hhu9yo63miyg6q1fjaxgnd1kknr5y5md4xwxoj');

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

// baano donation account for Nano Node Monitor development
define ('NODEMON_BAN_DON_ACCOUNT', 'ban_1kxnxi5zurj6h7dfb87ik6hhu9yo63miyg6q1fjaxgnd1kknr5y5md4xwxoj');
Expand Down
90 changes: 44 additions & 46 deletions modules/footer.php
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
<footer id="footer">

<p>
<?php
global $versionCache;
$versionCache = new FileCache(["ttl" => 10*60]); // cache for 10 minutes

// set an API name so multiple monitors don't mix
$apiName = "footer-$nanoNodeAccount";

// get cached response
$versionData = $versionCache->fetch($apiName, function () {
$versionData = new stdClass();
$versionData->latestVersion = getLatestReleaseVersion();
return $versionData;
});
echo getVersionInformation($versionData->latestVersion);
?>

<br>
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" 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>

<p class=truncate>
<small>

<?php
// switch Nano / Banano rep accounts & explorer
$repAccount = NODEMON_REP_ACCOUNT;
$donAccount = NODEMON_DON_ACCOUNT;
$repExplorer = 'ninja';

if ($currency == "banano")
{
$repAccount = NODEMON_BAN_REP_ACCOUNT;
$donAccount = NODEMON_BAN_DON_ACCOUNT;
$repExplorer = 'banano';
}
?>

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>
<hr class="light">

<small>

<?php
// switch Nano / Banano rep accounts & explorer
$repAccount = NODEMON_REP_ACCOUNT;
$donAccount = NODEMON_DON_ACCOUNT;
$repExplorer = 'ninja';

if ($currency == "banano")
{
$repAccount = NODEMON_BAN_REP_ACCOUNT;
$donAccount = NODEMON_BAN_DON_ACCOUNT;
$repExplorer = 'banano';
}
?>

<ul>
<li>
<?php
global $versionCache;
$versionCache = new FileCache(["ttl" => 10*60]); // cache for 10 minutes

// set an API name so multiple monitors don't mix
$apiName = "footer-$nanoNodeAccount";

// get cached response
$versionData = $versionCache->fetch($apiName, function () {
$versionData = new stdClass();
$versionData->latestVersion = getLatestReleaseVersion();
return $versionData;
});
echo getVersionInformation($versionData->latestVersion);
?>
</li>
<li>Powered by <a href="<?php echo PROJECT_URL ?>" target="_blank" rel="noopener">Nano Node Monitor</a></li>
<li>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></li>
<li>
Donate: <a href="<?php echo getAccountUrl($donAccount, $blockExplorer); ?>" target="_blank" rel="noopener"><?php echo truncateAddress($donAccount); ?></a>
</li>
<li>Made by <a href="https://github.com/NanoTools" target="_blank" rel="noopener">Nano Tools</a></li>
</ul>
</small>
</footer>

</div><!-- /container -->
Expand Down
16 changes: 4 additions & 12 deletions modules/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function getNodeNinja($account)
}

// truncate long Nano addresses to display the first and
// last characaters with ellipsis in the center
// last characters with ellipsis in the center
function truncateAddress($addr)
{
$totalNumChar = NANO_ADDR_NUM_CHAR;
Expand All @@ -345,18 +345,10 @@ function getAccountUrl($account, $blockExplorer)
{
switch ($blockExplorer)
{
case 'nanoexplorer':
return "https://nanoexplorer.io/accounts/" . $account;
case 'nanowatch':
return "https://nanowat.ch/account/" . $account;
case 'nanoodle':
return "https://nanoodle.io/account/" . $account;
case 'ninja':
return "https://mynano.ninja/account/" . $account;
case 'meltingice':
return "https://nanocrawler.cc/explorer/account/" . $account;
case 'meltingice-beta':
return "https://beta.nanocrawler.cc/explorer/account/" . $account;
case 'nanocrawler':
return "https://nanocrawler.cc/explorer/account/" . $account;
case 'nanocrawler-beta':
return "https://beta.nanocrawler.cc/explorer/account/" . $account;
case 'nano-beta':
Expand All @@ -366,7 +358,7 @@ function getAccountUrl($account, $blockExplorer)
case 'banano':
return "https://creeper.banano.cc/explorer/account/" . $account;
default:
return "https://www.nanode.co/account/" . $account;
return "https://nanocrawler.cc/explorer/account/" . $account;
}
}

Expand Down
26 changes: 17 additions & 9 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.float-left-truncate
{
float: left;
margin-right: auto;
margin-right: auto;
text-align: left;
overflow: hidden;
white-space: nowrap;
Expand All @@ -19,7 +19,7 @@
.float-right-truncate
{
float: right;
margin-left: auto;
margin-left: auto;
text-align: right;
overflow: hidden;
white-space: nowrap;
Expand All @@ -28,24 +28,32 @@
}

.myError
{
{
padding: 20px;
background-color: #f44336; /* Red */
color: white;
margin-bottom: 30px;
}

.coinmarketcap-currency-widget div > span
{
color: white;
}
.coinmarketcap-currency-widget div > span
{
color: white;
}

.coinmarketcap-currency-widget div > span:last-child
{
color: #7c7c7e !important;
{
color: #7c7c7e !important;
}

.coinmarketcap-currency-widget > div > div:nth-child(2) > div
{
color: #dddddd;
}

#footer ul
{
text-align: right;
letter-spacing: 0.02em;
list-style: none;
padding-right: 10px;
}
28 changes: 28 additions & 0 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ init.push(function(){
return hours+':'+minutes+':'+seconds;
});

Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {

switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '!=':
return (v1 != v2) ? options.fn(this) : options.inverse(this);
case '!==':
return (v1 !== v2) ? options.fn(this) : options.inverse(this);
case '<':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case '<=':
return (v1 <= v2) ? options.fn(this) : options.inverse(this);
case '>':
return (v1 > v2) ? options.fn(this) : options.inverse(this);
case '>=':
return (v1 >= v2) ? options.fn(this) : options.inverse(this);
case '&&':
return (v1 && v2) ? options.fn(this) : options.inverse(this);
case '||':
return (v1 || v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});

axios.get('templates/index.hbs')
.then(function (response) {
template=Handlebars.compile(response.data);
Expand Down
4 changes: 3 additions & 1 deletion templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@
<span class="float-left-truncate">Delegators</span>
<span class="float-right-truncate">
{{#if nodeNinja}}
{{formatNumber nodeNinja.delegators}}
{{#ifCond nodeNinja.delegators '>' 0}}
{{formatNumber nodeNinja.delegators}}
{{else}} N/A {{/ifCond}}
{{else}} N/A {{/if}}
</span>
</li>
Expand Down

0 comments on commit 6e67a1e

Please sign in to comment.