mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix auto-update channel checking and pinning (#4030)
This commit is contained in:
1 parent
743e7f2b36
commit
3988229a6c
5 files changed
+33
-31
No files matched your search
@@ -23,9 +23,10 @@ import moment from "moment-timezone";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import { ThemeStore } from "../../renderer/theme.store";
|
||||
import { ObservableToggleSet } from "../utils";
|
||||
import { getAppVersion, ObservableToggleSet } from "../utils";
|
||||
import type {monaco} from "react-monaco-editor";
|
||||
import merge from "lodash/merge";
|
||||
import { SemVer } from "semver";
|
||||
|
||||
export interface KubeconfigSyncEntry extends KubeconfigSyncValue {
|
||||
filePath: string;
|
||||
@@ -260,9 +261,8 @@ const editorConfiguration: PreferenceDescription<EditorConfiguration, EditorConf
|
||||
},
|
||||
};
|
||||
|
||||
const defaultUpdateChannel = "latest";
|
||||
const updateChannels = new Map([
|
||||
[defaultUpdateChannel, {
|
||||
["latest", {
|
||||
label: "Stable"
|
||||
}],
|
||||
["beta", {
|
||||
@@ -272,6 +272,7 @@ const updateChannels = new Map([
|
||||
label: "Alpha"
|
||||
}],
|
||||
]);
|
||||
const defaultUpdateChannel = new SemVer(getAppVersion()).prerelease[0]?.toString() || "latest";
|
||||
|
||||
const updateChannel: PreferenceDescription<string> = {
|
||||
fromStore(val) {
|
||||
@@ -318,6 +319,5 @@ export const DESCRIPTORS = {
|
||||
};
|
||||
|
||||
export const CONSTANTS = {
|
||||
defaultUpdateChannel,
|
||||
updateChannels,
|
||||
};
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import { app, ipcMain } from "electron";
|
||||
import semver from "semver";
|
||||
import semver, { SemVer } from "semver";
|
||||
import { action, computed, observable, reaction, makeObservable } from "mobx";
|
||||
import { BaseStore } from "../base-store";
|
||||
import migrations from "../../migrations/user-store";
|
||||
@@ -30,7 +30,7 @@ import { appEventBus } from "../event-bus";
|
||||
import path from "path";
|
||||
import { fileNameMigration } from "../../migrations/user-store";
|
||||
import { ObservableToggleSet, toJS } from "../../renderer/utils";
|
||||
import { DESCRIPTORS, KubeconfigSyncValue, UserPreferencesModel, EditorConfiguration, CONSTANTS } from "./preferences-helpers";
|
||||
import { DESCRIPTORS, KubeconfigSyncValue, UserPreferencesModel, EditorConfiguration } from "./preferences-helpers";
|
||||
import logger from "../../main/logger";
|
||||
import type { monaco } from "react-monaco-editor";
|
||||
import { getPath } from "../utils/getPath";
|
||||
@@ -107,9 +107,7 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
|
||||
return this.shell || process.env.SHELL || process.env.PTYSHELL;
|
||||
}
|
||||
|
||||
@computed get isAllowedToDowngrade(): boolean {
|
||||
return this.updateChannel !== CONSTANTS.defaultUpdateChannel;
|
||||
}
|
||||
readonly isAllowedToDowngrade = new SemVer(getAppVersion()).prerelease[0] !== "latest";
|
||||
|
||||
startMainReactions() {
|
||||
// track telemetry availability
|
||||
|
||||
Reference in new issue
Block a user