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

Commit

Permalink
Merge branch 'develop' of github.com:ethereum/mist into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Dec 14, 2016
2 parents ac58bf7 + 5cb26b4 commit 8a4c31c
Show file tree
Hide file tree
Showing 19 changed files with 423 additions and 371 deletions.
24 changes: 15 additions & 9 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ settings:
import/core-modules: ## don't lint for these missing packages in package.json
- electron ## 'electron' is only needed as devDependency / global installation


rules:
# "off" or 0 - turn the rule off
# "warn" or 1 - turn the rule on as a warning (doesn’t affect exit code)
# "error" or 2 - turn the rule on as an error (exit code is 1 when triggered)
indent:
- 2 ## error
- error
- 4 ## number of spaces
no-console: 0 ## allowed for chrome dev-console
no-console: off ## allowed for chrome dev-console
padded-blocks: off
arrow-body-style: off
prefer-arrow-callback: off
no-underscore-dangle: off
comma-dangle:
- error
- only-multiline

globals:
i18n: true # don't warn about missing 'i18n' declaration
Helpers: true # don't warn about missing 'Helpers' declaration
globals: # don't warn about missing declarations
i18n: true
mist: true
describe: true
it: true
expect: true
chai: true
beforeEach: true
LocalStore: true
web3: true
Expand Down
8 changes: 4 additions & 4 deletions interface/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rules:
- allow: ['_id', '_escape', '__']

globals:
Blaze: true
EthAccounts: true
_: true
mist: true
Helpers: true
Blaze: true
EthAccounts: true
mist: true
4 changes: 1 addition & 3 deletions interface/client/mistAPIBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ mistAPIBackend = function (event) {
// console.trace('mistAPIBackend event', event);

if (event.channel === 'setWebviewId') {
Tabs.update(template.data._id, { $set: {
webviewId: webview.getId(),
} });
Tabs.update(template.data._id, { $set: { webviewId: webview.getWebContents().id }});
}

// Send TEST DATA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ Template['popupWindows_sendTransactionConfirmation'].onCreated(function(){
});

Template['popupWindows_sendTransactionConfirmation'].onRendered(function(){
this.$('input[type="password"]').focus();
var template = this;

Meteor.setTimeout(function(){
template.$('input[type="password"]').focus();
}, 200);
});

