Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
3553d107
Unverified
Commit
3553d107
authored
Oct 13, 2023
by
Bruce MacDonald
Committed by
GitHub
Oct 13, 2023
Browse files
check for newer updates (#784)
Co-authored-by:
Jeffrey Morgan
<
jmorganca@gmail.com
>
parent
6fe17813
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
app/src/index.ts
app/src/index.ts
+34
-4
No files found.
app/src/index.ts
View file @
3553d107
...
...
@@ -162,13 +162,43 @@ app.on('before-quit', () => {
}
})
let
currentReleaseURL
=
''
async
function
isNewReleaseAvailable
()
{
try
{
const
response
=
await
fetch
(
'
https://ollama.ai/api/update
'
)
if
(
response
.
status
===
204
)
{
return
false
}
const
data
=
await
response
.
json
()
if
(
currentReleaseURL
===
data
.
url
)
{
return
false
}
currentReleaseURL
=
data
.
url
return
true
}
catch
(
error
)
{
logger
.
error
(
`update check failed -
${
error
}
`
)
return
false
}
}
async
function
checkUpdate
()
{
const
available
=
await
isNewReleaseAvailable
()
if
(
available
)
{
logger
.
info
(
'
checking for update
'
)
autoUpdater
.
checkForUpdates
()
}
}
function
init
()
{
if
(
app
.
isPackaged
)
{
autoUpdater
.
check
For
Update
s
()
checkUpdate
()
setInterval
(()
=>
{
if
(
!
updateAvailable
)
{
autoUpdater
.
checkForUpdates
()
}
checkUpdate
()
},
60
*
60
*
1000
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment