How to use the electron-updater.autoUpdater.autoDownload 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 AGProjects / sylk-webrtc / app / index.js View on Github external
const openAboutWindow = require('about-window').default;

const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const dialog = electron.dialog;
const Menu = electron.Menu;
const ipc = electron.ipcMain;
const shell = electron.shell;

const { autoUpdater } = require('electron-updater')
const ProgressBar = require('electron-progressbar');
const log = require('electron-log');

let updater = null;
log.transports.file.level = 'debug';
autoUpdater.autoDownload = false;
autoUpdater.logger = log;

let progressBar;
let notification;
let updateWindow = null;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;

autoUpdater.on('error', (error) => {
    if (updater != null) {
        if (progressBar != null) {
            progressBar.close();
        }
github floating / frame / main / updater / index.js View on Github external
const windows = require('../windows')
const store = require('../store')

const dev = process.env.NODE_ENV === 'development'

const compareVersions = (a, b) => {
  if (semver.gt(a, b)) return 1
  if (semver.lt(a, b)) return -1
  return 0
}

const checkErr = (err) => log.error('Error checking latest version:', err)
const options = { host: 'api.github.com', path: '/repos/floating/frame/releases', headers: { 'User-Agent': 'request' } }

// autoUpdater.allowPrerelease = true
autoUpdater.autoDownload = false

autoUpdater.on('error', err => {
  // TODO: Error Notification
  log.error(' > Auto Update Error: ' + err.message)
  updater.checkManualUpdate()
})

autoUpdater.on('update-available', (r) => { //  Ask if they want to download it
  log.info(' > autoUpdated found that an update is available...')
  updater.updateAvailable(r.version, 'auto')
})

autoUpdater.on('update-not-available', () => {
  log.info(' > autoUpdate found no updates, check manually')
  updater.checkManualUpdate()
})
github fttx / barcode-to-pc-server / electron / src / handlers / update.handler.ts View on Github external
doUpdate() {
        if (this.autoUpdate) {
            autoUpdater.autoDownload = true;
            autoUpdater.autoInstallOnAppQuit = true;
            autoUpdater.checkForUpdates().then(result => {
                console.log('Autoupdater:', result)
            });
        } else {
            autoUpdater.autoDownload = false;
            autoUpdater.autoInstallOnAppQuit = false;
        }
    }
github FantasticFiasco / searchlight / src / main / application-updates / updaters / mac-os-updater.ts View on Github external
public start() {
        expect.toBeTrue(this.state === State.Idle, 'Cannot start unless state is Idle');

        log.info('MacOSUpdater', 'start');

        autoUpdater.autoDownload = false;
        autoUpdater.logger = null;

        autoUpdater.on('checking-for-update', () => this.onCheckingForUpdates());
        autoUpdater.on('update-available', async (version: UpdateInfo) => await this.onUpdateAvailable(version));
        autoUpdater.on('update-not-available', (version: UpdateInfo) => this.onUpdateNotAvailable(version));
        autoUpdater.on('error', (error: Error) => this.onError(error));
    }
github szymonkaliski / Neutron / src / auto-updater.js View on Github external
const { autoUpdater } = require('electron-updater');
const { dialog } = require('electron');

autoUpdater.allowPrerelease = true;
autoUpdater.autoDownload = true;

module.exports = () => {
  autoUpdater.on('update-downloaded', () => {
    dialog.showMessageBox(
      {
        type: 'question',
        buttons: ['Install and Relaunch', 'Later'],
        defaultId: 0,
        message: 'A new version of Neutron has been downloaded',
        detail: 'It will be installed the next time you restart the application'
      },
      response => {
        if (response === 0) {
          autoUpdater.quitAndInstall();
        }
      }
github web-pal / chronos-timetracker / app / main / sagas / updater.js View on Github external
call,
  put,
  take,
  takeEvery,
  fork,
} from 'redux-saga/effects';
import {
  eventChannel,
} from 'redux-saga';

import {
  actionTypes,
} from 'shared/actions';
import pjson from '../../package.json';

autoUpdater.autoDownload = false;
autoUpdater.currentVersion = pjson.version;

if (process.env.NODE_ENV === 'development') {
  autoUpdater.updateConfigPath = path.join(process.cwd(), 'dev-app-update.yml');
  autoUpdater.allowDowngrade = true;
}

function* setRendererUiState(
  keyOrRootValues,
  maybeValues,
) {
  yield put({
    type: actionTypes.SET_UI_STATE,
    payload: {
      keyOrRootValues,
      maybeValues,
github MD-AZMAL / Sharp-Tune / main.js View on Github external
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const Menu = electron.Menu;
const dialog = electron.dialog;
const ipc = electron.ipcMain;
const nativeImage = electron.nativeImage;

const path = require('path');
const url = require('url');
const fs = require('fs');
const { autoUpdater } = require('electron-updater');
const isDev = require('electron-is-dev');

autoUpdater.logger = require('electron-log');
autoUpdater.autoDownload = false;
autoUpdater.logger.transports.file.level = 'info';

let MainWin, AboutWin;
let ico = nativeImage.createFromPath(path.join(__dirname, 'logo.png'));
let usr_apd = false;

function createMainWindow() {
    if (!isDev) {
        autoUpdater.checkForUpdates();

    }

    MainWin = new BrowserWindow({
        show: false,
        center: true,
        width: 900,
github bep713 / madden-franchise-editor / main.js View on Github external
if (isDev) {
    workerWindow.webContents.openDevTools();
  }

  workerWindow.on('closed', () => {
    workerWindow = null;
  });

  workerWindow.webContents.on('did-finish-load', function () {
    workerReady = true;
    sendAllPendingWorkerEvents();
  });

  preferencesService.initialize();
  autoUpdater.autoInstallOnAppQuit = false;
  autoUpdater.autoDownload = false;

  createSchemaWindow(false);
  createSettingsWindow(false);
}
github luminati-io / luminati-proxy / bin / lum_electron.js View on Github external
{
        let res = yield show_message({type: 'info', title: 'Luminati update',
            message: (ver ? `Luminati version ${ver}` : 'Luminati update')
            +' will be installed on exit',
            buttons: ['Install on exit', 'Install now']});
        if (!res)
            return void logger.notice('Update postponed until exit');
    }
    logger.notice('Starting upgrade');
    is_upgrading = true;
    zerr.perr('upgrade_start');
    auto_updater.quitAndInstall();
});

auto_updater.allowDowngrade = true;
auto_updater.autoDownload = false;
auto_updater.on('error', e=>zerr.perr('upgrade_error', {error: e}));
auto_updater.on('before-quit', ()=>{
    if (is_upgrading)
        zerr.perr('upgrade_finish');
});

auto_updater.on('update-available', e=>etask(function*(){
    if (semver.lt(e.version, pkg.version))
    {
        if (!config.is_lum)
        {
            zerr.perr('upgrade_invalid_version',
                {upgrade_v: e.version, current_v: pkg.version});
        }
        return;
    }