Check for updates once every 24 hours.

Bump version.
This commit is contained in:
Jonatan Heyman 2023-03-06 10:24:23 +01:00
parent 19dc637dee
commit 1df255032c
5 changed files with 25 additions and 3 deletions

View File

@ -10,3 +10,4 @@ export const UPDATE_DOWNLOAD_PROGRESS = "update-download-progress"
export const UPDATE_START_DOWNLOAD = "auto-update:startDownload"
export const UPDATE_INSTALL_AND_RESTART = "auto-update:installAndRestart"
export const UPDATE_CHECK_FOR_UPDATES = "auto-update:checkForUpdates"

View File

@ -9,6 +9,7 @@ import {
UPDATE_ERROR,
UPDATE_START_DOWNLOAD,
UPDATE_INSTALL_AND_RESTART,
UPDATE_CHECK_FOR_UPDATES,
} from '../constants'
@ -62,6 +63,10 @@ ipcMain.handle(UPDATE_INSTALL_AND_RESTART, () => {
setImmediate(() => autoUpdater.quitAndInstall(true, true))
})
ipcMain.handle(UPDATE_CHECK_FOR_UPDATES, () => {
autoUpdater.checkForUpdates()
})
export function checkForUpdates(win) {
window = win

View File

@ -13,6 +13,7 @@ import {
UPDATE_START_DOWNLOAD,
UPDATE_INSTALL_AND_RESTART,
UPDATE_DOWNLOADED,
UPDATE_CHECK_FOR_UPDATES,
} from "../constants"
import CONFIG from "../config"
@ -78,6 +79,9 @@ contextBridge.exposeInMainWorld("heynote", {
installAndRestart() {
ipcRenderer.invoke(UPDATE_INSTALL_AND_RESTART)
},
checkForUpdates() {
ipcRenderer.invoke(UPDATE_CHECK_FOR_UPDATES)
},
},
})

View File

@ -1,6 +1,6 @@
{
"name": "Heynote",
"version": "1.0.5",
"version": "1.0.6",
"main": "dist-electron/main/index.js",
"description": "A dedicated scratch pad",
"author": "Jonatan Heyman (https://heyman.info)",

View File

@ -10,7 +10,9 @@
transferred: 0.0,
total: 0.0,
bytesPerSecond: 0.0,
}
},
checkForUpdateIntervalId: null,
}
},
@ -39,7 +41,17 @@
this.downloading = true
this.updateProgress = progress
}
})
})
setInterval(() => {
this.checkForUpdateIntervalId = window.heynote.autoUpdate.checkForUpdates()
}, 1000 * 3600 * 24)
},
beforeUnmount() {
if (this.checkForUpdateIntervalId) {
clearInterval(this.checkForUpdateIntervalId)
}
},
computed: {