trezor v5 working on firefox

feature/default_network_editable
brunobar79 6 years ago
parent f2194e8482
commit aaed44f1ec
  1. 12
      app/manifest.json
  2. 33
      app/trezor-usb-permissions.html
  3. 14993
      app/vendor/trezor/connect.js
  4. 21
      app/vendor/trezor/content-script.js
  5. 20
      app/vendor/trezor/usb-permissions.js
  6. 4
      gulpfile.js
  7. 3
      package-lock.json

@ -28,7 +28,8 @@
"background": {
"scripts": [
"chromereload.js",
"background.js"
"background.js",
"vendor/trezor/connect.js"
],
"persistent": true
},
@ -52,6 +53,14 @@
],
"run_at": "document_start",
"all_frames": true
},
{
"matches": [
"*://connect.trezor.io/5/popup.html"
],
"js": [
"vendor/trezor/content-script.js"
]
}
],
"permissions": [
@ -60,6 +69,7 @@
"clipboardWrite",
"http://localhost:8545/",
"https://*.infura.io/",
"*://connect.trezor.io/5/*",
"activeTab",
"webRequest",
"*://*.eth/",

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<title>TrezorConnect | Trezor</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="Trezor info@trezor.io" />
<meta name="robots" content="noindex, nofollow" />
<meta name="title" content="Trezor Connect" />
<meta name="theme-color" content="#ffffff" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<style>
* {
margin: 0;
padding: 0;
}
html, body {
position: relative;
width: 100%;
height: 100%;
min-height: 500px;
min-width: 328px;
}
</style>
</head>
<body>
<iframe id="trezor-usb-permissions" src="https://connect.trezor.io/5/extension-permissions.html" allow="usb" frameborder="0" width="100%" height="100%"></iframe>
<script type="text/javascript" src="./vendor/trezor/usb-permissions.js"></script>
</body>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,21 @@
/*
Passing messages from background script to popup
*/
let port = chrome.runtime.connect({ name: 'trezor-connect' });
port.onMessage.addListener(message => {
window.postMessage(message, window.location.origin);
});
port.onDisconnect.addListener(d => {
port = null;
});
/*
Passing messages from popup to background script
*/
window.addEventListener('message', event => {
if (port && event.source === window && event.data) {
port.postMessage(event.data);
}
});

@ -0,0 +1,20 @@
/*
Handling messages from usb permissions iframe
*/
window.addEventListener('message', event => {
if (event.data === 'usb-permissions-init') {
const iframe = document.getElementById('trezor-usb-permissions');
iframe.contentWindow.postMessage({
type: 'usb-permissions-init',
extension: chrome.runtime.id,
}, '*');
} else if (event.data === 'usb-permissions-close') {
chrome.tabs.query({
currentWindow: true,
active: true,
}, (tabs) => {
chrome.tabs.remove(tabs[0].id);
});
}
});

@ -74,6 +74,10 @@ createCopyTasks('fonts', {
source: './app/fonts/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/fonts`),
})
createCopyTasks('vendor', {
source: './app/vendor/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/vendor`),
})
createCopyTasks('reload', {
devOnly: true,
source: './app/scripts/',

3
package-lock.json generated

@ -8681,12 +8681,13 @@
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz",
"integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=",
"requires": {
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
"ethereumjs-util": "^5.1.1"
},
"dependencies": {
"ethereumjs-abi": {
"version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
"requires": {
"bn.js": "^4.10.0",
"ethereumjs-util": "^5.0.0"

Loading…
Cancel
Save