1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Only offer app version downgrade if updateChannel differs from current version (#4212)

This commit is contained in:
Sebastian Malton 2021-11-02 12:07:50 -04:00 committed by GitHub
parent dec043f3f2
commit 7ba359be03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -107,7 +107,9 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
return this.shell || process.env.SHELL || process.env.PTYSHELL;
}
readonly isAllowedToDowngrade = new SemVer(getAppVersion()).prerelease[0] !== "latest";
@computed get isAllowedToDowngrade() {
return new SemVer(getAppVersion()).prerelease[0] !== this.updateChannel;
}
startMainReactions() {
// track telemetry availability

View File

@ -131,9 +131,13 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24
});
export async function checkForUpdates(): Promise<void> {
const userStore = UserStore.getInstance();
try {
logger.info(`📡 Checking for app updates`);
autoUpdater.channel = userStore.updateChannel;
autoUpdater.allowDowngrade = userStore.isAllowedToDowngrade;
await autoUpdater.checkForUpdates();
} catch (error) {
logger.error(`${AutoUpdateLogPrefix}: failed with an error`, { error: String(error) });