From 2af05955bb1badb0adbf5b17982a1023be3c6002 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sun, 4 Nov 2018 00:52:48 +0100 Subject: [PATCH] Fix Windows builds --- src/main/binaries.js | 4 +++- src/main/index.js | 8 ++++++-- src/main/wowrpc.js | 9 ++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/binaries.js b/src/main/binaries.js index 30e3980..2bb0b43 100644 --- a/src/main/binaries.js +++ b/src/main/binaries.js @@ -5,6 +5,7 @@ import appRootDir from 'app-root-dir'; const IS_PROD = process.env.NODE_ENV === 'production'; console.log('Prod: ' + IS_PROD); + import getPlatform from './get-platform'; const execPath = IS_PROD ? @@ -15,8 +16,9 @@ const execPath = IS_PROD ? const cli_binaries = { 'linux': 'wowlight', 'mac': 'wowlight', - 'win32': 'wowlight.exe' + 'win': 'wowlight.exe' } export const cliPath = `${joinPath(execPath, cli_binaries[getPlatform()])}`; +export const platform = getPlatform(); console.log('binaries.js - clipPath: ' + cliPath); diff --git a/src/main/index.js b/src/main/index.js index 992e720..2844791 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -37,7 +37,7 @@ console.log(`getWalletDir(): ${wowdir}`); const Menu = electron.Menu; const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html` -import { cliPath } from './binaries'; +import { platform, cliPath } from './binaries'; console.log(cliPath); @@ -49,7 +49,11 @@ function createWindow() { }); mainWindow.setMenu(null); - mainWindow.setResizable(false); + + if(platform !== 'win'){ + mainWindow.setResizable(false); + } + mainWindow.loadURL(winURL); // mainWindow.webContents.openDevTools(); mainWindow.webContents.on("devtools-opened", () => { diff --git a/src/main/wowrpc.js b/src/main/wowrpc.js index fcd24e8..a36f20a 100644 --- a/src/main/wowrpc.js +++ b/src/main/wowrpc.js @@ -4,7 +4,7 @@ const path = require('path'); let childProcess = require('child_process'); let textEncoding = require('text-encoding'); let TextDecoder = textEncoding.TextDecoder; -import { cliPath } from './binaries'; +import { platform, cliPath } from './binaries'; export class WowRpc { // ps -ef | grep defunct | grep -v grep | cut -b8-20 | xargs kill -9 @@ -129,6 +129,8 @@ export class WowRpc { } _parse_stdout(data){ + if(platform === 'win'){ data = data.replace(/\r/g, ""); } + // detect incoming transaction let re_incoming_tx = /Height \d+, txid \<([a-zA-Z0-9]+)\>, ([0-9]+.[0-9]+), idx/g; if(data.match(re_incoming_tx)){ @@ -258,6 +260,7 @@ export class WowRpc { } _parse_stdout_create_wallet(data){ + if(platform === 'win'){ data = data.replace(/\r/g, ""); } // lol windows this._buffer += data; if(data === `Logging to ${this._cli_log_path}\n`){ @@ -286,10 +289,10 @@ export class WowRpc { this._create_wallet['view_key'] = re_view_key_match[1]; } - let re_seed = /NOTE: the following 25 words can be used to recover access to your wallet. Write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control.\n\n(.*)\n(.*)\n(.*)\n\*\*\*\*/; + let re_seed = /\*\*\*\*\*\*SEED\n(.*)\n\*\*/ let re_seed_match = this._buffer.match(re_seed); if(re_seed_match){ - let seed = `${re_seed_match[1]} ${re_seed_match[2]} ${re_seed_match[3]}`; + let seed = re_seed_match[1].trim(); if(seed.split(' ').length !== 25){ this.onCreateWalletFinished("could not get seed; invalid num words"); }