check update response (#785)

This commit is contained in:
Bruce MacDonald 2023-10-13 18:05:46 -04:00 committed by GitHub
parent d790bf9916
commit c43873f33b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,17 +168,26 @@ async function isNewReleaseAvailable() {
try {
const response = await fetch('https://ollama.ai/api/update')
if (!response.ok) {
return false
}
if (response.status === 204) {
return false
}
const data = await response.json()
if (currentReleaseURL === data.url) {
const url = data?.url
if (!url) {
return false
}
currentReleaseURL = data.url
if (url === currentReleaseURL) {
return false
}
currentReleaseURL = url
return true
} catch (error) {
logger.error(`update check failed - ${error}`)