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 () { ...@@ -898,12 +898,10 @@ var run = function () {
setVersionText(version) setVersionText(version)
runCompiler() runCompiler()
if (queryParams.get().endpointurl) {
executionContext.setEndPointUrl(queryParams.get().endpointurl)
}
if (queryParams.get().context) { if (queryParams.get().context) {
executionContext.setContext(queryParams.get().context) executionContext.setContext(queryParams.get().context, queryParams.get().endpointurl)
} }
if (queryParams.get().debugtx) { if (queryParams.get().debugtx) {
startdebugging(queryParams.get().debugtx) startdebugging(queryParams.get().debugtx)
} }
......
/* global confirm, prompt */ /* global confirm, prompt */
'use strict' 'use strict'
var $ = require('jquery')
var Web3 = require('web3') var Web3 = require('web3')
var EventManager = require('../lib/eventManager') var EventManager = require('../lib/eventManager')
var EthJSVM = require('ethereumjs-vm') var EthJSVM = require('ethereumjs-vm')
...@@ -87,32 +86,24 @@ function ExecutionContext () { ...@@ -87,32 +86,24 @@ function ExecutionContext () {
return vm return vm
} }
this.setEndPointUrl = function (url) { this.setContext = function (context, endPointUrl) {
$web3endpoint.val(url)
}
this.setContext = function (context) {
executionContext = context executionContext = context
executionContextChange(context) executionContextChange(context, endPointUrl)
}
var $web3endpoint = $('#web3Endpoint')
if (web3.providers && web3.currentProvider instanceof web3.providers.IpcProvider) {
$web3endpoint.val('ipc')
} }
function executionContextChange (context) { function executionContextChange (context, endPointUrl) {
if (context === 'web3' && !confirm('Are you sure you want to connect to a local ethereum node?')) { if (context === 'web3' && !confirm('Are you sure you want to connect to an ethereum node?')) {
return false return false
} else if (context === 'injected' && injectedProvider === undefined) { } else if (context === 'injected' && injectedProvider === undefined) {
return false return false
} else { } else {
if (context === 'web3') { if (context === 'web3') {
executionContext = context executionContext = context
var endpoint = prompt('Please type Web3 Provider Endpoint', 'http://localhost:8545') if (!endPointUrl) {
setProviderFromEndpoint(endpoint) endPointUrl = 'http://localhost:8545'
self.event.trigger('web3EndpointChanged') }
endPointUrl = prompt('Web3 Provider Endpoint', endPointUrl)
setProviderFromEndpoint(endPointUrl)
self.event.trigger('contextChanged', ['web3']) self.event.trigger('contextChanged', ['web3'])
} else if (context === 'injected') { } else if (context === 'injected') {
executionContext = context executionContext = context
...@@ -135,6 +126,7 @@ function ExecutionContext () { ...@@ -135,6 +126,7 @@ function ExecutionContext () {
} else { } else {
web3.setProvider(new web3.providers.HttpProvider(endpoint)) 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