check update response (#785)
This commit is contained in:
parent
d790bf9916
commit
c43873f33b
1 changed files with 11 additions and 2 deletions
|
@ -168,17 +168,26 @@ async function isNewReleaseAvailable() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('https://ollama.ai/api/update')
|
const response = await fetch('https://ollama.ai/api/update')
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if (response.status === 204) {
|
if (response.status === 204) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
|
|
||||||
if (currentReleaseURL === data.url) {
|
const url = data?.url
|
||||||
|
if (!url) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
currentReleaseURL = data.url
|
if (url === currentReleaseURL) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
currentReleaseURL = url
|
||||||
return true
|
return true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`update check failed - ${error}`)
|
logger.error(`update check failed - ${error}`)
|
||||||
|
|
Loading…
Add table
Reference in a new issue