Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// As of Electron 3 or 4, setting checked property (even to false) of multiple items in radio group results in
// the first one always being checked, so we have to set it just on the one where checked should == true
const checkedItemIndex = (trayManager.clickShortcut === 'double-click') ? 0 : 1;
trayClickShortcutMenuItem.submenu.items[checkedItemIndex].checked = true;
}
notificationSoundEnabledMenuItem.checked = notificationSoundEnabled;
pressEnterToSendMenuItem.checked = pressEnterToSendEnabled;
hideNotificationContentMenuItem.checked = hideNotificationContent;
useSystemDarkModeMenuItem.checked = useSystemDarkMode;
state.notificationSoundEnabled = notificationSoundEnabled;
state.notificationContentHidden = hideNotificationContent;
state.useSystemDarkMode = useSystemDarkMode;
autoUpdater.checkForUpdatesAndNotify();
const mainWindowOptions = {
width: 1100,
height: 800,
autoHideMenuBar: autoHideMenuBar,
show: !(startInTray), //Starts in tray if set
titleBarStyle: IS_MAC ? 'hiddenInset' : 'default', //Turn on hidden frame on a Mac
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
webviewTag: true
}
};
if (IS_LINUX) {
// Setting the icon in Linux tends to be finicky without explicitly setting it like this.
constructor(options) {
const { autoUpdater } = require('electron-updater')
// const autoUpdater = new AppUpdater({
// autoInstallOnAppQuit: false,
// autoDownload: false,
// // logger:
// })
autoUpdater.quitAndInstallCalled = false
// autoUpdater.autoDownload = false
if (options.logger) {
autoUpdater.logger = options.logger
// autoUpdater.logger.transports.file.level = 'info'
}
autoUpdater.checkForUpdatesAndNotify()
return autoUpdater
}
}
async function initialize()
{
autoUpdater.checkForUpdatesAndNotify();
await init();
projects_window.show();
}
const createWindow = () => {
log.transports.file.level = 'debug';
autoUpdater.logger = log;
autoUpdater.checkForUpdatesAndNotify();
if (isDev) {
helpers.setBadge('DEV');
setTimeout(() => helpers.setBadge(app.getVersion()), 8000);
helpers.installDevToolsExtentions();
} else {
helpers.setBadge(app.getVersion());
setTimeout(() => helpers.setBadge(''), 8000);
}
const backgroundColor = settings.get('color', '#3F84A8');
splashWindow = new BrowserWindow({
width: 484,
height: 272,
backgroundColor,
app.on("ready", function() {
autoUpdater.checkForUpdatesAndNotify();
});
setTimeout(() => {
autoUpdater.checkForUpdatesAndNotify()
}, 500)
}
constructor() {
log.transports.file.level = 'info';
autoUpdater.logger = log;
autoUpdater.checkForUpdatesAndNotify();
}
}
mainWindow.on('ready-to-show', () => {
splash.destroy();
mainWindow.show();
logger.info(autoUpdater.checkForUpdatesAndNotify());
logger.info('checkForUpdatesAndNotify');
});
mainWindow.on('focus', () => {
const electron = require('electron');
const { app, BrowserWindow, ipcMain, Tray, Menu } = electron;
const path = require('path');
const url = require('url');
const positioner = require('electron-traywindow-positioner');
var EventSource = require('eventsource');
const { hotelUrl } = require('./hotel-config');
const { autoUpdater } = require("electron-updater")
autoUpdater.checkForUpdatesAndNotify();
const assetsDirectory = path.join(__dirname, './assets');
const output = new EventSource(`${hotelUrl}/_/events/output`);
output.addEventListener('message', event => {
logsWindow.webContents.send('output', JSON.parse(event.data));
window.webContents.send('output', JSON.parse(event.data));
});
const events = new EventSource(`${hotelUrl}/_/events`);
events.addEventListener('message', event => {
logsWindow.webContents.send('events', JSON.parse(event.data));
window.webContents.send('events', JSON.parse(event.data));
});
let tray;
constructor() {
log.transports.file.level = 'info';
autoUpdater.logger = log;
autoUpdater.checkForUpdatesAndNotify();
}
}