Add trezor support

This commit is contained in:
Mati Dastugue 2020-05-11 18:36:39 -03:00
parent 7bc9cd7a94
commit f2dd025afc
5 changed files with 1437 additions and 1431 deletions

View File

@ -148,7 +148,7 @@
"async-sema": "^3.1.0",
"axios": "0.19.2",
"bignumber.js": "9.0.0",
"bnc-onboard": "1.7.6",
"bnc-onboard": "1.9.0",
"connected-react-router": "6.8.0",
"cross-env": "^7.0.2",
"currency-flags": "^2.1.1",

View File

@ -46,18 +46,16 @@ function getOpenedWindow(url,options) {
options.webPreferences.affinity = 'main-window';
if(url.includes('about:blank')){
/*
if(url.includes('trezor')){
session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {
details.requestHeaders['Origin'] = 'https://electron.trezor.io';
details.requestHeaders['Origin'] = 'https://connect.trezor.io';
callback({cancel: false, requestHeaders: details.requestHeaders});
});
*/
}
if(url.includes('wallet.portis') || url.includes('about:blank') || url.includes('app.tor.us')){
if(url.includes('wallet.portis') || url.includes('trezor') || url.includes('app.tor.us')){
const win = new BrowserWindow({
width:300,
width:350,
height:700,
x: width - 1300,
parent:mainWindow,
@ -66,7 +64,10 @@ function getOpenedWindow(url,options) {
fullscreen: false,
show: false,
});
win.webContents.on('new-window', function(event, url){
if(url.includes('trezor') && url.includes('bridge'))
open(url);
});
win.once('ready-to-show', () => win.show());
if(!options.webPreferences){

View File

@ -3,19 +3,28 @@
const TransportNodeHid = require("@ledgerhq/hw-transport-node-hid").default;
const log = require('electron-log');
const isDev = require("electron-is-dev");
window.TransportNodeHid = TransportNodeHid;
window.isDesktop = true;
window.addEventListener('DOMContentLoaded', () => {
console.error = (...args) => {
log.error(...args)
}
console.warn = (...args) => {
log.warn(...args)
}
console.log = (...args) => {
log.info(...args)
const origLog = console.log
const origError = console.error
const origWarn = console.warn
if(!isDev){
console.error = (...args) => {
origError(...args)
log.error(...args)
}
console.warn = (...args) => {
origWarn(...args)
log.warn(...args)
}
console.log = (...args) => {
origLog(...args)
log.info(...args)
}
}
const replaceText = (selector, text) => {
const element = document.getElementById(selector)

View File

@ -1,6 +1,10 @@
/* Onboard.js custom styles */
:global(.bn-onboard-custom.bn-onboard-modal) {
font-family: "Averta";
font-family: 'Averta';
z-index: 2001;
}
}
:global(.torusIframe) {
z-index: 9999;
}

2818
yarn.lock

File diff suppressed because it is too large Load Diff