Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// };
// dialog.showMessageBox(dialogOpts, (response) => {
// if (response === 0) {
// autoUpdater.quitAndInstall();
// }
// });
// });
// autoUpdater.on('error', message => {
// console.error('There was a problem updating the application');
// console.error(message);
// });
log.transports.file.level = 'info';
autoUpdater.logger = log;
// autoUpdater.checkForUpdatesAndNotify();
autoUpdater.checkForUpdates();
};
const electron = require('electron');
const {app, BrowserWindow, dialog} = electron;
const path = require('path');
const url = require('url');
const settings = require('electron-settings');
const log = require('electron-log');
const {autoUpdater} = require("electron-updater");
const EA = require("electron-analytics");
const ipc = electron.ipcMain;
EA.init("Bkles-YA1-");
require('electron-debug')({showDevTools: false});
// Logging
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = "info";
// autoUpdater.autoDownload = false;
autoUpdater.allowPrerelease = false;
log.info('App Starting');
let manualupdate = false;
// 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.
require('electron-context-menu')();
let win;
function sendStatusToWindow(text) {
log.info('', text);
// win.webContents.send('message', text);
}
app.on('ready', () => {
loadConfigs();
if (isPortableConfig()) {
const logDir = path.join(configDir(), "logs");
log.transports.file.resolvePath = (variables) => path.join(logDir, variables.fileName);
}
log.transports.console.level = "warn"
log.transports.file.level = "debug"
autoUpdater.logger = log
if (maybeMoveToApplicationsFolder()) {
return
}
checkForUpdates();
// re-check for updates every 24 hours
setInterval(checkForUpdates, 86400000);
tray = new Tray(
path.join(
resourcesPath(), 'icons',
selectByOS({ mac: 'kopia-tray.png', win: 'kopia-tray.ico', linux: 'kopia-tray.png' })));
tray.setToolTip('Kopia');
ipcMain,
shell,
dialog
} = require('electron')
const path = require('path')
const url = require('url')
const Positioner = require('electron-positioner')
const tesla = require('./tesla-api')
const Store = require('electron-store')
const store = new Store()
const Poller = require('./poller')
const contextMenu = require('electron-context-menu')
const isDev = require('electron-is-dev')
// Logging
autoUpdater.logger = log
autoUpdater.logger.transports.file.level = 'info'
autoUpdater.allowPrerelease = store.get('betaReleases')
log.info('Nikola App starting...')
// Keep a global reference of the window object
let mainWindow
function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 300,
height: 450,
show: true,
frame: false,
title: 'Nikola',
fullscreenable: false,
// app - Control your application's event lifecycle
// ipcMain - Communicate asynchronously from the main process to renderer processes
const { app, BrowserWindow, TouchBar, ipcMain } = require('electron');
const path = require('path');
const url = require('url');
// This allows electron to spin up this server to localhost:7000 when the app starts up
require('./httpserver');
// Import Auto-Updater- Swell will update itself
const { autoUpdater } = require('electron-updater');
const log = require('electron-log');
// TouchBarButtons are our nav buttons(ex: Select All, Deselect All, Open Selected, Close Selected, Clear All)
const { TouchBarButton, TouchBarSpacer } = TouchBar;
// configure logging
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
log.info('App starting...');
let mainWindow;
// -----------------------------------------------------------------
// Create Touchbar buttons
// -----------------------------------------------------------------
const tbSelectAllButton = new TouchBarButton({
label: 'Select All',
backgroundColor: '#3DADC2',
click: () => {
mainWindow.webContents.send('selectAll');
},
});
const tbDeselectAllButton = new TouchBarButton({
setTimeout(() => {
// enable logging
autoUpdater.logger = require('electron-log');
autoUpdater.logger.transports.file.level = 'info';
autoUpdater.checkForUpdatesAndNotify();
}, 10000);
}
constructor(conf: DesktopConfigHandler, notifier: DesktopNotifier, fallbackPollInterval: ?number) {
this._conf = conf
this._notifier = notifier
this._errorCount = 0
if (fallbackPollInterval) {
this._fallbackPollInterval = fallbackPollInterval
}
this._logger = {
info: (m: string, ...args: any) => console.log.apply(console, ["autoUpdater info:\n", m].concat(args)),
warn: (m: string, ...args: any) => console.warn.apply(console, ["autoUpdater warn:\n", m].concat(args)),
error: (m: string, ...args: any) => console.error.apply(console, ["autoUpdater error:\n", m].concat(args)),
}
this._foundKey = defer()
autoUpdater.logger = null
autoUpdater.on('update-available', updateInfo => {
this._logger.info("update-available")
this._stopPolling()
this._foundKey.promise
.then(() => this._verifySignature(((updateInfo: any): UpdateInfo)))
.then(() => this._downloadUpdate())
}).on('update-downloaded', info => {
this._logger.info("update-downloaded")
this._stopPolling()
this._notifyAndInstall(((info: any): UpdateInfo))
}).on('checking-for-update', () => {
this._logger.info("checking-for-update")
}).on('error', e => {
const ee: any = e
this._stopPolling()
this._errorCount += 1
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 {
/**
constructor() {
log.transports.file.level = 'info';
autoUpdater.logger = log;
autoUpdater.checkForUpdatesAndNotify();
}
}
const path = require('path');
const url = require('url');
const fs = require('fs');
const fse = require('fs-extra')
const parse_path = require('parse-filepath');
const settings = require('electron-settings');
const { autoUpdater } = require('electron-updater')
const log = require('electron-log');
const application_menu = require('./lib/js/main_process/application-menu');
const ipc_main = require('./lib/js/main_process/ipc_main');
global.mainWindow = null;
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
log.info('App starting...');
app.on('ready', () => {
autoUpdater.checkForUpdatesAndNotify();
setup_application_common_setting();
setup_server_root(settings.get('app.server_root'));
setup_export_to();
setup_user_work_dir();
setup_target_markdown_path();
setup_server_url();
setup_editor_theme();
setup_editor_keybinding();
ipc_main.start_server(settings.get('server.port'));
createWindow();
const menu = Menu.buildFromTemplate(application_menu.menu_template);
Menu.setApplicationMenu(menu);