From 696702a0c84d3e09f4614875d1dec5123673e372 Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Mon, 18 Feb 2019 16:48:15 +0100 Subject: [PATCH 1/2] add frontend config --- Gruntfile.js | 2 ++ src/js/app.js | 5 +++++ src/js/defaultConfig.js | 2 ++ src/pow/views/layout.jade | 4 ++-- src/views/layout.jade | 4 ++-- 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 src/js/defaultConfig.js diff --git a/Gruntfile.js b/Gruntfile.js index 0baa19f..a1bceae 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -31,6 +31,8 @@ var styles = [ ]; module.exports = function(grunt) { + scripts.unshift(grunt.option('configPath') || 'src/js/defaultConfig.js'); + grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), clean: { diff --git a/src/js/app.js b/src/js/app.js index 74fcb3b..a61a5b5 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -4,6 +4,11 @@ var netStatsApp = angular.module('netStatsApp', ['netStatsApp.filters', 'netStatsApp.directives', 'ngStorage']); +netStatsApp.run(function($rootScope) { + $rootScope.networkName = networkName || 'Ethereum'; + $rootScope.faviconPath = faviconPath || '/favicon.ico'; +}); + /* Services */ diff --git a/src/js/defaultConfig.js b/src/js/defaultConfig.js new file mode 100644 index 0000000..8b3e782 --- /dev/null +++ b/src/js/defaultConfig.js @@ -0,0 +1,2 @@ +var networkName = 'Ethereum'; +var faviconPath = '/favicon.ico'; diff --git a/src/pow/views/layout.jade b/src/pow/views/layout.jade index be0b2fb..8d46fd3 100644 --- a/src/pow/views/layout.jade +++ b/src/pow/views/layout.jade @@ -3,12 +3,12 @@ doctype html html(ng-app="netStatsApp") head meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0") - title Ethereum Network Status + title {{ $root.networkName }} Network Status 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='/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") + link(rel='shortcut icon', type="image/x-icon", href="{{$root.faviconPath}}") body block content script(src="/js/netstats.min.js") diff --git a/src/views/layout.jade b/src/views/layout.jade index c8af900..8d46fd3 100644 --- a/src/views/layout.jade +++ b/src/views/layout.jade @@ -3,12 +3,12 @@ doctype html html(ng-app="netStatsApp") head meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0") - title Testnet Network Status + title {{ $root.networkName }} Network Status 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='/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") + link(rel='shortcut icon', type="image/x-icon", href="{{$root.faviconPath}}") body block content script(src="/js/netstats.min.js") From 2aeb8db2830f9f0dff895f1972296c14f2db4721 Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Mon, 18 Feb 2019 19:49:47 +0100 Subject: [PATCH 2/2] add frontend config file build command to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 1024178..2757ae9 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ In order to build the static files you have to run grunt tasks which will genera grunt poa ``` +To build the static files for a network other than Ethereum copy and change src/js/defaultConfig.js and run the following command. + +```bash +grunt poa --configPath="src/js/someOtherConfig.js" +``` + #### Run Start a node process and pass the websocket secret to it.