[Updater > Module] Rewrite quitAndInstallUpdates to just use hostUpdater
This commit is contained in:
parent
3286a441ba
commit
407add2ad6
1 changed files with 2 additions and 15 deletions
|
@ -17,7 +17,7 @@ let skipHost, skipModule,
|
||||||
basePath, manifestPath, downloadPath,
|
basePath, manifestPath, downloadPath,
|
||||||
hostUpdater,
|
hostUpdater,
|
||||||
baseUrl, qs,
|
baseUrl, qs,
|
||||||
checking, hostAvail, last;
|
checking, last;
|
||||||
|
|
||||||
const resetTracking = () => {
|
const resetTracking = () => {
|
||||||
const base = {
|
const base = {
|
||||||
|
@ -60,7 +60,6 @@ exports.init = (endpoint, { releaseChannel, version }) => {
|
||||||
hostUpdater.on('update-available', () => {
|
hostUpdater.on('update-available', () => {
|
||||||
log('Modules', 'Host available');
|
log('Modules', 'Host available');
|
||||||
|
|
||||||
hostAvail = true;
|
|
||||||
events.emit('update-check-finished', {
|
events.emit('update-check-finished', {
|
||||||
succeeded: true,
|
succeeded: true,
|
||||||
updateCount: 1
|
updateCount: 1
|
||||||
|
@ -131,8 +130,6 @@ const hostPassed = (skip = skipModule) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkModules = async () => {
|
const checkModules = async () => {
|
||||||
hostAvail = false;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
remote = await new Promise((res) => request({
|
remote = await new Promise((res) => request({
|
||||||
url: baseUrl + '/versions.json',
|
url: baseUrl + '/versions.json',
|
||||||
|
@ -320,17 +317,7 @@ exports.checkForUpdates = () => {
|
||||||
else hostUpdater.checkForUpdates();
|
else hostUpdater.checkForUpdates();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.quitAndInstallUpdates = () => {
|
exports.quitAndInstallUpdates = () => hostUpdater.quitAndInstall();
|
||||||
log('Modules', 'Relaunching');
|
|
||||||
|
|
||||||
if (hostAvail) hostUpdater.quitAndInstall();
|
|
||||||
else {
|
|
||||||
const { app } = require('electron');
|
|
||||||
|
|
||||||
app.relaunch();
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const isInstalled = exports.isInstalled = (n, v) => installed[n] && !(v && installed[n].installedVersion !== v);
|
const isInstalled = exports.isInstalled = (n, v) => installed[n] && !(v && installed[n].installedVersion !== v);
|
||||||
exports.getInstalled = () => ({ ...installed });
|
exports.getInstalled = () => ({ ...installed });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue