merging
This commit is contained in:
commit
c3be798dda
9 changed files with 198 additions and 44 deletions
|
|
@ -5,8 +5,11 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
import { protocol, autoUpdater, dialog } from "electron";
|
||||
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([
|
||||
|
|
@ -18,36 +21,20 @@ const isDev = require('electron-is-dev');
|
|||
|
||||
// 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)
|
||||
}
|
||||
Loading…
Reference in a new issue