Merge branch 'master' of github.com:tao-foundation/teo-netstats into tao-staging

This commit is contained in:
5chdn 2018-12-01 18:57:59 +01:00
commit e710021a50
No known key found for this signature in database
GPG Key ID: 1A40871B597F5F80
13 changed files with 3676 additions and 125 deletions

View File

@ -1,9 +1,9 @@
language: node_js language: node_js
node_js: sudo: required
- "8" dist: trusty
env: node_js: '8'
global:
secure: Qdkmi13nqcXskABBhbuGZmRakh4orOW1dalkSCyUbzGuYf0OdYF8ttNVuJa0WSWI4KhNXhtz2p3I8dM95wL++LCVqXFmIvZtX8Nca36KlNxIPNXPjn0odayh+c4pgrhrbz8TDmDXl9IPuZmNz8HHtN7xmIn6YDcm13wA3gTmfwo=
before_install: npm install -g grunt-cli before_install: npm install -g grunt-cli
install: npm install install:
before_script: grunt build - npm install
- npm run dist

View File

@ -102,6 +102,9 @@ Node.prototype.setInfo = function(data, callback)
Node.prototype.setGeo = function(ip) Node.prototype.setGeo = function(ip)
{ {
if (ip.substr(0, 7) == "::ffff:") {
ip = ip.substr(7)
}
this.info.ip = ip; this.info.ip = ip;
this.geo = geoip.lookup(ip); this.geo = geoip.lookup(ip);
} }

View File

