etherparty / explorer

A lightweight ethereum block explorer
GNU General Public License v2.0
632 stars 399 forks source link

Allow Access to Geth and Refresh the Page #30

Open DhaneshKothari opened 7 years ago

DhaneshKothari commented 7 years ago

Hi, I'm getting following pop-up when trying to run explorer: "Allow Access to Geth and Refresh the Page"

What can I do in order to move forward?

Thanks

chainhead commented 6 years ago

@DhaneshKothari I am also facing the same issue. This is a similar issue https://github.com/etherparty/explorer/issues/26 However, that didn't work for me.

ZiangYan commented 6 years ago

same problem, no appropriate solution found in #26

ryanlowdermilk commented 6 years ago

Same.

vderelle commented 6 years ago

I figured out how to solve the issue. The app.js file in ../explorer/app/ contains configuration variables. You simply need to modify the value for GETH_HOSTNAME to your public domain name. Presumably a public IP address would work as well.

I'm not sure why this isn't stated in the README file. It looks like its a common issue for people.

VERTlG0 commented 6 years ago

@vderelle Where is this GETH_HOSTNAME variable?

Here is app.js file:

'use strict';

angular.module('ethExplorer', ['ngRoute','ui.bootstrap'])

.config(['$routeProvider',
    function($routeProvider) {
        $routeProvider.
            when('/', {
                templateUrl: 'views/main.html',
                controller: 'mainCtrl'
            }).
            when('/block/:blockId', {
                templateUrl: 'views/blockInfos.html',
                controller: 'blockInfosCtrl'
            }).
            when('/transaction/:transactionId', {
                templateUrl: 'views/transactionInfos.html',
                controller: 'transactionInfosCtrl'
            }).
            when('/address/:addressId', {
                templateUrl: 'views/addressInfo.html',
                controller: 'addressInfoCtrl'
            }).
            otherwise({
                redirectTo: '/'
            });
    }])
    .run(function($rootScope) {
        var web3 = new Web3();
        var eth_node_url = 'http://localhost:8545'; // TODO: remote URL
    web3.setProvider(new web3.providers.HttpProvider(eth_node_url));
        $rootScope.web3 = web3;
        function sleepFor( sleepDuration ){
            var now = new Date().getTime();
            while(new Date().getTime() < now + sleepDuration){ /* do nothing */ } 
        }
        var connected = false;
        if(!web3.isConnected()) {
            $('#connectwarning').modal({keyboard:false,backdrop:'static'}) 
            $('#connectwarning').modal('show') 
        }
});
songtaeil commented 6 years ago

I have solved it. thank you. You can change the eth_node_url from localhost to private ip address or public for correcting this problem

sudhaaddagiri commented 5 years ago

I had changed in app.js file to my vm public IP but how are you running geth.. are you adding rpccorsaddress in geth

zhangyi999 commented 4 years ago

inpage.js:1 Access to XMLHttpRequest at 'http://0.0.0.0:8889/' from origin 'http://0.0.0.0:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.