Template['popupWindows_sendTransactionConfirmation'].helpers({
Expand Down
5 changes: 5 additions & 0 deletions interface/client/templates/webviewEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ webviewChangeUrl = function(tabId, e){

console.log(e.type, tabId, url);

if(e.type === 'did-navigate') {
// destroy socket when navigating away
ipc.send('ipcProvider-destroy', this.getWebContents().id);
}

// make sure to not store error pages in history
if(!url || url.indexOf('mist/errorPages/') !== -1)
return;
Expand Down
189 changes: 98 additions & 91 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const timesync = require('os-timesync');
const dbSync = require('./modules/dbSync.js');
const i18n = require('./modules/i18n.js');
const logger = require('./modules/utils/logger');
const Sockets = require('./modules/sockets');
const Sockets = require('./modules/socketManager');
const Windows = require('./modules/windows');
const ClientBinaryManager = require('./modules/clientBinaryManager');
const UpdateChecker = require('./modules/updateChecker');
Expand Down Expand Up @@ -150,6 +150,8 @@ app.on('before-quit', (event) => {

let mainWindow;
let splashWindow;
let onReady;
let startMainWindow;

// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
Expand All @@ -173,7 +175,7 @@ Only do this if you have secured your HTTP connection or you know what you are d
});


let onReady = () => {
onReady = () => {
// setup DB sync to backend
dbSync.backendSyncInit();

Expand Down Expand Up @@ -202,7 +204,8 @@ let onReady = () => {
width: 1024 + 208,
height: 720,
webPreferences: {
nodeIntegration: true, // necessary for webviews; require will be removed through preloader
nodeIntegration: true, /* necessary for webviews;
require will be removed through preloader */
preload: `${__dirname}/modules/preloader/mistUI.js`,
'overlay-fullscreen-video': true,
'overlay-scrollbars': true,
Expand Down Expand Up @@ -278,7 +281,7 @@ let onReady = () => {
});

ethereumNode.on('nodeLog', (data) => {
Windows.broadcast('uiAction_nodeLogText', data.replace(/^.*[0-9]\]/, ''));
Windows.broadcast('uiAction_nodeLogText', data.replace(/^.*[0-9]]/, ''));
});

// state change
Expand Down Expand Up @@ -331,95 +334,99 @@ let onReady = () => {
throw new Error('Cant start client due to legacy non-Fork setting.');
}
})
.then(() => {
return ClientBinaryManager.init();
})
.then(() => {
return ethereumNode.init();
})
.then(function sanityCheck() {
if (!ethereumNode.isIpcConnected) {
throw new Error('Either the node didn\'t start or IPC socket failed to connect.');
}
.then(() => {
return ClientBinaryManager.init();
})
.then(() => {
return ethereumNode.init();
})
.then(function sanityCheck() {
if (!ethereumNode.isIpcConnected) {
throw new Error('Either the node didn\'t start or IPC socket failed to connect.');
}

/* At this point Geth is running and the socket is connected. */
log.info('Connected via IPC to node.');
/* At this point Geth is running and the socket is connected. */
log.info('Connected via IPC to node.');

// update menu, to show node switching possibilities
appMenu();
})
.then(function getAccounts() {
return ethereumNode.send('eth_accounts', []);
})
.then(function onboarding(resultData) {
if (ethereumNode.isGeth && resultData.result && resultData.result.length === 0) {
log.info('No accounts setup yet, lets do onboarding first.');

return new Q((resolve, reject) => {
const onboardingWindow = Windows.createPopup('onboardingScreen', {
primary: true,
electronOptions: {
width: 576,
height: 442,
},
});

onboardingWindow.on('closed', () => {
app.quit();
});

// change network types (mainnet, testnet)
ipcMain.on('onBoarding_changeNet', (e, testnet) => {
const newType = ethereumNode.type;
const newNetwork = testnet ? 'test' : 'main';

log.debug('Onboarding change network', newNetwork);

ethereumNode.restart(newType, newNetwork)
.then(function nodeRestarted() {
appMenu();
})
.catch((err) => {
log.error('Error restarting node', err);

reject(err);
});
});

// launch app
ipcMain.on('onBoarding_launchApp', (e) => {
// prevent that it closes the app
onboardingWindow.removeAllListeners('closed');
onboardingWindow.close();

ipcMain.removeAllListeners('onBoarding_changeNet');
ipcMain.removeAllListeners('onBoarding_launchApp');

resolve();
});

if (splashWindow) {
splashWindow.hide();
}
// update menu, to show node switching possibilities
appMenu();
})
.then(function getAccounts() {
return ethereumNode.send('eth_accounts', []);
})
.then(function onboarding(resultData) {
if (ethereumNode.isGeth && resultData.result && resultData.result.length === 0) {
log.info('No accounts setup yet, lets do onboarding first.');

return new Q((resolve, reject) => {
const onboardingWindow = Windows.createPopup('onboardingScreen', {
primary: true,
electronOptions: {
width: 576,
height: 442,
},
});
}
})
.then(function doSync() {
// we're going to do the sync - so show splash
if (splashWindow) {
splashWindow.show();
}

if (!Settings.inAutoTestMode) {
return syncResultPromise;
}
})
.then(function allDone() {
startMainWindow();
})
.catch((err) => {
log.error('Error starting up node and/or syncing', err);
}); /* socket connected to geth */

onboardingWindow.on('closed', () => {
app.quit();
});

// change network types (mainnet, testnet)
ipcMain.on('onBoarding_changeNet', (e, testnet) => {
const newType = ethereumNode.type;
const newNetwork = testnet ? 'test' : 'main';

log.debug('Onboarding change network', newNetwork);

ethereumNode.restart(newType, newNetwork)
.then(function nodeRestarted() {
appMenu();
})
.catch((err) => {
log.error('Error restarting node', err);

reject(err);
});
});

// launch app
ipcMain.on('onBoarding_launchApp', () => {
// prevent that it closes the app
onboardingWindow.removeAllListeners('closed');
onboardingWindow.close();

ipcMain.removeAllListeners('onBoarding_changeNet');
ipcMain.removeAllListeners('onBoarding_launchApp');

resolve();
});

if (splashWindow) {
splashWindow.hide();
}
});
}

return Q.cancel();
})
.then(function doSync() {
// we're going to do the sync - so show splash
if (splashWindow) {
splashWindow.show();
}

if (Settings.inAutoTestMode) {
return Q.cancel();
}

return syncResultPromise;
})
.then(function allDone() {
startMainWindow();
})
.catch((err) => {
log.error('Error starting up node and/or syncing', err);
}); /* socket connected to geth */
}; /* kick start */

if (splashWindow) {
Expand All @@ -435,7 +442,7 @@ Start the main window and all its processes
@method startMainWindow
*/
let startMainWindow = () => {
startMainWindow = () => {
log.info(`Loading Interface at ${global.interfaceAppUrl}`);

mainWindow.on('ready', () => {
Expand Down
2 changes: 1 addition & 1 deletion modules/ethereumNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Settings = require('./settings');
const log = require('./utils/logger').create('EthereumNode');
const logRotate = require('log-rotate');
const EventEmitter = require('events').EventEmitter;
const Sockets = require('./sockets');
const Sockets = require('./socketManager');
const ClientBinaryManager = require('./clientBinaryManager');

const DEFAULT_NODE_TYPE = 'geth';
Expand Down
Loading

0 comments on commit 8a4c31c

Please sign in to comment.