updater can only run on certain installations
This commit is contained in:
parent
e3c5e3e706
commit
7d25b1462c
|
@ -10,6 +10,9 @@ import { Main } from '../main';
|
||||||
import {
|
import {
|
||||||
isAppImage,
|
isAppImage,
|
||||||
isDev,
|
isDev,
|
||||||
|
isMacAppStore,
|
||||||
|
isWindowsPortable,
|
||||||
|
isWindowsStore,
|
||||||
} from '../scripts/utils';
|
} from '../scripts/utils';
|
||||||
|
|
||||||
const UpdaterCheckInitalDelay = 5 * 1000; // 5 seconds
|
const UpdaterCheckInitalDelay = 5 * 1000; // 5 seconds
|
||||||
|
@ -18,8 +21,14 @@ const UpdaterCheckInterval = 12 * 60 * 60 * 1000; // 12 hours
|
||||||
export class UpdaterMain {
|
export class UpdaterMain {
|
||||||
private doingUpdateCheck = false;
|
private doingUpdateCheck = false;
|
||||||
private doingUpdateCheckWithFeedback = false;
|
private doingUpdateCheckWithFeedback = false;
|
||||||
|
private canUpdate = false;
|
||||||
|
|
||||||
constructor(private main: Main) { }
|
constructor(private main: Main) {
|
||||||
|
const linuxCanUpdate = process.platform === 'linux' && isAppImage();
|
||||||
|
const windowsCanUpdate = process.platform === 'win32' && !isWindowsStore() && !isWindowsPortable();
|
||||||
|
const macCanUpdate = process.platform === 'darwin' && !isMacAppStore();
|
||||||
|
this.canUpdate = linuxCanUpdate || windowsCanUpdate || macCanUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
global.setTimeout(async () => await this.checkForUpdate(), UpdaterCheckInitalDelay);
|
global.setTimeout(async () => await this.checkForUpdate(), UpdaterCheckInitalDelay);
|
||||||
|
@ -107,8 +116,7 @@ export class UpdaterMain {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'linux' && !isAppImage()) {
|
if (!this.canUpdate) {
|
||||||
// Only AppImage packages support auto-update on linux
|
|
||||||
if (withFeedback) {
|
if (withFeedback) {
|
||||||
shell.openExternal('https://github.com/bitwarden/desktop/releases');
|
shell.openExternal('https://github.com/bitwarden/desktop/releases');
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,17 @@ export function isDev() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAppImage() {
|
export function isAppImage() {
|
||||||
return 'APPIMAGE' in process.env;
|
return process.platform === 'linux' && 'APPIMAGE' in process.env;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isMacAppStore() {
|
||||||
|
return process.platform === 'darwin' && process.mas && process.mas === true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isWindowsStore() {
|
||||||
|
return process.platform === 'win32' && process.windowsStore && process.windowsStore === true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isWindowsPortable() {
|
||||||
|
return process.platform === 'win32' && process.env.PORTABLE_EXECUTABLE_DIR != null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue