Compare commits
No commits in common. "2c39b6b5a632d28c3a88473dd0231dec70a8e06b" and "84d1c9f763a4be98359707caca2790703d969852" have entirely different histories.
2c39b6b5a6
...
84d1c9f763
|
|
@ -40,6 +40,6 @@ appImage:
|
||||||
npmRebuild: false
|
npmRebuild: false
|
||||||
publish:
|
publish:
|
||||||
provider: generic
|
provider: generic
|
||||||
url: https://git.thethomaas.net/TheThomaas/electron-vite-app
|
url: https://example.com/auto-updates
|
||||||
electronDownload:
|
electronDownload:
|
||||||
mirror: https://npmmirror.com/mirrors/electron/
|
mirror: https://npmmirror.com/mirrors/electron/
|
||||||
|
|
|
||||||
10175
package-lock.json
generated
10175
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -4,8 +4,7 @@
|
||||||
"description": "An Electron application with React and TypeScript",
|
"description": "An Electron application with React and TypeScript",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "example.com",
|
"author": "example.com",
|
||||||
"homepage": "https://git.thethomaas.net/TheThomaas/electron-vite-app",
|
"homepage": "https://electron-vite.org",
|
||||||
"repository": "https://git.thethomaas.net/TheThomaas/electron-vite-app",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"lint": "eslint --cache .",
|
"lint": "eslint --cache .",
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
import { app, shell, BrowserWindow, ipcMain, Notification } from 'electron'
|
import { app, shell, BrowserWindow, ipcMain } from 'electron'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||||
import icon from '../../resources/icon.png?asset'
|
import icon from '../../resources/icon.png?asset'
|
||||||
import { autoUpdater } from 'electron-updater'
|
|
||||||
|
|
||||||
autoUpdater.autoDownload = false;
|
|
||||||
autoUpdater.autoInstallOnAppQuit = true;
|
|
||||||
|
|
||||||
let mainWindow;
|
|
||||||
function createWindow(): void {
|
function createWindow(): void {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
width: 900,
|
width: 900,
|
||||||
height: 670,
|
height: 670,
|
||||||
show: false,
|
show: false,
|
||||||
|
|
@ -64,8 +59,6 @@ app.whenReady().then(() => {
|
||||||
// dock icon is clicked and there are no other windows open.
|
// dock icon is clicked and there are no other windows open.
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
})
|
})
|
||||||
|
|
||||||
checkForUpdates();
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Quit when all windows are closed, except on macOS. There, it's common
|
// Quit when all windows are closed, except on macOS. There, it's common
|
||||||
|
|
@ -79,39 +72,3 @@ app.on('window-all-closed', () => {
|
||||||
|
|
||||||
// In this file you can include the rest of your app's specific main process
|
// In this file you can include the rest of your app's specific main process
|
||||||
// code. You can also put them in separate files and require them here.
|
// code. You can also put them in separate files and require them here.
|
||||||
function showNotification(value: any) {
|
|
||||||
new Notification({
|
|
||||||
title: value,
|
|
||||||
}).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkForUpdates() {
|
|
||||||
autoUpdater.checkForUpdates();
|
|
||||||
console.log(`Checking for updates. Current version ${app.getVersion()}`);
|
|
||||||
showNotification(`Checking for updates. Current version ${app.getVersion()}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*New Update Available*/
|
|
||||||
autoUpdater.on("update-available", () => {
|
|
||||||
console.log(`Update available. Current version ${app.getVersion()}`);
|
|
||||||
showNotification(`Update available. Current version ${app.getVersion()}`);
|
|
||||||
let pth = autoUpdater.downloadUpdate();
|
|
||||||
console.log(pth);
|
|
||||||
showNotification(pth);
|
|
||||||
});
|
|
||||||
|
|
||||||
autoUpdater.on("update-not-available", () => {
|
|
||||||
console.log(`No update available. Current version ${app.getVersion()}`);
|
|
||||||
showNotification(`No update available. Current version ${app.getVersion()}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
/*Download Completion Message*/
|
|
||||||
autoUpdater.on("update-downloaded", () => {
|
|
||||||
console.log(`Update downloaded. Current version ${app.getVersion()}`);
|
|
||||||
showNotification(`Update downloaded. Current version ${app.getVersion()}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
autoUpdater.on("error", (info) => {
|
|
||||||
console.log(info);
|
|
||||||
showNotification(info);
|
|
||||||
});
|
|
||||||
Loading…
Reference in a new issue