Merge pull request #298 from jesuscript/default-colors

Fixed client-side error spam when a node has non-standard node info; updated ws deps
This commit is contained in:
Marian OANCΞA 2016-11-09 02:34:31 +02:00 committed by GitHub
commit e172a25058
6 changed files with 44 additions and 42 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ config/nodes.js
*.pem *.pem
.node-xmlhttprequest-* .node-xmlhttprequest-*
ws_secret.json ws_secret.json
stats.json

View File

@ -185,7 +185,7 @@ module.exports = function(grunt) {
concat: { concat: {
vendor: { vendor: {
options: { options: {
sourceMap: true, souceMap: false,
sourceMapIncludeSources: true, sourceMapIncludeSources: true,
sourceMapIn: ['dist/js/lib/*.map'] sourceMapIn: ['dist/js/lib/*.map']
}, },
@ -201,13 +201,13 @@ module.exports = function(grunt) {
}, },
netstats: { netstats: {
options: { options: {
sourceMap: true, sourceMap: false,
sourceMapIncludeSources: true, sourceMapIncludeSources: true,
sourceMapIn: ['dist/js/vendor.min.js.map', 'dist/js/app.min.js.map'] sourceMapIn: ['dist/js/vendor.min.js.map', 'dist/js/app.min.js.map']
}, },
src: ['<%= concat.vendor.dest %>', '<%= uglify.app.dest %>'], src: ['<%= concat.vendor.dest %>', '<%= uglify.app.dest %>'],
dest: 'dist/js/netstats.min.js', dest: 'dist/js/netstats.min.js',
nonull: true, nonull: true
}, },
css: { css: {
src: ['dist/css/*.min.css', 'dist/css/*.css'], src: ['dist/css/*.min.css', 'dist/css/*.css'],
@ -215,7 +215,7 @@ module.exports = function(grunt) {
}, },
vendor_lite: { vendor_lite: {
options: { options: {
sourceMap: true, sourceMap: false,
sourceMapIncludeSources: true, sourceMapIncludeSources: true,
sourceMapIn: ['dist-lite/js/lib/*.map'] sourceMapIn: ['dist-lite/js/lib/*.map']
}, },
@ -231,7 +231,7 @@ module.exports = function(grunt) {
}, },
netstats_lite: { netstats_lite: {
options: { options: {
sourceMap: true, sourceMap: false,
sourceMapIncludeSources: true, sourceMapIncludeSources: true,
sourceMapIn: ['dist-lite/js/vendor.min.js.map', 'dist-lite/js/app.min.js.map'] sourceMapIn: ['dist-lite/js/vendor.min.js.map', 'dist-lite/js/app.min.js.map']
}, },
@ -248,7 +248,7 @@ module.exports = function(grunt) {
app: { app: {
options: { options: {
mangle: false, mangle: false,
sourceMap: true, sourceMap: false,
sourceMapIncludeSources: true sourceMapIncludeSources: true
}, },
dest: 'dist/js/app.min.js', dest: 'dist/js/app.min.js',
@ -257,7 +257,7 @@ module.exports = function(grunt) {
app_lite: { app_lite: {
options: { options: {
mangle: false, mangle: false,
sourceMap: true, sourceMap: false,
sourceMapIncludeSources: true sourceMapIncludeSources: true
}, },
dest: 'dist-lite/js/app.min.js', dest: 'dist-lite/js/app.min.js',

8
app.js
View File

@ -54,8 +54,8 @@ api = new Primus(server, {
parser: 'JSON' parser: 'JSON'
}); });
api.use('emit', require('primus-emit')); api.plugin('emit', require('primus-emit'));
api.use('spark-latency', require('primus-spark-latency')); api.plugin('spark-latency', require('primus-spark-latency'));
// Init Client Socket connection // Init Client Socket connection
@ -65,7 +65,7 @@ client = new Primus(server, {
parser: 'JSON' parser: 'JSON'
}); });
client.use('emit', require('primus-emit')); client.plugin('emit', require('primus-emit'));
// Init external API // Init external API
@ -75,7 +75,7 @@ external = new Primus(server, {
parser: 'JSON' parser: 'JSON'
}); });
external.use('emit', require('primus-emit')); external.plugin('emit', require('primus-emit'));
// Init collections // Init collections
var Collection = require('./lib/collection'); var Collection = require('./lib/collection');

View File

@ -17,12 +17,19 @@
"debug": "2.2.0", "debug": "2.2.0",
"express": "4.13.3", "express": "4.13.3",
"geoip-lite": "1.1.6", "geoip-lite": "1.1.6",
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "^0.12.3",
"grunt-contrib-jade": "^0.14.1",
"grunt-contrib-uglify": "^0.9.1",
"jade": "1.11.0", "jade": "1.11.0",
"lodash": "3.10.1", "lodash": "3.10.1",
"primus": "3.2.1", "primus": "^6.0.5",
"primus-emit": "0.1.2", "primus-emit": "^1.0.0",
"primus-spark-latency": "0.1.1", "primus-spark-latency": "^0.1.1",
"ws": "0.8.0" "ws": "^1.1.1"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -40,13 +47,5 @@
} }
], ],
"license": "LGPL-3.0", "license": "LGPL-3.0",
"devDependencies": { "devDependencies": {}
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "^0.12.3",
"grunt-contrib-jade": "^0.14.1",
"grunt-contrib-uglify": "^0.9.1"
}
} }

View File

@ -128,7 +128,7 @@ angular.module('netStatsApp.filters', [])
}) })
.filter('nodeVersion', function($sce) { .filter('nodeVersion', function($sce) {
return function(version) { return function(version) {
if(typeof version !== 'undefined') if(version)
{ {
var tmp = version.split('/'); var tmp = version.split('/');
@ -139,19 +139,19 @@ angular.module('netStatsApp.filters', [])
tmp[0] = 'pyeth'; tmp[0] = 'pyeth';
} }
if(tmp[1][0] !== 'v' && tmp[1][2] !== '.') if(tmp[1] && tmp[1][0] !== 'v' && tmp[1][2] !== '.')
{ {
tmp.splice(1,1); tmp.splice(1,1);
} }
if(tmp[2] === 'Release'){ if(tmp[2] && tmp[2] === 'Release'){
tmp.splice(2,1); tmp.splice(2,1);
} }
if(tmp[2].indexOf('Linux') === 0) if(tmp[2] && tmp[2].indexOf('Linux') === 0)
tmp[2] = 'linux'; tmp[2] = 'linux';
if(tmp[2].indexOf('Darwin') === 0) if(tmp[2] && tmp[2].indexOf('Darwin') === 0)
tmp[2] = 'darwin'; tmp[2] = 'darwin';
return $sce.trustAsHtml(tmp.join('/')); return $sce.trustAsHtml(tmp.join('/'));
@ -463,9 +463,10 @@ angular.module('netStatsApp.filters', [])
var tooltip = []; var tooltip = [];
var string = ''; var string = '';
if(node.info.node !== '' && typeof node.info.node !== 'undefined') { if(node.info.node) {
var eth_version = node.info.node.split('/'); var eth_version = node.info.node.split('/');
if(eth_version[1]){
if(eth_version[1][0] !== 'v' && eth_version[1][2] !== '.') if(eth_version[1][0] !== 'v' && eth_version[1][2] !== '.')
{ {
eth_version.splice(1,1); eth_version.splice(1,1);
@ -476,6 +477,7 @@ angular.module('netStatsApp.filters', [])
string = "Version: <b>" + (eth_version[1]) + "</b>"; string = "Version: <b>" + (eth_version[1]) + "</b>";
tooltip.push(string); tooltip.push(string);
}
} }
if(node.info.net !== '') { if(node.info.net !== '') {