MCPcopy
hub / github.com/wavetermdev/waveterm / getUpdateChannel

Function getUpdateChannel

emain/updater.ts:19–36  ·  view source on GitHub ↗
(settings: SettingsType)

Source from the content-addressed store, hash-verified

17export let updater: Updater;
18
19function getUpdateChannel(settings: SettingsType): string {
20 const updaterConfigPath = path.join(process.resourcesPath!, "app-update.yml");
21 const updaterConfig = YAML.parse(readFileSync(updaterConfigPath, { encoding: "utf8" }).toString());
22 console.log("Updater config from binary:", updaterConfig);
23 const updaterChannel: string = updaterConfig.channel ?? "latest";
24 const settingsChannel = settings["autoupdate:channel"];
25 let retVal = settingsChannel;
26
27 // If the user setting doesn't exist yet, set it to the value of the updater config.
28 // If the user was previously on the `latest` channel and has downloaded a `beta` version, update their configured channel to `beta` to prevent downgrading.
29 if (!settingsChannel || (settingsChannel == "latest" && updaterChannel == "beta")) {
30 console.log("Update channel setting does not exist, setting to value from updater config.");
31 RpcApi.SetConfigCommand(ElectronWshClient, { "autoupdate:channel": updaterChannel });
32 retVal = updaterChannel;
33 }
34 console.log("Update channel:", retVal);
35 return retVal;
36}
37
38export class Updater {
39 autoCheckInterval: NodeJS.Timeout | null;

Callers 1

constructorMethod · 0.85

Calls 1

SetConfigCommandMethod · 0.65

Tested by

no test coverage detected