46 lines
No EOL
1.2 KiB
TypeScript
46 lines
No EOL
1.2 KiB
TypeScript
/*
|
|
* Entry point for Crimata electron app.
|
|
* "Look on my Works, ye Mighty, and despair!"
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
import { protocol, autoUpdater, dialog } from "electron";
|
|
import { initApp } from './background/init';
|
|
|
|
// Scheme must be registered before the app is ready
|
|
protocol.registerSchemesAsPrivileged([
|
|
{ scheme: "app", privileges: { secure: true, standard: true } }
|
|
]);
|
|
|
|
// Load environment variable
|
|
const isDev = require('electron-is-dev');
|
|
|
|
// NOTE Program Begins Here
|
|
(async () => {
|
|
|
|
console.log('Starting Crimata electron app.');
|
|
initApp(isDev);
|
|
|
|
})();
|
|
|
|
// Auto app updates.
|
|
if (!isDev) {
|
|
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
|
const dialogOpts = {
|
|
type: 'info',
|
|
buttons: ['Restart', 'Later'],
|
|
title: 'Application Update',
|
|
message: 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()
|
|
})
|
|
})
|
|
|
|
setInterval(() => {
|
|
autoUpdater.checkForUpdates()
|
|
}, 5000)
|
|
} |