@ -1,29 +1,6 @@
var trusted = [ var trusted = [];
'52.16.188.185',
'54.94.239.50',
'54.174.74.156',
'54.172.25.93',
'54.174.75.126',
'54.173.232.137',
'52.7.205.180',
'52.7.218.44',
'52.7.205.152',
'52.7.224.174',
'92.51.165.126',
'84.117.82.122',
'73.40.58.88',
'178.19.221.38',
'185.37.145.18',
'172.31.39.87',
'86.120.171.69',
'86.123.155.6',
'188.24.81.133',
'::ffff:127.0.0.1',
];
var banned = [ var banned = [];
// '198.48.150.206'
];
module.exports = { module.exports = {
trusted: trusted, trusted: trusted,

3519
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@ html {
body { body {
width: 100%; width: 100%;
min-width: 1900px;
font-smooth: auto; font-smooth: auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
@ -60,7 +59,7 @@ table td {
.text-gray .propagationBox { .text-gray .propagationBox {
background: none !important; background: none !important;
border: 1px solid #f8f8f2; border: 1px solid #777;
} }
.bg-success, .bg-success,
@ -72,7 +71,7 @@ table td {
} }
.text-gray { .text-gray {
color: #f8f8f2 !important; color: #777 !important;
} }
.text-orange { .text-orange {
@ -153,9 +152,9 @@ span.small-title span.small {
} }
.big-info.chart .big-details { .big-info.chart .big-details {
display: block; display: table;
position: absolute;
top: 40px; top: 40px;
margin: 0 auto;
} }
.big-info.chart { .big-info.chart {
@ -172,6 +171,8 @@ span.small-title span.small {
width: 288px; width: 288px;
padding-top: 6px; padding-top: 6px;
margin-left: -2px; margin-left: -2px;
display: table;
margin: 0 auto;
} }
.blocks-holder { .blocks-holder {
@ -185,7 +186,7 @@ span.small-title span.small {
letter-spacing: -0.1px; letter-spacing: -0.1px;
text-transform: none; text-transform: none;
white-space: nowrap; white-space: nowrap;
color: #f8f8f2; color: #777;
} }
.blocks-holder .block-count { .blocks-holder .block-count {
@ -460,7 +461,7 @@ svg .axis line {
shape-rendering: crispEdges; shape-rendering: crispEdges;
} }
svg .axis text { svg .axis text {
fill: #f8f8f2; fill: #777;
font-size: 10px; font-size: 10px;
letter-spacing: 0px; letter-spacing: 0px;
font-family: "Source Sans Pro"; font-family: "Source Sans Pro";
@ -472,3 +473,50 @@ svg .axis text {
svg .y.axis .tick:first-child text { svg .y.axis .tick:first-child text {
opacity: 0; opacity: 0;
} }
@media (max-width: 768px) {
.container-fluid {
padding-left: 5px;
padding-right: 5px;
}
.big-info .icon-full-width i {
width: 75px;
height: 67px;
font-size: 67px;
margin-left: -25px;
}
.big-info .big-details-holder {
left: 75px;
}
.big-info .big-details {
font-size: 35px;
}
.blocks-holder div.small-title-miner {
font-family: inherit;
font-size: 11px;
letter-spacing: -.5px;
}
.blocks-holder {
width: 100%;
}
.big-info.chart i, .second-row .box i {
font-size: 18px;
margin-right: 0px;
}
.second-row .box {
height: 100%; /* BUG XXX */
}
}
@media (max-width: 600px) {
.blocks-holder div.small-title-miner {
font-size: 10px;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -100,6 +100,24 @@ angular.module('netStatsApp.directives', [])
{ {
tElement.replaceWith('<span>' + tAttrs.data + "</span>"); tElement.replaceWith('<span>' + tAttrs.data + "</span>");
// register resize watcher
var timeout;
var width;
$(window).on('resize', function(e) {
if( $('body').width() < 600 )
width = 4;
else if( $('body').width() < 1200 )
width = 5;
else
width = 6;
if(timeout)
clearTimeout(timeout);
timeout = setTimeout(function() {
$.fn.sparkline.defaults.bar.barWidth = width;
}, 200);
});
return function(scope, element, attrs) return function(scope, element, attrs)
{ {
attrs.$observe("data", function (newValue) attrs.$observe("data", function (newValue)
@ -302,6 +320,12 @@ angular.module('netStatsApp.directives', [])
var width = 280 - margin.left - margin.right, var width = 280 - margin.left - margin.right,
height = 63 - margin.top - margin.bottom; height = 63 - margin.top - margin.bottom;
// fix for mobile devices
if( $('body').width() < 600 )
width = 200 - margin.left - margin.right;
else( $('body').width() < 1200 )
width = 240 - margin.left - margin.right;
var TICKS = 40; var TICKS = 40;
var x = d3.scale.linear() var x = d3.scale.linear()
@ -342,10 +366,26 @@ angular.module('netStatsApp.directives', [])
return '<div class="tooltip-arrow"></div><div class="tooltip-inner"><b>' + (d.x/1000) + 's - ' + ((d.x + d.dx)/1000) + 's</b><div class="small">Percent: <b>' + Math.round(d.y * 100) + '%</b>' + '<br>Frequency: <b>' + d.frequency + '</b><br>Cumulative: <b>' + Math.round(d.cumpercent*100) + '%</b></div></div>'; return '<div class="tooltip-arrow"></div><div class="tooltip-inner"><b>' + (d.x/1000) + 's - ' + ((d.x + d.dx)/1000) + 's</b><div class="small">Percent: <b>' + Math.round(d.y * 100) + '%</b>' + '<br>Frequency: <b>' + d.frequency + '</b><br>Cumulative: <b>' + Math.round(d.cumpercent*100) + '%</b></div></div>';
}) })
scope.init = function() scope.init = function(width)
{ {
var data = scope.data; var data = scope.data;
var x = d3.scale.linear()
.domain([0, 10000])
.rangeRound([0, width])
.interpolate(d3.interpolateRound);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.ticks(4, ",.1s")
.tickFormat(function(t){ return t/1000 + "s"});
var line = d3.svg.line()
.x(function(d) { return x(d.x + d.dx/2) - 1; })
.y(function(d) { return y(d.y) - 2; })
.interpolate('basis');
// Adjust y axis // Adjust y axis
y.domain([0, d3.max(data, function(d) { return d.y; })]); y.domain([0, d3.max(data, function(d) { return d.y; })]);
@ -414,9 +454,24 @@ angular.module('netStatsApp.directives', [])
scope.$watch('data', function() { scope.$watch('data', function() {
if(scope.data.length > 0) { if(scope.data.length > 0) {
scope.init(); scope.init(width);
} }
}, true); }, true);
var timeout;
$(window).on('resize', function(e) {
var width = 280 - margin.left - margin.right;
if( $('body').width() < 768 )
width = 200 - margin.left - margin.right;
if(timeout)
clearTimeout(timeout);
timeout = setTimeout(function() {
// redraw
scope.init(width);
}, 200);
});
} }
}; };
}]); }]);

View File

@ -59,35 +59,17 @@ angular.module('netStatsApp.filters', [])
}) })
.filter('hashrateFilter', ['$sce', '$filter', function($sce, filter) { .filter('hashrateFilter', ['$sce', '$filter', function($sce, filter) {
return function(hashes, isMining) { return function(hashes, isMining) {
var result = 0;
var unit = 'K';
if( !isMining ) if( !isMining )
return $sce.trustAsHtml('<i class="icon-cancel"></i>'); return $sce.trustAsHtml('<i class="icon-cancel"></i>');
if(hashes !== 0 && hashes < 1000) { var result = hashes;
result = hashes; var units = ['', 'K', 'M', 'G', 'T', 'P', 'E'];
unit = ''; var unit = 'K';
}
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) { for(var i = 1; result > 1000; i++)
result = hashes / 1000; {
unit = 'K'; result /= 1000;
} unit = units[i];
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) {
result = hashes / Math.pow(1000, 2);
unit = 'M';
}
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) {
result = hashes / Math.pow(1000, 3);
unit = 'G';
}
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) {
result = hashes / Math.pow(1000, 4);
unit = 'T';
} }
return $sce.trustAsHtml('<span class="small">' + filter('number')(result.toFixed(1)) + ' <span class="small-hash">' + unit + 'H/s</span></span>'); return $sce.trustAsHtml('<span class="small">' + filter('number')(result.toFixed(1)) + ' <span class="small-hash">' + unit + 'H/s</span></span>');
@ -95,32 +77,14 @@ angular.module('netStatsApp.filters', [])
}]) }])
.filter('totalDifficultyFilter', function() { .filter('totalDifficultyFilter', function() {
return function(hashes) { return function(hashes) {
var result = 0; var result = hashes;
var units = ['', 'K', 'M', 'G', 'T', 'P', 'E'];
var unit = ''; var unit = '';
if(hashes !== 0 && hashes < 1000) { for(var i = 1; result > 1000; i++)
result = hashes; {
unit = ''; result /= 1000;
} unit = units[i];
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) {
result = hashes / 1000;
unit = 'K';
}
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) {
result = hashes / Math.pow(1000, 2);
unit = 'M';
}
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) {
result = hashes / Math.pow(1000, 3);
unit = 'G';
}
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) {
result = hashes / Math.pow(1000, 4);
unit = 'T';
} }
return result.toFixed(2) + ' ' + unit + 'H'; return result.toFixed(2) + ' ' + unit + 'H';
@ -327,32 +291,14 @@ angular.module('netStatsApp.filters', [])
if(hashes === null) if(hashes === null)
hashes = 0; hashes = 0;
var result = 0; var result = hashes;
var units = ['', 'K', 'M', 'G', 'T', 'P'];
var unit = 'K'; var unit = 'K';
if(hashes !== 0 && hashes < 1000) { for(var i = 1; result > 1000; i++)
result = hashes; {
unit = ''; result /= 1000;
} unit = units[i];
if(hashes >= 1000 && hashes < Math.pow(1000, 2)) {
result = hashes / 1000;
unit = 'K';
}
if(hashes >= Math.pow(1000, 2) && hashes < Math.pow(1000, 3)) {
result = hashes / Math.pow(1000, 2);
unit = 'M';
}
if(hashes >= Math.pow(1000, 3) && hashes < Math.pow(1000, 4)) {
result = hashes / Math.pow(1000, 3);
unit = 'G';
}
if(hashes >= Math.pow(1000, 4) && hashes < Math.pow(1000, 5)) {
result = hashes / Math.pow(1000, 4);
unit = 'T';
} }
if( !isMining ) if( !isMining )

View File

@ -7,6 +7,11 @@
$.fn.sparkline.defaults.bar.height = 63; $.fn.sparkline.defaults.bar.height = 63;
$.fn.sparkline.defaults.bar.barWidth = 6; $.fn.sparkline.defaults.bar.barWidth = 6;
if( $('body').width() < 600 )
$.fn.sparkline.defaults.bar.barWidth = 4;
else if( $('body').width() < 1200 )
$.fn.sparkline.defaults.bar.barWidth = 5;
$.fn.sparkline.defaults.bar.barSpacing = 1; $.fn.sparkline.defaults.bar.barSpacing = 1;
$.fn.sparkline.defaults.bar.tooltipClassname = 'jqstooltip'; $.fn.sparkline.defaults.bar.tooltipClassname = 'jqstooltip';
$.fn.sparkline.defaults.bar.tooltipOffsetX = 0; $.fn.sparkline.defaults.bar.tooltipOffsetX = 0;
@ -26,12 +31,3 @@
moment.relativeTimeThreshold('M', 12); moment.relativeTimeThreshold('M', 12);
})(); })();
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
// ga('create', 'UA-68390837-2', 'auto');
ga('create', 'UA-80834434-1', 'auto');
ga('send', 'pageview');

3
src/robots.txt Normal file
View File

@ -0,0 +1,3 @@
# http://www.robotstxt.org
User-agent: *
Disallow:

View File

@ -3,10 +3,13 @@ doctype html
html(ng-app="netStatsApp") html(ng-app="netStatsApp")
head head
meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0") meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0")
title Ethereum Network Status title TEO Network Status
style(type="text/css") [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } style(type="text/css") [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }
link(rel='stylesheet', href='//fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700') link(rel='stylesheet', href='//fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700')
link(rel='stylesheet', href='/css/netstats.min.css') link(rel='stylesheet', href='/css/netstats.min.css')
meta(name='robots', content='index,follow')
meta(name='googlebot', content='index,follow')
link(rel='shortcut icon', type="image/x-icon", href="/favicon.ico")
body body
block content block content

1
ws_secret.json Normal file
View File

@ -0,0 +1 @@
1111