Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
add fixed geth start and add eth master password
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Oct 13, 2015
1 parent 3e41443 commit ba6000e
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 107 deletions.
4 changes: 4 additions & 0 deletions interface/client/templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Template.body.helpers({
// $('title').text(TAPi18n.__('mist.popupWindows.requestAccount.title')
return 'popupWindows_requestAccount';
}
if(location.hash === '#unlockMasterPassword') {
// $('title').text(TAPi18n.__('mist.popupWindows.requestAccount.title')
return 'popupWindows_unlockMasterPassword';
}
if(location.hash === '#sendTransactionConfirmation') {
// $('title').text(TAPi18n.__('mist.popupWindows.requestAccount.title')
return 'popupWindows_sendTransactionConfirmation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ Template['popupWindows_sendTransactionConfirmation'].events({

if(!e && res) {
ipc.send('uiAction_unlockedAccount', null, gas);
// make sure we first confirm, before we close the window
setTimeout(function(){
ipc.send('uiAction_closePopupWindow');
}, 200);

} else {
Tracker.afterFlush(function(){
Expand Down
14 changes: 14 additions & 0 deletions interface/client/templates/popupWindows/unlockMasterPassword.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template name="popupWindows_unlockMasterPassword">
<div class="popup-windows">
<form action="#">
<h1>{{i18n "mist.popupWindows.unlockMasterPassword.title"}}</h1>

<input type="password" placeholder="{{i18n 'mist.popupWindows.unlockMasterPassword.enterPassword'}}" class="password">

<div class="dapp-modal-buttons">
<button class="cancel" type="button">{{i18n "buttons.cancel"}}</button>
<button class="ok dapp-primary-button" type="submit">{{i18n "buttons.ok"}}</button>
</div>
</form>
</div>
</template>
32 changes: 32 additions & 0 deletions interface/client/templates/popupWindows/unlockMasterPassword.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
Template Controllers
@module Templates
*/

/**
The request account popup window template
@class [template] popupWindows_unlockMasterPassword
@constructor
*/

Template['popupWindows_unlockMasterPassword'].onRendered(function(){
this.$('input.password').focus();
});


Template['popupWindows_unlockMasterPassword'].events({
'click .cancel': function(){
ipc.send('uiAction_closePopupWindow');
},
'submit form': function(e, template){
e.preventDefault();
var pw = template.find('input.password').value;

ipc.send('uiAction_unlockedMasterPassword', null, pw);

template.find('input.password').value = '';
pw = null;
}
});
4 changes: 4 additions & 0 deletions interface/i18n/mist.en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"passwordMismatch": "Your passwords don't match."
}
},
"unlockMasterPassword": {
"title": "Unlock master password",
"enterPassword": "Enter master password"
},
"sendTransactionConfirmation": {
"title": {
"sendTransaction": "Send transaction",
Expand Down
44 changes: 22 additions & 22 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ app.on('before-quit', function(event){
});


ethereumNodes.stopNodes();

// delay quit, so the sockets can close
setTimeout(function(){
killedSockets = true;
ethereumNodes.stopNodes();
app.quit();
}, 500);
});
Expand Down Expand Up @@ -305,37 +304,38 @@ app.on('ready', function() {
if(appStartWindow && appStartWindow.webContents)
appStartWindow.webContents.send('startScreenText', 'mist.startScreen.startingNode');

var node = ethereumNodes.startGeth();

// if we couldn't write to stdin, show binary error
node.stdin.on('error', function(e){
if(appStartWindow && appStartWindow.webContents) {
appStartWindow.webContents.send('startScreenText', 'mist.startScreen.nodeBinaryNotFound');
}
var node = ethereumNodes.startNode('geth', false, function(e){
// TRY TO CONNECT EVER 500MS
if(!e) {
intervalId = setInterval(function(){
socket.connect({path: ipcPath});
count++;

clearInterval(intervalId);
// timeout after 10 seconds
if(count >= 60) {

clearSocket(socket, appStartWindow, ipcPath, true);
});

if(appStartWindow && appStartWindow.webContents)
appStartWindow.webContents.send('startScreenText', 'mist.startScreen.nodeConnectionTimeout', ipcPath);

clearInterval(intervalId);

clearSocket(socket, appStartWindow, ipcPath, true);
}
}, 200);

// TRY TO CONNECT EVER 500MS
intervalId = setInterval(function(){
socket.connect({path: ipcPath});
count++;

// timeout after 10 seconds
if(count >= 60) {
// NO Binary
} else {

if(appStartWindow && appStartWindow.webContents)
appStartWindow.webContents.send('startScreenText', 'mist.startScreen.nodeConnectionTimeout', ipcPath);
if(appStartWindow && appStartWindow.webContents) {
appStartWindow.webContents.send('startScreenText', 'mist.startScreen.nodeBinaryNotFound');
}

clearInterval(intervalId);

clearSocket(socket, appStartWindow, ipcPath, true);
}
}, 200);
});
}
});
socket.on('connect', function(data){
Expand Down
28 changes: 12 additions & 16 deletions menuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,13 @@ var menuTempl = function(webviews) {
click: function(){
ethereumNodes.stopNodes();
setTimeout(function(){
ethereumNodes.startGeth();
ethereumNodes.startNode('geth', function(){
setTimeout(function(){
global.mainWindow.reload();
}, 200);
});
createMenu(webviews);

setTimeout(function(){
global.mainWindow.reload();
}, 200);
}, 10);
}
},
Expand All @@ -182,12 +183,13 @@ var menuTempl = function(webviews) {
click: function(){
ethereumNodes.stopNodes();
setTimeout(function(){
ethereumNodes.startEth();
ethereumNodes.startNode('eth', function(){
setTimeout(function(){
global.mainWindow.reload();
}, 200);
});
createMenu(webviews);

setTimeout(function(){
global.mainWindow.reload();
}, 200);
}, 10);
}
}
Expand All @@ -208,10 +210,7 @@ var menuTempl = function(webviews) {

// global.network = 'main';
// setTimeout(function(){
// if(geth)
// ethereumNodes.startGeth();
// else
// ethereumNodes.startEth();
// ethereumNodes.startNode(geth ? 'geth' : 'eth', false);
// createMenu(webviews);

// setTimeout(function(){
Expand All @@ -232,10 +231,7 @@ var menuTempl = function(webviews) {

// global.network = 'test';
// setTimeout(function(){
// if(geth)
// ethereumNodes.startGeth(true);
// else
// ethereumNodes.startEth(true);
// ethereumNodes.startNode(geth ? 'geth' : 'eth', true);
// createMenu(webviews);

// setTimeout(function(){
Expand Down
2 changes: 1 addition & 1 deletion modules/checkNodeSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ module.exports = function(socket, appStartWindow, callback){
cbCalled = true;
});
}
}, 1000 * 10);
}, 1000 * 12);
}

// update progress bar
Expand Down
4 changes: 2 additions & 2 deletions modules/createPopupWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
// load URL
this.loadingwindow.loadUrl(global.interfacePopupsUrl +'#loadingWindow');
},
show: function(windowType, width, height, data, e){
show: function(windowType, width, height, data, e, noWeb3){
var _this = this;

this.loadingwindow.center();
Expand All @@ -49,7 +49,7 @@ module.exports = {
show: false,
icon: global.icon,
'standard-window': false,
preload: __dirname +'/preloader/popupWindows.js',
preload: noWeb3 ? __dirname +'/preloader/popupWindowsNoWeb3.js' : __dirname +'/preloader/popupWindows.js',
'use-content-size': true,
'node-integration': false,
'web-preferences': {
Expand Down
Loading

0 comments on commit ba6000e

Please # to comment.