diff --git a/.travis.yml b/.travis.yml index d10da6c..3d871fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: node_js -node_js: - - "8" -env: - global: - secure: Qdkmi13nqcXskABBhbuGZmRakh4orOW1dalkSCyUbzGuYf0OdYF8ttNVuJa0WSWI4KhNXhtz2p3I8dM95wL++LCVqXFmIvZtX8Nca36KlNxIPNXPjn0odayh+c4pgrhrbz8TDmDXl9IPuZmNz8HHtN7xmIn6YDcm13wA3gTmfwo= +sudo: required +dist: trusty +node_js: '8' before_install: npm install -g grunt-cli -install: npm install -before_script: grunt build +install: + - npm install + - npm run dist diff --git a/Dockerfile b/Dockerfile index 36d6e0c..787c414 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM mhart/alpine-node:latest +FROM node -ADD . /eth-netstats -WORKDIR /eth-netstats - -RUN npm install && npm install -g grunt-cli && grunt +RUN git clone https://github.com/goerli/netstats-server /netstats-server +WORKDIR /netstats-server +RUN npm install +RUN npm install -g grunt-cli +RUN grunt EXPOSE 3000 CMD ["npm", "start"] diff --git a/Gruntfile.js b/Gruntfile.js index 8a703af..17b43b1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -60,14 +60,14 @@ module.exports = function(grunt) { { expand: true, cwd: 'src/fonts/', - src: ['minimal-*.*'], + src: ['*.*'], dest: 'dist/fonts/', filter: 'isFile' }, { expand: true, cwd: 'src/images/', - src: ['*.ico'], + src: ['*.*'], dest: 'dist/', filter: 'isFile' }, diff --git a/README.md b/README.md index 2dfe31a..09c96c7 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ npm install sudo npm install -g grunt-cli ``` -##Build the resources +## Build the resources In order to build the static files you have to run grunt tasks which will generate dist directories containing the js and css files, fonts and images. ```bash grunt ``` -##Run +## Run ```bash WS_SECRET="asdf" npm start diff --git a/lib/node.js b/lib/node.js index 8e4f9ca..454fa54 100644 --- a/lib/node.js +++ b/lib/node.js @@ -102,6 +102,9 @@ Node.prototype.setInfo = function(data, callback) Node.prototype.setGeo = function(ip) { + if (ip.substr(0, 7) == "::ffff:") { + ip = ip.substr(7) + } this.info.ip = ip; this.geo = geoip.lookup(ip); } diff --git a/lib/utils/config.js b/lib/utils/config.js index 88768f9..13587f2 100644 --- a/lib/utils/config.js +++ b/lib/utils/config.js @@ -1,29 +1,6 @@ -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 trusted = []; -var banned = [ - // '198.48.150.206' -]; +var banned = []; module.exports = { trusted: trusted, diff --git a/package.json b/package.json index a53eea5..bc29067 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netstats-server", - "description": "POA Network Intelligence dashboard", + "description": "Görli Network Dashboard", "version": "0.1.0", "private": true, "engines": { diff --git a/src/css/style.css b/src/css/style.css index 3d28eda..eb02bc7 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -10,6 +10,41 @@ body { -moz-osx-font-smoothing: grayscale; } +@font-face { + font-family: 'Source Sans Pro'; + font-style: normal; + font-weight: 200; + src: local('Source Sans Pro ExtraLight'), local('SourceSansPro-ExtraLight'), url(../fonts/SourceSansPro-ExtraLight.woff2) format('woff2'); +} + +@font-face { + font-family: 'Source Sans Pro'; + font-style: normal; + font-weight: 300; + src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url(../fonts/SourceSansPro-Light.woff2) format('woff2'); +} + +@font-face { + font-family: 'Source Sans Pro'; + font-style: normal; + font-weight: 400; + src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(../fonts/SourceSansPro-Regular.woff2) format('woff2'); +} + +@font-face { + font-family: 'Source Sans Pro'; + font-style: normal; + font-weight: 600; + src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url(../fonts/SourceSansPro-SemiBold.woff2) format('woff2'); +} + +@font-face { + font-family: 'Source Sans Pro'; + font-style: normal; + font-weight: 700; + src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(../fonts/SourceSansPro-Bold.woff2) format('woff2'); +} + table td { font-size: 14px; white-space: nowrap !important; @@ -60,7 +95,7 @@ table td { .text-gray .propagationBox { background: none !important; - border: 1px solid #f8f8f2; + border: 1px solid #777; } .bg-success, @@ -72,7 +107,7 @@ table td { } .text-gray { - color: #f8f8f2 !important; + color: #777 !important; } .text-orange { @@ -153,9 +188,9 @@ span.small-title span.small { } .big-info.chart .big-details { - display: block; - position: absolute; + display: table; top: 40px; + margin: 0 auto; } .big-info.chart { @@ -172,6 +207,8 @@ span.small-title span.small { width: 288px; padding-top: 6px; margin-left: -2px; + display: table; + margin: 0 auto; } .blocks-holder { @@ -185,7 +222,7 @@ span.small-title span.small { letter-spacing: -0.1px; text-transform: none; white-space: nowrap; - color: #f8f8f2; + color: #777; } .blocks-holder .block-count { @@ -460,7 +497,7 @@ svg .axis line { shape-rendering: crispEdges; } svg .axis text { - fill: #f8f8f2; + fill: #777; font-size: 10px; letter-spacing: 0px; font-family: "Source Sans Pro"; @@ -472,3 +509,50 @@ svg .axis text { svg .y.axis .tick:first-child text { 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; + } +} diff --git a/src/fonts/SourceSansPro-Bold.woff2 b/src/fonts/SourceSansPro-Bold.woff2 new file mode 100644 index 0000000..52b6d69 Binary files /dev/null and b/src/fonts/SourceSansPro-Bold.woff2 differ diff --git a/src/fonts/SourceSansPro-ExtraLight.woff2 b/src/fonts/SourceSansPro-ExtraLight.woff2 new file mode 100644 index 0000000..3605fb6 Binary files /dev/null and b/src/fonts/SourceSansPro-ExtraLight.woff2 differ diff --git a/src/fonts/SourceSansPro-Light.woff2 b/src/fonts/SourceSansPro-Light.woff2 new file mode 100644 index 0000000..bfb4050 Binary files /dev/null and b/src/fonts/SourceSansPro-Light.woff2 differ diff --git a/src/fonts/SourceSansPro-Regular.woff2 b/src/fonts/SourceSansPro-Regular.woff2 new file mode 100644 index 0000000..efa300c Binary files /dev/null and b/src/fonts/SourceSansPro-Regular.woff2 differ diff --git a/src/fonts/SourceSansPro-SemiBold.woff2 b/src/fonts/SourceSansPro-SemiBold.woff2 new file mode 100644 index 0000000..e379bed Binary files /dev/null and b/src/fonts/SourceSansPro-SemiBold.woff2 differ diff --git a/src/js/directives.js b/src/js/directives.js index 76c9e8a..a85cb5a 100644 --- a/src/js/directives.js +++ b/src/js/directives.js @@ -100,6 +100,24 @@ angular.module('netStatsApp.directives', []) { tElement.replaceWith('' + tAttrs.data + ""); + // 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) { attrs.$observe("data", function (newValue) @@ -302,6 +320,12 @@ angular.module('netStatsApp.directives', []) var width = 280 - margin.left - margin.right, 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 x = d3.scale.linear() @@ -342,10 +366,26 @@ angular.module('netStatsApp.directives', []) return '