|
|
|
@ -5,40 +5,38 @@ require('update-electron-app')({
|
|
|
|
const updateCheckInterval = 1000 * 60
|
|
|
|
const updateCheckInterval = 1000 * 60
|
|
|
|
|
|
|
|
|
|
|
|
const path = require('path')
|
|
|
|
const path = require('path')
|
|
|
|
const {app, BrowserWindow, autoUpdater} = require('electron')
|
|
|
|
const {app, BrowserWindow} = require('electron')
|
|
|
|
|
|
|
|
|
|
|
|
const server = 'https://update.jdsconsulting.net'
|
|
|
|
const server = 'https://update.jdsconsulting.net'
|
|
|
|
const url = `${server}/update/${process.platform}/${app.getVersion()}`
|
|
|
|
const url = `${server}/update/${process.platform}/${app.getVersion()}`
|
|
|
|
|
|
|
|
|
|
|
|
autoUpdater.setFeedURL({url})
|
|
|
|
// autoUpdater.setFeedURL({url})
|
|
|
|
|
|
|
|
//
|
|
|
|
autoUpdater.checkForUpdates();
|
|
|
|
// autoUpdater.checkForUpdates();
|
|
|
|
setInterval(() => {
|
|
|
|
// setInterval(() => {
|
|
|
|
console.log("Checking for update...");
|
|
|
|
// console.log("Checking for update...");
|
|
|
|
autoUpdater.checkForUpdates();
|
|
|
|
// autoUpdater.checkForUpdates();
|
|
|
|
}, updateCheckInterval)
|
|
|
|
// }, updateCheckInterval)
|
|
|
|
|
|
|
|
//
|
|
|
|
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
|
|
|
// autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
|
|
|
console.log("Handling updates...")
|
|
|
|
// console.log("Handling updates...")
|
|
|
|
const dialogOpts = {
|
|
|
|
// const dialogOpts = {
|
|
|
|
type: 'info',
|
|
|
|
// type: 'info',
|
|
|
|
buttons: ['Restart', 'Later'],
|
|
|
|
// buttons: ['Restart', 'Later'],
|
|
|
|
title: 'Application Update',
|
|
|
|
// title: 'Application Update',
|
|
|
|
message: process.platform === 'win32' ? releaseNotes : releaseName,
|
|
|
|
// message: process.platform === 'win32' ? releaseNotes : releaseName,
|
|
|
|
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
|
|
|
|
// detail: 'A new version has been downloaded. Restart the application to apply the updates.'
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
|
|
|
// dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
|
|
|
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
|
|
|
// if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
|
|
|
|
//
|
|
|
|
autoUpdater.on('error', message => {
|
|
|
|
// autoUpdater.on('error', message => {
|
|
|
|
console.error('There was a problem updating the application')
|
|
|
|
// console.error('There was a problem updating the application')
|
|
|
|
console.error(message)
|
|
|
|
// console.error(message)
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const debug = /--debug/.test(process.argv[2])
|
|
|
|
const debug = /--debug/.test(process.argv[2])
|
|
|
|
|
|
|
|
|
|
|
|
|