aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-25 08:32:20 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-25 08:32:20 +0800
commit74fd6d1d1227d7a9e49623b73ee85985d79a1e46 (patch)
tree0329696b64e9f300c05919729d87dbb0dbd99655 /app/scripts
parentd5929e5c42e230fc0a52337f86b5850e68516563 (diff)
downloadtangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar
tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.gz
tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.bz2
tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.lz
tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.xz
tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.zst
tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.zip
working without injection
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/contentscript.js41
-rw-r--r--app/scripts/metamask-controller.js18
-rw-r--r--app/scripts/platforms/extension.js6
3 files changed, 0 insertions, 65 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index 83ed85a1a..72de16f31 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -6,7 +6,6 @@ const PongStream = require('ping-pong-stream/pong')
const ObjectMultiplex = require('obj-multiplex')
const extension = require('extensionizer')
const PortStream = require('./lib/port-stream.js')
-const Instascan = require('instascan')
const inpageContent = fs.readFileSync(path.join(__dirname, '..', '..', 'dist', 'chrome', 'inpage.js')).toString()
const inpageSuffix = '//# sourceURL=' + extension.extension.getURL('inpage.js') + '\n'
@@ -201,43 +200,3 @@ function redirectToPhishingWarning () {
window.location.href = 'https://metamask.io/phishing.html'
}
-function initQrCodeScanner () {
- // Append preview div
- const preview = document.createElement('div')
- preview.id = 'metamask-preview-wrapper'
- preview.style = 'position:fixed; top: 20px; left: 20px; width: 300px; height: 300px; overflow: hidden; z-index: 999999999;'
- const previewVideo = document.createElement('video')
- previewVideo.id = 'metamask-preview-video'
- previewVideo.style = 'width: 100%; height: 100%; object-fit: none; margin-left: -10%; margin-top: 10%;'
- preview.appendChild(previewVideo)
- document.body.appendChild(preview)
- console.log('injected')
- const scanner = new Instascan.Scanner({
- video: document.getElementById('metamask-preview-video'),
- backgroundScan: false,
- continuous: true,
- })
- scanner.addListener('scan', function (content) {
- scanner.stop().then(_ => {
- extension.runtime.sendMessage({
- action: 'qr-code-scanner-data',
- data: content,
- })
- document.getElementById('metamask-preview-wrapper').parentElement.removeChild(document.getElementById('metamask-preview-wrapper'))
- })
- })
- Instascan.Camera.getCameras().then(function (cameras) {
- if (cameras.length > 0) {
- scanner.start(cameras[0])
- } else {
- console.error('No cameras found.')
- }
- }).catch(function (e) {
- console.error(e)
- })
-}
-
-extension.runtime.onMessage.addListener(({ action }) => {
- initQrCodeScanner()
-})
-
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index f67d4edf8..c6be4b9d2 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -380,9 +380,6 @@ module.exports = class MetamaskController extends EventEmitter {
// TREZOR
unlockTrezorAccount: nodeify(this.unlockTrezorAccount, this),
- // QR code scanner
- scanQrCode: nodeify(this.scanQrCode, this),
-
// vault management
submitPassword: nodeify(this.submitPassword, this),
@@ -658,21 +655,6 @@ module.exports = class MetamaskController extends EventEmitter {
return { ...keyState, identities }
}
- scanQrCode () {
- return new Promise((resolve, reject) => {
- // Tell contentscript to inject the QR reader
- this.platform.sendMessageToActiveTab('qr-code-scanner-init')
- // Wait for the scanner to send something back
- this.platform.addMessageListener(({ action, data }) => {
- if (action && action === 'qr-code-scanner-data') {
- const normalizedAddress = data.replace('ethereum:', '')
- resolve(normalizedAddress)
- }
- })
- })
- }
-
-
//
// Account Management
//
diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js
index 1cab0bedd..452a51bd8 100644
--- a/app/scripts/platforms/extension.js
+++ b/app/scripts/platforms/extension.js
@@ -36,12 +36,6 @@ class ExtensionPlatform {
extension.runtime.onMessage.addListener(cb)
}
- sendMessageToActiveTab (message, query = {}) {
- extension.tabs.query(query, tabs => {
- const activeTab = tabs.filter(tab => tab.active)[0]
- extension.tabs.sendMessage(activeTab.id, message)
- })
- }
}
module.exports = ExtensionPlatform