mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Trying auto update
This commit is contained in:
parent
e8d7050279
commit
7b1e913651
@ -297,9 +297,13 @@ class Application extends BaseApplication {
|
||||
id: Setting.value('activeFolderId'),
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
bridge().checkForUpdatesAndNotify(reg.logger());
|
||||
}, 5000);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { Logger } = require('lib/logger.js');
|
||||
|
||||
class Bridge {
|
||||
|
||||
@ -66,11 +67,17 @@ class Bridge {
|
||||
return require('electron').shell.openItem(fullPath)
|
||||
}
|
||||
|
||||
checkForUpdatesAndNotify(logger) {
|
||||
const autoUpdater = require("electron-updater").autoUpdater;
|
||||
logger.info('Doing autoupdate checkForUpdatesAndNotify...');
|
||||
autoUpdater.logger = logger;
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user