Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
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()
})
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;
}
}
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));
}
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();
}
}
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,
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,
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);
}
{
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;
}