Skip to content

Commit

Permalink
Use correct url for auto updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorganca committed Oct 13, 2023
1 parent c43873f commit 832b4db
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ app.on('before-quit', () => {
}
})

let currentReleaseURL = ''
const updateURL = `https://ollama.ai/api/update?os=${process.platform}&arch=${
process.arch
}&version=${app.getVersion()}&id=${id()}`

let latest = ''
async function isNewReleaseAvailable() {
try {
const response = await fetch('https://ollama.ai/api/update')
const response = await fetch(updateURL)

if (!response.ok) {
return false
Expand All @@ -183,11 +186,12 @@ async function isNewReleaseAvailable() {
return false
}

if (url === currentReleaseURL) {
if (latest === url) {
return false
}

currentReleaseURL = url
latest = url

return true
} catch (error) {
logger.error(`update check failed - ${error}`)
Expand Down Expand Up @@ -285,11 +289,7 @@ function id(): string {
return uuid
}

autoUpdater.setFeedURL({
url: `https://ollama.ai/api/update?os=${process.platform}&arch=${
process.arch
}&version=${app.getVersion()}&id=${id()}`,
})
autoUpdater.setFeedURL({ url: updateURL })

autoUpdater.on('error', e => {
logger.error(`update check failed - ${e.message}`)
Expand Down

0 comments on commit 832b4db

Please sign in to comment.