From: Andrew Gundersen Date: Tue, 13 Apr 2021 14:35:03 +0000 (-0500) Subject: merging X-Git-Tag: v0.9.1~1 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=c3be798dda16bd62f4397db1c2ca0438ff3ade27;p=mime-chat merging --- c3be798dda16bd62f4397db1c2ca0438ff3ade27 diff --cc src/background.ts index 654c673,abb1961..be71771 --- a/src/background.ts +++ b/src/background.ts @@@ -5,8 -5,10 +5,11 @@@ "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([ @@@ -16,38 -18,55 +19,22 @@@ // 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) -// }