1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-30 20:39:46 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Laurent Cozic
7b1e913651 Trying auto update 2017-11-14 10:53:18 +00:00
Laurent Cozic
e8d7050279 Trying auto update 2017-11-14 10:18:18 +00:00
4 changed files with 26 additions and 14 deletions

View File

@@ -234,11 +234,6 @@ class Application extends BaseApplication {
label: _('Documentation'),
accelerator: 'F1',
click () { bridge().openExternal('http://joplin.cozic.net') }
}, {
label: _('Check for updates'),
click () {
bridge().checkForUpdatesAndNotify()
}
}, {
label: _('About Joplin'),
click: () => {
@@ -301,6 +296,14 @@ class Application extends BaseApplication {
type: 'FOLDER_SELECT',
id: Setting.value('activeFolderId'),
});
const runAutoUpdateCheck = function() {
bridge().checkForUpdatesAndNotify(Setting.value('profileDir') + '/log-autoupdater.txt');
}
setTimeout(() => { runAutoUpdateCheck() }, 5000);
// For those who leave the app always open
setInterval(() => { runAutoUpdateCheck() }, 2 * 60 * 60 * 1000);
}
}

View File

@@ -1,6 +1,5 @@
const { _ } = require('lib/locale.js');
const autoUpdater = require("electron-updater").autoUpdater;
const { Logger } = require('lib/logger.js');
class Bridge {
@@ -68,12 +67,18 @@ class Bridge {
return require('electron').shell.openItem(fullPath)
}
checkForUpdatesAndNotify() {
autoUpdater.logger = require("electron-log")
autoUpdater.logger.info('Hello, log');
autoUpdater.logger.transports.file.level = "info"
return autoUpdater.checkForUpdatesAndNotify();
}
checkForUpdatesAndNotify(logFilePath) {
if (!this.autoUpdater_) {
const logger = new Logger();
logger.addTarget('file', { path: logFilePath });
logger.setLevel(Logger.LEVEL_DEBUG);
logger.info('checkForUpdatesAndNotify: Intializing...');
this.autoUpdater_ = require("electron-updater").autoUpdater;
this.autoUpdater_.logger = logger;
}
return this.autoUpdater_.checkForUpdatesAndNotify();
}
}

View File

@@ -6,6 +6,8 @@ require('app-module-path').addPath(__dirname);
const electronApp = require('electron').app;
const { ElectronAppWrapper } = require('./ElectronAppWrapper');
const { initBridge } = require('./bridge');
const { Logger } = require('lib/logger.js');
const { FsDriverNode } = require('lib/fs-driver-node.js');
process.on('unhandledRejection', (reason, p) => {
console.error('Unhandled promise rejection', p, 'reason:', reason);
@@ -22,6 +24,8 @@ function envFromArgs(args) {
return 'prod';
}
Logger.fsDriver_ = new FsDriverNode();
const env = envFromArgs(process.argv);
const wrapper = new ElectronAppWrapper(electronApp, env);

View File

@@ -1,6 +1,6 @@
{
"name": "Joplin",
"version": "0.10.1",
"version": "0.10.2",
"description": "Joplin for Desktop",
"main": "main.js",
"scripts": {