diff options
mascara - everything but the popup bundle
-rw-r--r-- | app/scripts/popup.js | 2 | ||||
-rw-r--r-- | library/index.js | 2 | ||||
-rw-r--r-- | library/popup.js | 19 | ||||
-rw-r--r-- | library/server.js | 10 |
4 files changed, 29 insertions, 4 deletions
diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 8485b5081..e6f149f96 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -1,7 +1,7 @@ const injectCss = require('inject-css') const MetaMaskUiCss = require('../../ui/css') -const PortStream = require('./lib/port-stream.js') const startPopup = require('./popup-core') +const PortStream = require('./lib/port-stream.js') const isPopupOrNotification = require('./lib/is-popup-or-notification') const extension = require('./lib/extension') const notification = require('./lib/notifications') 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') |