add auto update check
This commit is contained in:
parent
f482d80cf4
commit
594f07d729
1 changed files with 15 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { app, BrowserWindow, autoUpdater } from 'electron'
|
import { app, BrowserWindow, autoUpdater, dialog } from 'electron'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
|
@ -87,3 +87,17 @@ autoUpdater.setFeedURL({ url: `https://updates.ollama.ai/update/${process.platfo
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
autoUpdater.checkForUpdates()
|
autoUpdater.checkForUpdates()
|
||||||
}, 60000)
|
}, 60000)
|
||||||
|
|
||||||
|
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
||||||
|
dialog
|
||||||
|
.showMessageBox({
|
||||||
|
type: 'info',
|
||||||
|
buttons: ['Restart Now', 'Later'],
|
||||||
|
title: 'New update available',
|
||||||
|
message: process.platform === 'win32' ? releaseNotes : releaseName,
|
||||||
|
detail: 'A new version of Ollama is available. Restart to apply the update.',
|
||||||
|
})
|
||||||
|
.then(returnValue => {
|
||||||
|
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue