OpenAsar/src/updater/appUpdater.js

29 lines
961 B
JavaScript
Raw Normal View History

2022-01-28 20:45:04 +00:00
const updater = require('./updater');
2021-12-09 16:25:14 +00:00
2022-01-28 20:45:04 +00:00
const buildInfo = require('../utils/buildInfo');
const Constants = require('../Constants');
2021-12-09 16:25:14 +00:00
2022-01-28 20:45:04 +00:00
const { fatal, handled } = require('../errorHandler');
const splash = require('../splash');
2021-12-09 16:25:14 +00:00
2022-01-28 20:45:04 +00:00
exports.update = (startMin, done, show) => {
if (updater.tryInitUpdater(buildInfo, Constants.NEW_UPDATE_ENDPOINT)) {
const inst = updater.getUpdater();
2021-12-09 16:25:14 +00:00
inst.on('host-updated', () => require('../autoStart').update(() => {}));
inst.on('unhandled-exception', fatal);
2022-03-10 22:23:33 +00:00
inst.on('InconsistentInstallerState', fatal);
inst.on('update-error', handled);
2021-12-09 16:25:14 +00:00
require('../firstRun').performFirstRunTasks(inst);
2021-12-09 16:25:14 +00:00
} else {
require('./moduleUpdater').init(Constants.UPDATE_ENDPOINT, require('../appSettings').getSettings(), buildInfo);
2021-12-09 16:25:14 +00:00
}
splash.initSplash(startMin);
splash.events.once('APP_SHOULD_LAUNCH', done);
splash.events.once('APP_SHOULD_SHOW', show);
2022-01-28 20:45:04 +00:00
};
2021-12-09 16:25:14 +00:00
exports.focusSplash = () => splash.focusWindow();