Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createWindow() {
log.info('Starting');
if (template.length) {
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
if (process.env.NODE_ENV === 'production') {
log.info('Starting updater..');
autoUpdater
.checkForUpdates()
.then(() => {
log.info('Promise fulfilled');
})
.catch(reason => {
log.info(`Handle rejected promise (${reason.stack || reason}) here.`);
});
}
log.info('Creating browser window');
// Create the browser window.
// mainWindow = new BrowserWindow({ width: 800, height: 600, frame: true, titleBarStyle: 'hidden' });
mainWindow = new BrowserWindow({
width: 1000,
height: 750,
minWidth: 600,
minHeight: 450,
})
);
// Open the DevTools.
mainWindow.webContents.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
// trigger autoupdate check
autoUpdater.checkForUpdates();
}
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
})
);
}
// Open the DevTools.
if (serve) {
win.webContents.openDevTools();
}
// Standup picker only works with .deb on Linux but auto-updater
// does not work for .deb and only for AppImage and Snap
if (!isDev && !isLinux) {
autoUpdater.checkForUpdates();
}
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store window
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
function checkForUpdate() {
// Only check for update in Production
if (!isDev) {
autoUpdater.checkForUpdates();
}
}
// -const tray = require('./tray');
require('electron-debug')({enabled: true});
require('electron-dl')();
require('electron-context-menu')();
const domain = 'producthunt.com';
const {app, ipcMain} = electron;
app.setAppUserModelId('com.gauthamzz.legacy');
app.disableHardwareAcceleration();
if (!isDev) {
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
autoUpdater.checkForUpdates();
}
let mainWindow;
let isQuitting = false;
let prevMessageCount = 0;
let dockMenu;
const isAlreadyRunning = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.show();
}
});
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();
});
}
task: () => autoUpdater.checkForUpdates(),
baseDelay: this.settings.interval,
(): Promise => autoUpdater.checkForUpdates(),
3600000
ipc.on('check-for-update', function(event) {
autoUpdater.checkForUpdates();
manualupdate = true;
});