first tests with autoupdater
This commit is contained in:
parent
e887064533
commit
ea70c69240
9
build.js
9
build.js
@ -6,7 +6,7 @@ const Platform = builder.Platform
|
||||
* @type {import('electron-builder').Configuration}
|
||||
*/
|
||||
const options = {
|
||||
appId: 'com.app.id',
|
||||
appId: 'com.stratum.crunchyrolldownloader',
|
||||
productName: 'Crunchyroll Downloader',
|
||||
|
||||
compression: 'maximum',
|
||||
@ -15,13 +15,18 @@ const options = {
|
||||
nodeGypRebuild: true,
|
||||
buildDependenciesFromSource: true,
|
||||
|
||||
publish: {
|
||||
provider: 'github',
|
||||
releaseType: 'release'
|
||||
},
|
||||
|
||||
directories: {
|
||||
output: 'crunchyroll-downloader-output-${version}'
|
||||
},
|
||||
|
||||
win: {
|
||||
artifactName: 'crunchyroll-downloader-${version}-windows-installer.${ext}',
|
||||
icon: "public/favicon.ico",
|
||||
icon: 'public/favicon.ico',
|
||||
target: [
|
||||
{
|
||||
target: 'nsis',
|
||||
|
@ -5,6 +5,7 @@
|
||||
"version": "1.0.4",
|
||||
"private": true,
|
||||
"main": ".output/src/electron/background.js",
|
||||
"repository": "https://github.com/stratuma/Crunchyroll-Downloader-v4.0",
|
||||
"scripts": {
|
||||
"dev": "nuxt dev -o",
|
||||
"build": "nuxt generate",
|
||||
|
@ -2,27 +2,14 @@ import { BrowserWindow, ipcMain } from 'electron'
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
import log from 'electron-log'
|
||||
|
||||
// Logger
|
||||
// ======
|
||||
autoUpdater.logger = log
|
||||
;(autoUpdater.logger as typeof log).transports.file.level = 'info'
|
||||
|
||||
// Config
|
||||
// ======
|
||||
autoUpdater.autoDownload = true
|
||||
autoUpdater.autoInstallOnAppQuit = true
|
||||
|
||||
// Module
|
||||
// ======
|
||||
export default (mainWindow: BrowserWindow) => {
|
||||
const isMac = process.platform === 'darwin'
|
||||
if (isMac) {
|
||||
autoUpdater.autoDownload = false
|
||||
autoUpdater.autoInstallOnAppQuit = false
|
||||
}
|
||||
|
||||
// Helpers
|
||||
// =======
|
||||
let readyToInstall = false
|
||||
function sendUpdaterStatus(...args: any[]) {
|
||||
mainWindow.webContents.send('updater:statusChanged', args)
|
||||
@ -49,8 +36,6 @@ export default (mainWindow: BrowserWindow) => {
|
||||
readyToInstall = true
|
||||
})
|
||||
|
||||
// IPC Listeners
|
||||
// =============
|
||||
ipcMain.handle('updater:check', async (_event) => {
|
||||
return await autoUpdater.checkForUpdates()
|
||||
})
|
||||
@ -62,7 +47,6 @@ export default (mainWindow: BrowserWindow) => {
|
||||
|
||||
autoUpdater.checkForUpdates()
|
||||
|
||||
// Check for updates every 2 hours
|
||||
setInterval(() => {
|
||||
autoUpdater.checkForUpdates()
|
||||
}, 1000 * 60 * 60 * 2)
|
||||
|
Reference in New Issue
Block a user