|
|
|
|
@ -2,19 +2,54 @@ require('update-electron-app')({
|
|
|
|
|
logger: require('electron-log')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const updateCheckInterval = 1000 * 60
|
|
|
|
|
|
|
|
|
|
const path = require('path')
|
|
|
|
|
const {app, BrowserWindow} = require('electron')
|
|
|
|
|
const {app, BrowserWindow, autoUpdater} = require('electron')
|
|
|
|
|
|
|
|
|
|
const server = 'https://update.jdsconsulting.net'
|
|
|
|
|
const url = `${server}/update/${process.platform}/${app.getVersion()}`
|
|
|
|
|
|
|
|
|
|
autoUpdater.setFeedURL({url})
|
|
|
|
|
|
|
|
|
|
autoUpdater.checkForUpdates();
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
console.log("Checking for update...");
|
|
|
|
|
autoUpdater.checkForUpdates();
|
|
|
|
|
}, updateCheckInterval)
|
|
|
|
|
|
|
|
|
|
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
|
|
|
|
console.log("Handling updates...")
|
|
|
|
|
const dialogOpts = {
|
|
|
|
|
type: 'info',
|
|
|
|
|
buttons: ['Restart', 'Later'],
|
|
|
|
|
title: 'Application Update',
|
|
|
|
|
message: process.platform === 'win32' ? releaseNotes : releaseName,
|
|
|
|
|
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
|
|
|
|
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
autoUpdater.on('error', message => {
|
|
|
|
|
console.error('There was a problem updating the application')
|
|
|
|
|
console.error(message)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const debug = /--debug/.test(process.argv[2])
|
|
|
|
|
|
|
|
|
|
if (process.mas) app.setName('JDSfaulkner Portal')
|
|
|
|
|
if (process.mas) app.setName('JDS Consulting Portal')
|
|
|
|
|
|
|
|
|
|
let mainWindow = null
|
|
|
|
|
|
|
|
|
|
function initialize () {
|
|
|
|
|
function initialize() {
|
|
|
|
|
makeSingleInstance()
|
|
|
|
|
|
|
|
|
|
function createWindow () {
|
|
|
|
|
function createWindow() {
|
|
|
|
|
const windowOptions = {
|
|
|
|
|
width: 1080,
|
|
|
|
|
minWidth: 769,
|
|
|
|
|
@ -69,7 +104,7 @@ function initialize () {
|
|
|
|
|
//
|
|
|
|
|
// Returns true if the current version of the app should quit instead of
|
|
|
|
|
// launching.
|
|
|
|
|
function makeSingleInstance () {
|
|
|
|
|
function makeSingleInstance() {
|
|
|
|
|
if (process.mas) return
|
|
|
|
|
|
|
|
|
|
app.requestSingleInstanceLock()
|
|
|
|
|
|