47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
/*
|
|
* Entry point for Crimata electron app.
|
|
* "Look on my Works, ye Mighty, and despair!"
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const { autoUpdater } = require('electron-updater')
|
|
|
|
import { initApp } from './background/init';
|
|
import { protocol, dialog } from "electron";
|
|
|
|
// 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 () => {
|
|
|
|
autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'seMF_apn237iUw8puG9a' }
|
|
|
|
const dialogConfig = {
|
|
type: 'info',
|
|
buttons: ['Restart', 'Later'],
|
|
title: 'Application Update',
|
|
message: releaseName,
|
|
detail: 'A new version has been downloaded. Restart to update.'
|
|
}
|
|
|
|
autoUpdater.on('update-downloaded', () => {
|
|
autoUpdater.quitAndInstall()
|
|
})
|
|
|
|
autoUpdater.checkForUpdatesAndNotify()
|
|
|
|
setInterval(() => {
|
|
autoUpdater.checkForUpdatesAndNotify()
|
|
}, 120000)
|
|
|
|
console.log('Starting Crimata electron app.');
|
|
initApp(isDev);
|
|
|
|
})();
|