diff --git a/public/electron.js b/public/electron.js index f6f21f85..c5fba73c 100644 --- a/public/electron.js +++ b/public/electron.js @@ -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){ diff --git a/scripts/preload.js b/scripts/preload.js new file mode 100644 index 00000000..33cee9e6 --- /dev/null +++ b/scripts/preload.js @@ -0,0 +1,37 @@ +// All of the Node.js APIs are available in the preload process. +// It has the same sandbox as a Chrome extension. + +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', () => { + 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) + if (element) element.innerText = text + } + + for (const type of ['chrome', 'node', 'electron']) { + replaceText(`${type}-version`, process.versions[type]) + } +}) \ No newline at end of file diff --git a/src/logic/wallets/utils/walletList.ts b/src/logic/wallets/utils/walletList.ts index ee2a7d52..18bcff0a 100644 --- a/src/logic/wallets/utils/walletList.ts +++ b/src/logic/wallets/utils/walletList.ts @@ -22,7 +22,7 @@ const wallets = [ appUrl: 'gnosis-safe.io', preferred: true, email: 'safe@gnosis.io', - desktop: false, + desktop: true, rpcUrl: infuraUrl, }, { diff --git a/src/routes/safe/container/index.tsx b/src/routes/safe/container/index.jsx similarity index 99% rename from src/routes/safe/container/index.tsx rename to src/routes/safe/container/index.jsx index e2533b89..672cf317 100644 --- a/src/routes/safe/container/index.tsx +++ b/src/routes/safe/container/index.jsx @@ -5,7 +5,6 @@ import { useSelector } from 'react-redux' import Page from 'src/components/layout/Page' import Layout from 'src/routes/safe/components/Layout' - import { safeParamAddressFromStateSelector } from 'src/routes/safe/store/selectors' import { useLoadSafe } from './hooks/useLoadSafe' import { useCheckForUpdates } from './hooks/useCheckForUpdates'