{
"name": "Crimata",
- "version": "0.9.5",
+ "version": "0.9.6",
"private": true,
"description": "Cross-platform messenger application built with electron, vue3, and TS.",
"author": {
"use strict";
-const { autoUpdater } = require('electron-updater')
-
import { initApp } from './background/init';
-import { protocol, dialog } from "electron";
+import { protocol } from "electron";
// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
// NOTE Program Begins Here
(async () => {
- autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'seMF_apn237iUw8puG9a' }
-
- const dialogConfig = {
- type: 'info',
- buttons: ['Restart', 'Later'],
- title: 'Application Update',
- message: 'A new version has been downloaded. Restart to update.'
- }
-
- autoUpdater.on('checking-for-update', () => {
- console.log("Checking for update...")
- })
-
- autoUpdater.on('update-available', () => {
- console.log("Update available.")
- })
-
- autoUpdater.on('download-progress', function (progress: any) {
- console.log(`Downloading update: ${progress.percent}`)
- })
-
- autoUpdater.on('error', (err: any) => {
- console.log(String(err))
- })
-
- autoUpdater.on('update-downloaded', () => {
- console.log("Update downloaded.")
- dialog.showMessageBox(dialogConfig).then((returnValue) => {
- if (returnValue.response === 0) autoUpdater.quitAndInstall()
- })
- })
-
- autoUpdater.checkForUpdatesAndNotify()
-
- setInterval(() => {
- autoUpdater.checkForUpdatesAndNotify()
- }, 5000)
-
console.log('Starting Crimata electron app.');
- initApp(isDev);
+ await initApp(isDev);
})();
-
-https://gitlab.com/crimata/electron-app/-/package_files/9495519/download
\ No newline at end of file
"use strict";
-import { app } from "electron";
+import { app, dialog } from "electron";
import { createWindow } from './window';
import { initSession } from './session';
import { initAudioIO } from './audio';
import { backgroundMitt } from '@/modules/emitter';
-const { autoUpdater } = require('electron-updater');
let win: boolean;
win = state;
});
+// Auto updating.
+const { autoUpdater } = require('electron-updater')
+autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'seMF_apn237iUw8puG9a' }
+
+autoUpdater.on('update-available', (info: any) => {
+ console.log(`Update available: ${info.version}`)
+})
+
+autoUpdater.on('update-downloaded', (info: any) => {
+
+ const updateDialog = {
+ type: 'info',
+ buttons: ['Restart', 'Later'],
+ title: 'Application Update',
+ message: info.version,
+ detail: 'A new version has been downloaded. Restart the application to apply the updates.'
+ }
+
+ dialog.showMessageBox(updateDialog).then((returnValue) => {
+ if (returnValue.response === 0) autoUpdater.quitAndInstall()
+ })
+
+})
+
// Run when electron app is initialized.
async function main() {
console.log("MAIN:Initializing Electron App.")
// On initial startup.
app.on("ready", () => {
- main()
+
+ // Check for updates every 2min.
+ setInterval(() => {
+ autoUpdater.checkForUpdates()
+ }, 5000) // 5s for development.
+
+ main()
});
// Must keep to ensure app doesn't quit on close.
// When user clicks app icon (re-open)
app.on("activate", () => {
- if (!win) {
- createWindow();
- }
+ if (!win) {
+ createWindow();
+ }
});
// Exit cleanly on request from parent process in development mode.
if (dev) {
process.on("SIGTERM", () => {
- app.quit();
+ app.quit();
});
}
}