From a4cdd198438816b99630adf7c30d28a8ec2a18bb Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 13 Sep 2016 00:31:04 -0700 Subject: mascara - everything but the popup bundle --- library/index.js | 2 +- library/popup.js | 19 +++++++++++++++++++ library/server.js | 10 ++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 library/popup.js (limited to 'library') diff --git a/library/index.js b/library/index.js index 6e43181c9..ded588967 100644 --- a/library/index.js +++ b/library/index.js @@ -27,7 +27,7 @@ var shouldPop = false window.addEventListener('click', function(){ if (!shouldPop) return shouldPop = false - window.open('popup.html', '', 'width=1000') + window.open('http://localhost:9001/popup/popup.html', '', 'width=1000') console.log('opening window...') }) diff --git a/library/popup.js b/library/popup.js new file mode 100644 index 000000000..667b13371 --- /dev/null +++ b/library/popup.js @@ -0,0 +1,19 @@ +const injectCss = require('inject-css') +const MetaMaskUiCss = require('../ui/css') +const startPopup = require('../app/scripts/popup-core') +const setupIframe = require('./lib/setup-iframe.js') + + +var css = MetaMaskUiCss() +injectCss(css) + +var name = 'popup' +window.METAMASK_UI_TYPE = name + +var iframeStream = setupIframe({ + zeroClientProvider: 'http://127.0.0.1:9001', + sandboxAttributes: ['allow-scripts', 'allow-popups', 'allow-same-origin'], + container: document.body, +}) + +startPopup(iframeStream) diff --git a/library/server.js b/library/server.js index 495aba914..033c65358 100644 --- a/library/server.js +++ b/library/server.js @@ -6,6 +6,7 @@ const path = require('path') const zeroBundle = createBundle('./index.js') const controllerBundle = createBundle('./controller.js') +// const popupBundle = createBundle('./popup.js') const appBundle = createBundle('./example/index.js') // @@ -14,6 +15,12 @@ const appBundle = createBundle('./example/index.js') const iframeServer = express() +// serve popup window +// iframeServer.get('/popup/scripts/popup.js', function(req, res){ +// res.send(popupBundle.latest) +// }) +iframeServer.use('/popup', express.static('../dist/chrome')) + // serve controller bundle iframeServer.get('/controller.js', function(req, res){ res.send(controllerBundle.latest) @@ -21,8 +28,7 @@ iframeServer.get('/controller.js', function(req, res){ // serve background controller iframeServer.use(express.static('./server')) -// serve popup window -// iframeServer.use('/popup', express.static('../dist/chrome')) + iframeServer.listen('9001') -- cgit