diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-04-06 15:37:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-06 15:37:52 +0800 |
commit | 4a42ac86a05fc760f8ec94244e91f985723a5ac4 (patch) | |
tree | 451a9ceee024774253107d9d608ea923760824ec /mascara | |
parent | b9223032235df9e1fc2785f885819d84f2b51dbe (diff) | |
parent | 4b8324620e4f850b1674692cf8c45a4ca70101b4 (diff) | |
download | tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.tar tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.tar.gz tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.tar.bz2 tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.tar.lz tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.tar.xz tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.tar.zst tangerine-wallet-browser-4a42ac86a05fc760f8ec94244e91f985723a5ac4.zip |
Merge pull request #1311 from MetaMask/mascara-publish
Mascara - docker support
Diffstat (limited to 'mascara')
-rw-r--r-- | mascara/server/index.js | 8 | ||||
-rw-r--r-- | mascara/src/mascara.js | 31 |
2 files changed, 18 insertions, 21 deletions
diff --git a/mascara/server/index.js b/mascara/server/index.js index 9fd664eee..14e3fa18e 100644 --- a/mascara/server/index.js +++ b/mascara/server/index.js @@ -8,10 +8,10 @@ module.exports = createMetamascaraServer function createMetamascaraServer(){ // start bundlers - const metamascaraBundle = createBundle('./src/mascara.js') - const proxyBundle = createBundle('./src/proxy.js') - const uiBundle = createBundle('./src/ui.js') - const backgroundBuild = createBundle('./src/background.js') + const metamascaraBundle = createBundle(__dirname + '/../src/mascara.js') + const proxyBundle = createBundle(__dirname + '/../src/proxy.js') + const uiBundle = createBundle(__dirname + '/../src/ui.js') + const backgroundBuild = createBundle(__dirname + '/../src/background.js') // serve bundles const server = express() diff --git a/mascara/src/mascara.js b/mascara/src/mascara.js index f9bed7e52..0fc2868e1 100644 --- a/mascara/src/mascara.js +++ b/mascara/src/mascara.js @@ -1,44 +1,41 @@ const Web3 = require('web3') const setupProvider = require('./lib/setup-provider.js') -const MASACARA_DOMAIN = 'http://localhost:9001' +const MASCARA_ORIGIN = process.env.MASCARA_ORIGIN || 'http://localhost:9001' +console.log('MASCARA_ORIGIN:', MASCARA_ORIGIN) // // setup web3 // -var provider = setupProvider({ - mascaraUrl: MASACARA_DOMAIN + '/proxy/', +const provider = setupProvider({ + mascaraUrl: MASCARA_ORIGIN + '/proxy/', }) instrumentForUserInteractionTriggers(provider) -var web3 = new Web3(provider) -web3.setProvider = function(){ - console.log('MetaMask - overrode web3.setProvider') -} +const web3 = new Web3(provider) +global.web3 = web3 // -// -// export web3 +// ui stuff // -global.web3 = web3 +let shouldPop = false +window.addEventListener('click', maybeTriggerPopup) // -// ui stuff +// util // -var shouldPop = false -window.addEventListener('click', function(){ +function maybeTriggerPopup(){ if (!shouldPop) return shouldPop = false - window.open(MASACARA_DOMAIN, '', 'width=360 height=500') + window.open(MASCARA_ORIGIN, '', 'width=360 height=500') console.log('opening window...') -}) - +} function instrumentForUserInteractionTriggers(provider){ - var _super = provider.sendAsync.bind(provider) + const _super = provider.sendAsync.bind(provider) provider.sendAsync = function(payload, cb){ if (payload.method === 'eth_sendTransaction') { console.log('saw send') |