How to use the electron-updater.autoUpdater.channel function in electron-updater

To help you get started, we’ve selected a few electron-updater examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mihirpathak97 / audius / src / modules / AutoUpdater.js View on Github external
/**
 * Auto Updater
 *
 * New releases will be published @ https://github.com/mihirpathak97/audius/releases
 * and will be automatically downloaded and will be installed
 */

const {autoUpdater} = require("electron-updater");
var log = require('electron-log');
/**
 * Update Channel
 * supported channels are 'alpha', 'beta' and 'latest'
 * Refer electron-builder docs
 */
log.info('[AutoUpdater.js] Checking for updates');
autoUpdater.channel = 'latest';
autoUpdater.checkForUpdatesAndNotify();

// Done in two lines :)
github cern-phone-apps / desktop-phone-app / public / updater.js View on Github external
storage.get('update_channel', (error, data) => {
    const channel = data.channel || 'latest';
    if (channel === 'latest') {
      autoUpdater.allowPrerelease = false;
    } else {
      autoUpdater.allowPrerelease = true;
    }
    console.log(`Setting allowPrerelease to ${autoUpdater.allowPrerelease}`);

    if (error) {
      console.log(`Error found checking updates: ${error}`);
    }
    console.log(`Auto Updater is set to ${autoUpdater.channel}`);
    console.log(`Current version of the app is ${autoUpdater.currentVersion}`);
    autoUpdater.checkForUpdates();
  });
}
github advanced-rest-client / arc-electron / scripts / main / update-status.js View on Github external
start(settings) {
    log.info('Initializing Auto Updater.');
    if (settings.releaseChannel) {
      if (this.isValidChannel(settings.releaseChannel)) {
        log.info('Setting auto updater channel to ' + settings.releaseChannel);
        autoUpdater.channel = settings.releaseChannel;
      }
    }
    if (settings.autoUpdate === false) {
      log.debug('Auto Updater is disabled. Manual requests will still download the update.');
      autoUpdater.autoDownload = false;
      return;
    }
    setTimeout(() => {
      this.check();
    }, 5000);
  }
  /**
github LN-Zap / zap-desktop / app / lib / zap / updater.js View on Github external
import { dialog } from 'electron'
import { autoUpdater } from 'electron-updater'
import isDev from 'electron-is-dev'
import { updaterLog } from '../utils/log'

autoUpdater.logger = updaterLog

/**
 * Update Channel
 * supported channels are 'alpha', 'beta' and 'latest'
 * Refer electron-builder docs
 */
autoUpdater.channel = process.env.AUTOUPDATE_CHANNEL || 'beta'
autoUpdater.allowDowngrade = false

/**
 * @class ZapController
 *
 * The ZapUpdater class manages the electron auto update process.
 */
class ZapUpdater {
  /**
   * Create a new ZapUpdater instance.
   * @param  {BrowserWindow} mainWindow BrowserWindow instance to interact with
   */
  constructor(mainWindow) {
    this.mainWindow = mainWindow
  }
github sakazuki / node-red-desktop / src / main / auto-update.ts View on Github external
public async checkUpdates(showDialog = true) {
    autoUpdater.autoDownload = this.status.autoDownload;
    autoUpdater.allowPrerelease = this.status.allowPrerelease;
    if (process.env.UPDATE_CHANNEL)
      autoUpdater.channel = process.env.UPDATE_CHANNEL;
    try {
      const result = await autoUpdater.checkForUpdatesAndNotify();
      this.updateInfo = result ? result.updateInfo : null;
      if (result && semver.lt(app.getVersion(), result.updateInfo.version)) {
        log.info("update available", result.updateInfo.version);
        await this.onUpdateFound(result);
      } else {
        log.info(
          "update not available",
          result ? result.updateInfo.version : "-"
        );
        if (showDialog) await this.onNoUpdate();
      }
    } catch (err) {
      log.error(err);
    }
github LN-Zap / zap-desktop / electron / updater.js View on Github external
configure(settings) {
    Object.assign(this.settings, settings)

    autoUpdater.channel = this.settings.channel
    autoUpdater.allowDowngrade = false
  }
github dangeredwolf / ModernDeck / main.js View on Github external
protocol.registerFileProtocol("moderndeck", mtdSchemeHandler);

	isRestarting = false;

	let useFrame = store.get("mtd_nativetitlebar") || disableCss || process.platform === "darwin";
	let titleBarStyle = "hidden";

	if (store.get("mtd_nativetitlebar") && process.platform === "darwin") {
		titleBarStyle = "default";
	}

	if (store.has("mtd_updatechannel")) {
		if (store.get("mtd_updatechannel") === "beta") {
			autoUpdater.allowPrerelease = true;
		}
		autoUpdater.channel = store.get("mtd_updatechannel");
	}

	let bounds = store.get("mtd_windowBounds") || {};
	let useXY = !!bounds.x && !!bounds.y

	mainWindow = new BrowserWindow({
		width: bounds.width || 975,
		height: bounds.height || 650,
		x: useXY ? bounds.x : undefined,
		y: useXY ? bounds.y : undefined,
		webPreferences: {
			defaultFontFamily:"Roboto",
			nodeIntegration: true,
			contextIsolation: false,
			webgl: false,
			plugins: false,
github Opentrons / opentrons / app-shell / src / update.js View on Github external
function checkUpdate(dispatch: Dispatch) {
  const onAvailable = (info: UpdateInfo) => done({ info, available: true })
  const onNotAvailable = (info: UpdateInfo) => done({ info, available: false })
  const onError = (error: Error) => done({ error: PlainObjectError(error) })

  updater.once('update-available', onAvailable)
  updater.once('update-not-available', onNotAvailable)
  updater.once('error', onError)

  updater.channel = getConfig('update.channel')
  updater.checkForUpdates()

  function done(payload: *) {
    updater.removeListener('update-available', onAvailable)
    updater.removeListener('update-not-available', onNotAvailable)
    updater.removeListener('error', onError)
    dispatch({ type: 'shell:CHECK_UPDATE_RESULT', payload })
  }
}