Commit f303e7f7 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #519 from ethereum/dontalertifparamsetinurl

Do not alert user if config set from the url param
parents ca2f8910 29cc9884
......@@ -898,12 +898,10 @@ var run = function () {
setVersionText(version)
runCompiler()
if (queryParams.get().endpointurl) {
executionContext.setEndPointUrl(queryParams.get().endpointurl)
}
if (queryParams.get().context) {
executionContext.setContext(queryParams.get().context)
executionContext.setContext(queryParams.get().context, queryParams.get().endpointurl)
}
if (queryParams.get().debugtx) {
startdebugging(queryParams.get().debugtx)
}
......
/* global confirm, prompt */
'use strict'
var $ = require('jquery')
var Web3 = require('web3')
var EventManager = require('../lib/eventManager')
var EthJSVM = require('ethereumjs-vm')
......@@ -87,32 +86,24 @@ function ExecutionContext () {
return vm
}
this.setEndPointUrl = function (url) {
$web3endpoint.val(url)
}
this.setContext = function (context) {
this.setContext = function (context, endPointUrl) {
executionContext = context
executionContextChange(context)
}
var $web3endpoint = $('#web3Endpoint')
if (web3.providers && web3.currentProvider instanceof web3.providers.IpcProvider) {
$web3endpoint.val('ipc')
executionContextChange(context, endPointUrl)
}
function executionContextChange (context) {
if (context === 'web3' && !confirm('Are you sure you want to connect to a local ethereum node?')) {
function executionContextChange (context, endPointUrl) {
if (context === 'web3' && !confirm('Are you sure you want to connect to an ethereum node?')) {
return false
} else if (context === 'injected' && injectedProvider === undefined) {
return false
} else {
if (context === 'web3') {
executionContext = context
var endpoint = prompt('Please type Web3 Provider Endpoint', 'http://localhost:8545')
setProviderFromEndpoint(endpoint)
self.event.trigger('web3EndpointChanged')
if (!endPointUrl) {
endPointUrl = 'http://localhost:8545'
}
endPointUrl = prompt('Web3 Provider Endpoint', endPointUrl)
setProviderFromEndpoint(endPointUrl)
self.event.trigger('contextChanged', ['web3'])
} else if (context === 'injected') {
executionContext = context
......@@ -135,6 +126,7 @@ function ExecutionContext () {
} else {
web3.setProvider(new web3.providers.HttpProvider(endpoint))
}
self.event.trigger('web3EndpointChanged')
}
/* ---------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment