1+ // begin AltSheets changes
2+ ///////////////////////////////
3+ // TODO: Put go into a config.js
4+ // But how to include a file from local?
5+
6+ var GETH_HOSTNAME = process . env . ETHEREUM_RPC_HOST ; // put your IP address!
7+ var APP_HOSTNAME = "See package.json --> scripts --> start: Change 'localhost'!!!" ;
8+
9+ var GETH_RPCPORT = process . env . ETHEREUM_RPC_PORT ; // for geth --rpcport GETH_RPCPORT
10+ var APP_PORT = "See package.json --> scripts --> start: Perhaps change '8000'" ;
11+
12+ // this is creating the corrected geth command
13+ var WL = window . location ;
14+ var geth_command = "geth --rpc --rpcaddr " + GETH_HOSTNAME + " --rpcport " + GETH_RPCPORT + '\
15+ --rpcapi "web3,eth" ' + ' --rpccorsdomain "' + WL . protocol + "//" + WL . host + '"' ;
16+
17+ ////////////////////////////////////////////////////
18+ //end AltSheets changes
19+
20+
21+ 'use strict' ;
22+
23+ angular . module ( 'ethExplorer' , [ 'ngRoute' , 'ui.bootstrap' , 'filters' , 'ngSanitize' ] )
24+
25+ . config ( [ '$routeProvider' ,
26+ function ( $routeProvider ) {
27+ $routeProvider .
28+ when ( '/' , {
29+ templateUrl : 'views/main.html' ,
30+ controller : 'mainCtrl'
31+ } ) .
32+ when ( '/block/:blockId' , {
33+ templateUrl : 'views/blockInfos.html' ,
34+ controller : 'blockInfosCtrl'
35+ } ) .
36+ when ( '/tx/:transactionId' , {
37+ templateUrl : 'views/transactionInfos.html' ,
38+ controller : 'transactionInfosCtrl'
39+ } ) .
40+ when ( '/address/:addressId' , {
41+ templateUrl : 'views/addressInfos.html' ,
42+ controller : 'addressInfosCtrl'
43+ } ) .
44+
45+ // info page with links:
46+ when ( '/chain/api' , {
47+ templateUrl : 'views/api/api.html' ,
48+ controller : 'chainInfosCtrl'
49+ } ) .
50+
51+ // getBlock (current) & getBlock (last)
52+ when ( '/chain/' , {
53+ templateUrl : 'views/chainInfos.html' ,
54+ controller : 'chainInfosCtrl'
55+ } ) .
56+ when ( '/chain/gaslimit' , {
57+ templateUrl : 'views/api/gaslimit.html' ,
58+ controller : 'chainInfosCtrl'
59+ } ) .
60+ when ( '/chain/difficulty' , {
61+ templateUrl : 'views/api/difficulty.html' ,
62+ controller : 'chainInfosCtrl'
63+ } ) .
64+ /*
65+ // fast = doesn't need to getBlock any block
66+ when('/chain/blocknumber', {
67+ templateUrl: 'views/api/blocknumber.html',
68+ controller: 'fastInfosCtrl'
69+ }).
70+ when('/chain/supply', {
71+ templateUrl: 'views/api/supply.html',
72+ controller: 'fastInfosCtrl'
73+ }).
74+ when('/chain/mined', {
75+ templateUrl: 'views/api/mined.html',
76+ controller: 'fastInfosCtrl'
77+ }).
78+
79+ // begin of: not yet, see README.md
80+ when('/chain/supply/public', {
81+ templateUrl: 'views/api/supplypublic.html',
82+ controller: 'fastInfosCtrl'
83+ }).*/
84+ // end of: not yet, see README.md
85+
86+ otherwise ( {
87+ redirectTo : '/'
88+ } ) ;
89+
90+ //$locationProvider.html5Mode(true);
91+ } ] )
92+ . run ( function ( $rootScope ) {
93+ var web3 = require ( 'web3' ) ;
94+
95+ // begin AltSheets changes
96+ web3 . setProvider ( new web3 . providers . HttpProvider ( "http://" + GETH_HOSTNAME + ":" + GETH_RPCPORT ) ) ;
97+ // end AltSheets changes
98+
99+ $rootScope . web3 = web3 ;
100+ // MetaMask injects its own web3 instance in all pages, override it
101+ // as it might be not compatible with the one used here
102+ if ( window . web3 )
103+ window . web3 = web3 ;
104+ function sleepFor ( sleepDuration ) {
105+ var now = new Date ( ) . getTime ( ) ;
106+ while ( new Date ( ) . getTime ( ) < now + sleepDuration ) { /* do nothing */ }
107+ }
108+ var connected = false ;
109+ if ( ! web3 . isConnected ( ) ) {
110+ $ ( '#connectwarning' ) . modal ( { keyboard :false , backdrop :'static' } )
111+ $ ( '#connectwarning' ) . modal ( 'show' )
112+ }
113+ } ) ;
0 commit comments