mirror of https://github.com/keeweb/keeweb.git
fix #36: auto-update fix
This commit is contained in:
parent
8407c76046
commit
f1a2f2edb7
|
@ -60,7 +60,7 @@ if (window.process && window.process.versions && window.process.versions.electro
|
|||
requestExit: function() {
|
||||
var app = this.remReq('app');
|
||||
if (this.restartPending) {
|
||||
app.quitAndRestart();
|
||||
app.restartApp();
|
||||
} else {
|
||||
app.quit();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
/* jshint browser:false */
|
||||
|
||||
var app = require('app'),
|
||||
BrowserWindow = require('browser-window'),
|
||||
path = require('path'),
|
||||
BrowserWindow = require('browser-window'),
|
||||
Menu = require('menu'),
|
||||
Tray = require('tray');
|
||||
|
||||
|
@ -23,7 +23,18 @@ process.argv.forEach(function(arg) {
|
|||
});
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
app.quit();
|
||||
if (restartPending) {
|
||||
// unbind all handlers, load new app.js module and pass control to it
|
||||
app.removeAllListeners('window-all-closed');
|
||||
app.removeAllListeners('ready');
|
||||
app.removeAllListeners('open-file');
|
||||
var userDataAppFile = path.join(app.getPath('userData'), 'app.js');
|
||||
delete require.cache[require.resolve('./app.js')];
|
||||
require(userDataAppFile);
|
||||
app.emit('ready');
|
||||
} else {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
app.on('ready', function() {
|
||||
mainWindow = new BrowserWindow({
|
||||
|
@ -49,14 +60,9 @@ app.on('open-file', function(e, path) {
|
|||
openFile = path;
|
||||
notifyOpenFile();
|
||||
});
|
||||
app.on('quit', function() {
|
||||
if (restartPending) {
|
||||
require('child_process').exec(process.execPath);
|
||||
}
|
||||
});
|
||||
app.quitAndRestart = function() {
|
||||
app.restartApp = function() {
|
||||
restartPending = true;
|
||||
app.quit();
|
||||
mainWindow.close();
|
||||
setTimeout(function() { restartPending = false; }, 1000);
|
||||
};
|
||||
app.openWindow = function(opts) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "KeeWeb",
|
||||
"version": "0.4.3",
|
||||
"version": "0.4.4",
|
||||
"description": "KeePass web app",
|
||||
"main": "main.js",
|
||||
"repository": "https://github.com/antelle/keeweb",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "keeweb",
|
||||
"version": "0.4.3",
|
||||
"version": "0.4.4",
|
||||
"description": "KeePass web app",
|
||||
"main": "Gruntfile.js",
|
||||
"repository": "https://github.com/antelle/keeweb",
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
Release notes
|
||||
-------------
|
||||
##### v0.4.4 (2015-11-22)
|
||||
Auto-update restart on Windows fixed
|
||||
|
||||
##### v0.4.3 (2015-11-22)
|
||||
Windows minimize to tray bugfix
|
||||
|
||||
|
|
Loading…
Reference in New Issue