Updater debug utility

This commit is contained in:
Fedor Indutny 2021-06-30 14:27:18 -07:00 committed by GitHub
parent e7e9021e3f
commit 759ced3417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 409 additions and 15 deletions

View file

@ -4,6 +4,7 @@
import { get as getFromConfig } from 'config';
import { BrowserWindow } from 'electron';
import { UpdaterInterface } from './common';
import { start as startMacOS } from './macos';
import { start as startWindows } from './windows';
import { LocaleType } from '../types/I18N';
@ -11,6 +12,8 @@ import { LoggerType } from '../types/Logging';
let initialized = false;
let updater: UpdaterInterface | undefined;
export async function start(
getMainWindow: () => BrowserWindow,
locale?: LocaleType,
@ -39,14 +42,24 @@ export async function start(
}
if (platform === 'win32') {
await startWindows(getMainWindow, locale, logger);
updater = await startWindows(getMainWindow, locale, logger);
} else if (platform === 'darwin') {
await startMacOS(getMainWindow, locale, logger);
updater = await startMacOS(getMainWindow, locale, logger);
} else {
throw new Error('updater/start: Unsupported platform');
}
}
export async function force(): Promise<void> {
if (!initialized) {
throw new Error("updater/force: Updates haven't been initialized!");
}
if (updater) {
await updater.force();
}
}
function autoUpdateDisabled() {
return (
process.platform === 'linux' ||