"use strict";
- import { protocol, autoUpdater, dialog } from "electron";
-import { protocol, dialog } from "electron";
-const { autoUpdater } = require('electron-updater')
+ const log = require("electron-log")
++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([
// Load environment variable
const isDev = require('electron-is-dev');
-
-
-// setTimeout(function () {
-// autoUpdater.checkForUpdatesAndNotify()
-// }, 10000)
-
-// Check for an update every 2min.
-// setInterval(() => {
-// autoUpdater.checkForUpdatesAndNotify()
-// }, 120000)
-
// NOTE Program Begins Here
(async () => {
+ autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'seMF_apn237iUw8puG9a' }
+ autoUpdater.logger = log;
+
+ // Check for an update 10sec after Program Starts
+ setTimeout(function () {
+ autoUpdater.checkForUpdatesAndNotify()
+ }, 10000)
+
+ // Check for an update every 2min.
+ setInterval(() => {
+ autoUpdater.checkForUpdatesAndNotify()
+ }, 120000)
console.log('Starting Crimata electron app.');
initApp(isDev);
})();
-
- // Code for auto app updates.
- if (!isDev) {
-
- autoUpdater.setFeedURL({
- url: "https://gitlab.com/api/v4/projects/25637892/releases",
- headers: {"PRIVATE-TOKEN": "fSCN8xr4EgccV7z1UNaw"},
- serverType: "default"
- })
-
- autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
- 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()
- })
- })
--
- setInterval(() => {
- autoUpdater.checkForUpdates()
- }, 5000)
- }
-// 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)
-// }